Archive of AI

Source Snapshot / 2026-10-07-ai2-bolmo-nature-2

Bolmo 官方训练与模型改造代码

Linked event: 2026-10-07 · Bolmo Byte-Level Modeling Research Published in Nature and Expanded to Qwen and Llama

Publisher
Ai2/GitHub
Archived
2026-11-23
Capture Method
Direct page capture
HTTP / SHA-256
200 / 095a71237e3fb61d
Original URL
Open source ↗
Wayback Backup
Not archived
This page preserves a plain-text static snapshot against link rot. When citing figures, tables, or full legal terms, verify against the original URL and Wayback Machine archive.

[来源关键摘录] 仓库提供字节化训练流程,列出 Olmo、Qwen 和 Llama 衍生模型,并记录论文发表。

[正文前段节选] Skip to content

Navigation Menu

Appearance settings

You signed in with another tab or window. Reload to refresh your session.

You signed out in another tab or window. Reload to refresh your session.

You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

Repository navigation

NotificationsYou must be signed in to change notification settings

Star152 (152)You must be signed in to star a repository

Code for Bolmo: Byteifying the Next Generation of Language Models

allenai.org/papers/bolmo

Apache-2.0 license

Custom properties

Report repository

BranchesTags

Open more actions menu

Latest commit

1,240 Commits

Folders and files

Last commit message

Last commit date

bolmo_scripts

.readthedocs.yaml

CHANGELOG.md

QWEN3_06B_RESULTS.md

QWEN3_8B_TRAINING.md

data_sources_llama3.txt

data_sources_qwen3.txt

pyproject.toml

View all files

Repository files navigation

Bolmo: Retrofitting Language Models to Operate Over Bytes

News: Our work has now been published in Nature (link). We are releasing new checkpoints across more model families as part of the revised version.

This repository contains our work on byteifying language models. Unlike traditional language models that rely on subword tokenizers (like BPE or WordPiece), these models operates directly on raw UTF-8 bytes, making them:

Free of subword tokenization: No need for language-specific tokenizers or vocabulary management.

Universally applicable: Works seamlessly across all languages, scripts, and domains.

Fully open: Complete training code, model weights, data processing pipeline, and paper.

Competitive performance: Comes close to matching (and in some cases exceeds) subword-based state-of-the-art models across a wide range of tasks.

Better character understanding: Superior performance on tasks requiring character-level knowledge.

As part of this effort, we are releasing byteified checkpoints of OLMo 2 1B, Olmo 3 7B, Qwen 3 8B and Llama3 8B.

allenai/Bolmo-7B

allenai/Bolmo-1B

allenai/Llama-3-Blama-8B

We also release checkpoints which have undergone Stage 1 training only (only learning parameters for the new byte-level encoder and decoder, without changes to the internal model parameters).

Bolmo-7B Stage 1

allenai/Bolmo-7B-Stage1

Bolmo-1B Stage 1

allenai/Bolmo-1B-Stage1

Bwen-8B Stage 1

Blama-8B Stage 1

allenai/Llama-3-Blama-8B-Stage1

See our Nature paper for details: https://allenai.org/papers/bolmo.

This repository is a fork of OLMo-core that implements the complete Bolmo architecture and training pipeline through byteifying - our approach to converting existing subword models to byte-level models, using <1% of the pretraining budget.

Training data is available via HuggingFace at allenai/bolmo_mix.

Installation

First install PyTorch according to the instructions specific to your operating system and hardware.

Using UV (Recommended)

git clone https://github.com/allenai/bolmo-core.git

cd bolmo-core

uv venv --python 3.12.12

. .venv/bin/activate

uv sync --frozen --extra xlstm --extra wandb

This will install the precise version used for development of all packages (as saved in uv.lock). Installation should typically take less than five minutes.

Alternatively, via pip:

pip install -e .[xlstm,wandb]

Optional Dependencies

For full functionality, you may need:

flash-attn for efficient attention

TransformerEngine for optimized training

xlstm for xLSTM components (mLSTM layers used in the Bolmo local models)

Liger-Kernel for low-memory loss implementations

See the OLMo-core documentation for complete installation details.

We tested Bolmo installation on Ubuntu 24.04 and Rocky Linux release 8.10.

Inference with HuggingFace

from transformers import AutoModelForCausalLM, AutoTokenizer

device = "cuda"

bolmo = AutoModelForCausalLM.from_pretrained("allenai/Bolmo-7B", trust_remote_code=True).to(device)

