gaggle-nanochat-0.9b-ift-climbmix-20261108
The chat model made from
castorini/gaggle-nanochat-0.9b-pretrained-climbmix-20261105
(step 229,067) with nanochat's standard two-stage chat recipe: midtraining, then supervised fine-tuning (SFT).
No RL. The midtraining checkpoint is included as well. It is the 0.9B counterpart of
castorini/gaggle-nanochat-ift-climbmix-20261031:
the same recipe, data and code, applied to the smaller base model.
The same weights load three ways, with the base model's code: with transformers (trust_remote_code=True), with
vLLM (through the Gaggle plugin), and with nanochat's own code from the original checkpoint files.
Model
Architecture, tokenizer and code are those of the base model, unchanged; only the weights differ.
| Architecture | nanochat decoder-only transformer: 32 layers, width 1,152, 9 attention heads of dimension 128, 2,048-token context; a value embedding on every 4th layer; 0.89B parameters (0.30B of them value-embedding lookups) |
| Tokenizer | the base model's byte-level BPE, 32,768 entries (the same tokenizer as the 3.3B Gaggle models) |
| Chat format | nanochat's: <|bos|>, then <|user_start|>...<|user_end|> and <|assistant_start|>...<|assistant_end|> turns; a system message is merged into the first user message |
| Code | karpathy/nanochat at commit 92d63d4, plus a 15-line patch for the value-embedding spacing (nanochat-92d63d4-ve_every.patch, see Usage) |
Training
This is the 3.3B Gaggle chat model's post-training, unchanged. nanochat removed midtraining on 2026-01-31 (commit
1ddaad1); the recipe is the last two-stage version, nanochat commit 348fbb3 (scripts/mid_train.py, then
scripts/chat_sft.py starting from the midtrained model), with its data and hyperparameters unchanged, ported onto
nanochat 92d63d4, the code the base model was trained with. The only change for this model is one line in the
ported mid_train.py: the checkpoint metadata it writes now records ve_every, without which SFT would rebuild the
model with nanochat's default spacing and could not load the weights. Both stages start with a fresh optimizer.
Midtraining (one epoch, 816 steps of 524,288 tokens, 2,048-token sequences with BOS-aligned best-fit packing, loss on all tokens):
| Data | Rows |
|---|---|
| smol-smoltalk train | 460,341 |
MMLU auxiliary_train | 99,842 |
GSM8K main train | 7,473 |
| nanochat identity conversations, 2 epochs | 2,000 |
| SimpleSpelling | 200,000 |
| SpellingBee | 80,000 |
| Total | 849,656 |
Learning rates 0.2 (embeddings), 0.004 (unembedding), 0.02 (Muon, block matrices), no weight decay; constant for the first 80% of training, then linear decay to zero; Muon momentum 0.85 to 0.95 over the first 300 steps. As in every nanochat run, the AdamW rates are scaled by 1/√(width/768), here 0.816.
SFT (one epoch, 701 steps of 32 conversations, loss on assistant tokens only):
| Data | Rows |
|---|---|
| ARC-Easy train | 2,251 |
| ARC-Challenge train | 1,119 |
GSM8K main train | 7,473 |
| smol-smoltalk train, first 10,000 after nanochat's seed-42 shuffle | 10,000 |
| nanochat identity conversations | 1,000 |
| SimpleSpelling | 300 |
| SpellingBee | 300 |
| Total | 22,443 |
Same learning rates scaled by 0.02, decayed linearly to zero.
Neither stage replays pre-training (ClimbMix) text.
Compute: two NVIDIA H200 GPUs. The recipe's batch sizes are kept by gradient accumulation (midtraining: 16 sequences per GPU per micro-batch; SFT: 4 conversations). Midtraining took 29 min, SFT 6 min.
Evaluation
The 0.9B and 3.3B Gaggle models at each stage: pre-trained (PT), after midtraining, and after midtraining + SFT (this model). The 3.3B rows are from its model card: its PT row is the Gaggle paper's, as on the 3.3B base model's card, and its post-trained rows were measured with the same code as ours. Each model is shown in the format it was trained for:
- Few-shot, plain text (pre-trained models): MMLU and MMLU-Pro 5-shot with the LM Evaluation Harness 0.4.9 (
mmlu,leaderboard_mmlu_pro); ARC-Easy and ARC-Challenge 10-shot as in CORE (500 questions each); all scored by the log-likelihood of the answer. CORE is nanochat's average centered accuracy over 22 in-context-learning tasks (500 examples each). - Zero-shot, chat (post-trained models): nanochat's
chat_evalin the chat format, on the full test sets; ARC, MMLU and MMLU-Pro by the answer letter, GSM8K and HumanEval by greedy generation (up to 512 tokens). ChatCORE is nanochat's mean centered accuracy over ARC-Easy, ARC-Challenge, MMLU, GSM8K and HumanEval. nanochat has no MMLU-Pro task; ours (code/tasks/mmlu_pro.py) is its MMLU task on MMLU-Pro's 12,032 test questions, with each question's own options lettered A to J.
| Stage | Model | Format | MMLU | MMLU-Pro | ARC-Easy | ARC-Challenge | GSM8K | HumanEval | CORE | ChatCORE |
|---|---|---|---|---|---|---|---|---|---|---|
| PT | Gaggle 0.9B | few-shot, plain text | 35.7 | 11.8 | 76.2 | 47.0 | — | — | 0.370 | — |
| PT | Gaggle 3.3B | few-shot, plain text | 49.27 | 17.76 | 83.4 | 59.0 | — | — | 0.458 | — |
| PT + midtraining | Gaggle 0.9B, step 816 (in this repo) | zero-shot, chat | 38.33 | — | 63.22 | 48.21 | 7.43 | 6.71 | — | 0.228 |
| PT + midtraining | Gaggle 3.3B | zero-shot, chat | 44.32 | 19.90 | 80.01 | 65.70 | 13.95 | 16.46 | — | 0.368 |
| PT + midtraining + SFT | Gaggle 0.9B (this model) | zero-shot, chat | 38.14 | 16.69 | 65.95 | 49.32 | 19.41 | 5.49 | — | 0.259 |
| PT + midtraining + SFT | Gaggle 3.3B | zero-shot, chat | 44.93 | 19.97 | 81.57 | 68.00 | 30.63 | 15.85 | — | 0.412 |
"—" means not measured: GSM8K and HumanEval are generation tasks run only in the chat format, CORE and ChatCORE each belong to one format, and MMLU-Pro was not measured for the 0.9B midtraining checkpoint.
What the comparison shows:
- After SFT, the 0.9B model trails the 3.3B one on every benchmark: ChatCORE 0.259 against 0.412; 6.8 points on MMLU, 3.3 on MMLU-Pro, 15.6 on ARC-Easy, 18.7 on ARC-Challenge, 11.2 on GSM8K and 10.4 on HumanEval.
- SFT over midtraining helps mostly on GSM8K, as for the 3.3B model: +12.0 points (7.4 to 19.4; 3.3B: +16.7). ChatCORE rises by 0.031 (3.3B: 0.044).
- The two formats move differently than for the 3.3B model. ARC-Easy is 10.3 points lower in the chat format after SFT than few-shot before it (76.2 to 66.0), against 1.8 for the 3.3B model; MMLU is 2.4 points higher (35.7 to 38.1), where the 3.3B model is 4.3 lower. The formats differ, so these are not same-task comparisons.
Validation: midtraining validation loss fell from 0.451 to 0.336 bits per byte; SFT validation loss 0.835.
Usage
Prompts must use nanochat's chat format, which the tokenizer's chat template produces exactly
(apply_chat_template(..., add_generation_prompt=True) ends with <|assistant_start|>), and replies end with
<|assistant_end|>, which is the eos token. The context is 2,048 tokens.
transformers
pip install "transformers>=4.57" "torch>=2.5"
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "castorini/gaggle-nanochat-0.9b-ift-climbmix-20261108"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True, dtype=torch.bfloat16).to("cuda").eval()
messages = [{"role": "user", "content": "What is the capital of France?"}]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt",
return_dict=True).to("cuda")
out = model.generate(**inputs, max_new_tokens=64, do_sample=False)
print(tokenizer.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Output on one NVIDIA RTX 6000 Ada GPU:
The capital of France is Paris. It is a city located in the northern part of the country, bordering Belgium, the English Channel, and the Loire River. Paris is the largest city in France and the most populous in Europe, known for its historical landmarks, cultural institutions, and romantic atmosphere.
The reply is verbatim, mistakes included: a model of this size states facts unreliably.
trust_remote_code=True is needed because the architecture is nanochat's; configuration_gaggle.py and
modeling_gaggle.py are the base model's files, byte for byte. The chat template already adds <|bos|>: if you render
it to a string first, tokenize that string with add_special_tokens=False, or the tokenizer adds a second <|bos|>.
vLLM
vLLM has no built-in class for this architecture, so install the Gaggle plugin (a copy is in this repo; it is the 3.3B models' plugin, byte for byte, and needs vLLM 0.17 or newer); vLLM then finds it automatically:
pip install vllm https://huggingface.co/castorini/gaggle-nanochat-0.9b-ift-climbmix-20261108/resolve/main/vllm_gaggle-0.1.0-py3-none-any.whl
vllm serve castorini/gaggle-nanochat-0.9b-ift-climbmix-20261108 --trust-remote-code
from vllm import LLM, SamplingParams
llm = LLM("castorini/gaggle-nanochat-0.9b-ift-climbmix-20261108", trust_remote_code=True)
out = llm.chat([{"role": "user", "content": "What is the capital of France?"}],
SamplingParams(max_tokens=64, temperature=0))
print(out[0].outputs[0].text)
Output on one NVIDIA L40S GPU (vLLM 0.17.0): the same reply as transformers above, token for token.
Both LLM.chat and vllm serve's OpenAI-compatible chat endpoint use the chat template from tokenizer_config.json,
and replies stop at <|assistant_end|>.
nanochat
The original checkpoints are laid out as a nanochat base directory, so nanochat's chat scripts load them directly.
Stock nanochat places a value embedding on every other layer; this model has one on every 4th, so apply the 15-line
patch in this repo, which adds that setting (ve_every) and leaves models without it unchanged:
git clone https://github.com/karpathy/nanochat.git
cd nanochat && git checkout 92d63d4
uv sync --extra gpu
export NANOCHAT_BASE_DIR=$(uv run --with huggingface_hub python -c "from huggingface_hub import snapshot_download; \
print(snapshot_download('castorini/gaggle-nanochat-0.9b-ift-climbmix-20261108', allow_patterns=['tokenizer/*', 'chatsft_checkpoints/*', 'nanochat-92d63d4-ve_every.patch']))")
git apply $NANOCHAT_BASE_DIR/nanochat-92d63d4-ve_every.patch
uv run --extra gpu python -m scripts.chat_cli -i sft -g gaggle229067 # chat in the terminal
uv run --extra gpu python -m scripts.chat_eval -i sft -g gaggle229067 # the chat evaluation above
From Python, nanochat.checkpoint_manager.build_model(f"{NANOCHAT_BASE_DIR}/chatsft_checkpoints/gaggle229067", step=700, device=..., phase="eval") returns the model, tokenizer and metadata; conversations go through
tokenizer.render_conversation / render_for_completion.
Stock 92d63d4 has no mid source and no MMLU-Pro task. code/ has both: the patched
nanochat/checkpoint_manager.py (maps -i mid to mid_checkpoints), tasks/mmlu_pro.py, and scripts/chat_eval.py
with MMLU-Pro added (-a MMLU-Pro).
The implementations agree
transformers and vLLM load the same tensors as nanochat. We checked them against nanochat's own forward pass on the
original SFT checkpoint, with the 3.3B chat model's checks (code/hf/).
| Check | Result |
|---|---|
transformers vs nanochat, bf16 on an NVIDIA RTX 6000 Ada (both with PyTorch SDPA attention): logits of real text at 2 to 2,048 tokens | bitwise identical |
| same, a right-padded batch vs nanochat on the same batch | bitwise identical |
| loss on a 2,048-token sequence | identical (1.6194) |
| greedy generation, 5 text prompts x 48 tokens | identical token for token without the KV cache; with the cache 3 of 5, and 3 of 5 in a left-padded batch (bf16 rounding, below) |
greedy chat replies, 6 prompts up to 96 tokens, stopping at <|assistant_end|> | identical token for token without the KV cache (6 of 6); 5 of 6 with the cache and in a left-padded batch |
| tokenizer vs nanochat's, 400 documents | identical ids, identical decoding |
chat template vs nanochat's render_conversation / render_for_completion, 5,700 conversations (smol-smoltalk, GSM8K with tool calls, MMLU, MMLU-Pro, ARC, identity, SimpleSpelling, SpellingBee), message content as strings and as lists of text parts (as vLLM passes it) | identical ids, apart from the two nanochat behaviours below |
vLLM 0.17 chat (LLM.chat, bf16, NVIDIA L40S): prompt ids, greedy replies to the 6 chat prompts | prompt ids identical to the chat template's; 5 of 6 replies identical to transformers |
nanochat 92d63d4 + nanochat-92d63d4-ve_every.patch, loading both checkpoints from this repo's layout | both load; nanochat's greedy reply to the usage example's prompt is the same text as transformers' |
Two nanochat behaviours the chat template does not copy, the same as for the 3.3B model: nanochat cuts a rendered conversation at 2,048 tokens (the template does not; this is all 39 of the 3,000 smol-smoltalk prompts that differed), and it tokenizes consecutive text parts of one assistant message separately, where the template joins them (all 300 SpellingBee training conversations become identical once the parts are joined). Neither affects ordinary chat prompts.
In bf16, any change of kernel shape (batching, padding, a KV cache, a different attention kernel) moves logits by
rounding, which can flip near-tied greedy choices; nanochat itself behaves the same way.
convert_nanochat_to_hf.py is the base repo's converter, unchanged;
convert_ift.py runs it on model_000700.pt and adds the chat template.
Files
model.safetensors: the weights fortransformersand vLLM. These are the tensors ofchatsft_checkpoints/gaggle229067/model_000700.pt, unchanged in value and dtype, renamed tomodel.<nanochat name>(lm_head.weightkeeps its name).config.json,generation_config.json,configuration_gaggle.py,modeling_gaggle.py: the architecture fortransformersand vLLM; the two.pyfiles are the base model's.tokenizer.json(the base model's),tokenizer_config.json(the base model's plus the chat template and<|assistant_end|>as eos).vllm_gaggle-0.1.0-py3-none-any.whl,vllm_plugin/: the Gaggle vLLM plugin, the same files as the 3.3B models'.chatsft_checkpoints/gaggle229067/model_000700.pt,meta_000700.json: this model for nanochat (SFT, step 700).mid_checkpoints/gaggle229067/model_000816.pt,meta_000816.json: the midtraining checkpoint (step 816), nanochat only; no optimizer state.tokenizer/: the base model's tokenizer in nanochat's format, unchanged.nanochat-92d63d4-ve_every.patch: adds the value-embedding spacing to nanochat92d63d4(needed to load the.ptfiles with nanochat).code/: the ported midtraining, SFT and evaluation scripts and patched nanochat files that were run (scripts/,nanochat/,tasks/), the launch scripts (run/), and the conversion and vLLM checks (code/hf/).logs/: training, evaluation and check logs.SHA256SUMS: checksums of every other file.
Related
castorini/gaggle-nanochat-0.9b-pretrained-climbmix-20261105: the base model.castorini/gaggle-nanochat-ift-climbmix-20261031: the 3.3B chat model, the same recipe on the 3.3B base model.
Citation
@misc{lin2026projectgreenhouseprogressfully,
title={{Project Greenhouse}: Progress Toward Fully Open and Sovereign Agentic Search},
author={Jimmy Lin and Sahel Sharifymoghaddam and Lingwei Gu and Nour Jedidi},
year={2026},
eprint={2610.11922},
archivePrefix={arXiv},
primaryClass={cs.IR},
url={https://arxiv.org/abs/2610.11922}
}