tokenizer = AutoTokenizer.from_pretrained("allenai/Bolmo-7B", trust_remote_code=True)

message = ["Language modeling is "]

input_ids = tokenizer(message, return_tensors="pt")["input_ids"].to(device)

# `max_new_tokens` is the amount of bytes to generate

response = bolmo.generate(input_ids, max_new_tokens=256, do_sample=True, temperature=0.1)

print(tokenizer.decode(response[0], skip_special_tokens=True))

This should quickly generate a completion on a standard GPU (usually <5min, including downloading the weights from the internet). It should generate something like:

Language modeling is a fundamental task in natural language processing (NLP), aiming to predict the probability of a sequence of words occurring in a given context. This prediction is crucial for various applications, including speech recognition, machine translation, and text generation. [...]

HuggingFace checkpoints vs. olmo-core checkpoints

This codebase uses the olmo-core checkpoint format. Bolmo models can be converted from this format to the HuggingFace format via:

python3 src/examples/huggingface/convert_checkpoint_to_hf.py \

-i /path/to/bolmo/checkpoint \

-o /path/to/bolmo/checkpoint/in/hf/format \

-s 65536 \ # max sequence length

--dtype float32 \

--skip-validation

Converting from HF format back to olmo-core is not implemented at the moment. However, we provide the original olmo-core checkpoints for Bolmo 1B and Bolmo 7B in the olmo_core/ subdirectory on HF: 1B, 7B.

Bolmo training uses a two-stage byteifying procedure to convert existing subword models to byte-level:

Stage 1: Subword-to-Byte Distillation

Quickly learn weights for local models while freezing the global model (9.8B tokens ≈ 43B bytes). Training scripts for this stage are available at bolmo_scripts/launch_stage1_*.

To run the Stage 1 training script, first prepare your training data (for example, the bolmo_mix dataset) via the Dolma toolkit, see here for details.

Stage 2: End-to-End Training

Train the entire model to utilize byte-level information (39.3B tokens ≈ 173B bytes). Training scripts for this stage are available at bolmo_scripts/launch_stage2_*.

Post-Training via Task Arithmetic

Existing post-trained checkpoints can be byteified without additional training using Task Arithmetic:

python3 src/examples/bolmo/instructify.py \

--output=/path/to/output/ \

--checkpoint-dir=/path/to/bolmo/checkpoint \

--base-checkpoint-dir=/path/to/base-olmo/checkpoint \

--instruct-checkpoint-dir=/path/to/post-trained-olmo/checkpoint \

Reproducing Evaluation

Full evaluation results available in the paper.

We use olmes for all evaluations.

You can evaluate Bolmo like any subword LLM, except for one Gotcha: for loglikelihood evals, we need to fold the boundary + byte logits (second half of the vocabulary) into the byte logits (first half of the vocabulary):

probs = F.softmax(logits.float(), dim=-1)

probs[..., :self.vocab_size_bolmo] += probs[..., self.vocab_size_bolmo:self.vocab_size_bolmo*2]

logits = torch.log(probs)

logits[..., self.vocab_size_bolmo:self.vocab_size_bolmo*2] = -100_000

The fork of OLMES at http://github.com/bminixhofer/olmes implements this option. You can evaluate Bolmo like this for example:

--model allenai/Bolmo-1B \

--model-args '{"max_length": 16384, "trust_remote_code": "true", "model_type": "hf_bolmo", "add_bos_token": "true"}' \

--task bolmo1b \

--batch-size 32 \

--output-dir workspace

This will reproduce the evals for Bolmo 1B. See also #6. The olmes task suites for Bolmo 1B and Bolmo 7B are defined here: link.

To cite Bolmo:

@misc{bolmo,

title={Bolmo: Byteifying the Next Generation of Language Models},

author={Benjamin Minixhofer and Tyler Murray and Tomasz Limisiewicz and Anna Korhonen and Luke Zettlemoyer and Noah A. Smith and Edoardo M. Ponti and Luca Soldaini and Valentin Hofmann},

year={2025},

eprint={2512.15586},

archivePrefix={arXiv},

primaryClass={cs.CL},

url={https://arxiv.org/abs/2512.15586},

For the underlying OLMo-core framework:

@misc{olmo20242olmo2furious,

title={{2 OLMo 2 Furious}},

[...内容已截断,完整版请查看原文或 Wayback 快照]