Downloads · 30 days
0
Sebasdi/nanodiff-150m-sft-alpaca
nanodiff-150m-sft-alpaca is a text generation model from Sebasdi. Use it when you need the model to write or continue text. It is set up for pytorch. The card lists the license as mit.
An instruction-tuned masked diffusion language model: the nanoDiff 150M base, supervised-fine-tuned on Alpaca-cleaned so it follows instructions instead of merely continuing text.
Downloads · 30 days
0
Access
Public
Updated May 23, 2026
Repo size
2.4 GB
Likes
0
Public
Click a slice to open those files.
.pt2.4 GB · 100%
From the Hugging Face model README
An instruction-tuned masked diffusion language model: the nanoDiff 150M base, supervised-fine-tuned on Alpaca-cleaned so it follows instructions instead of merely continuing text.
The larger sibling of nanodiff-50m-sft-alpaca. From the nanoDiff project — a minimal, hackable "nanoGPT for diffusion LLMs".
| Base model | Sebasdi/nanodiff-150m-base |
| Fine-tuned on | yahma/alpaca-cleaned (~51k examples) |
| Method | LLaDA Algorithm 2 — masked-diffusion SFT, response-only masking |
| Result | SFT response NLL-bound ~1.27 · LAMBADA accuracy 15.74% |
| Parameters | ~203M total · ~152M non-embedding |
| Hardware | NVIDIA DGX-Spark (GB10), ~80 min |
The base model is a document continuer — give it text and it continues it. This fine-tuned version has additionally learned the instruction → response format: given an instruction, it produces an on-topic answer.
SFT changed only behavior, not knowledge. At 150M params and ~3B tokens of pretraining, the model still confabulates — see Limitations.
Sebasdi/nanodiff-150m-base — a masked diffusion LM, ~203M total / ~152M non-embedding params, pretrained on ~3B tokens of FineWeb-Edu (validation perplexity ~44, LAMBADA accuracy 21.89%).
yahma/alpaca-cleaned — ~51,760 single-turn instruction/response examples (the community-curated Alpaca, with the original's factual and formatting errors fixed). 50,760 were used for training, 1,000 held out for validation.
A small change from pretraining:
<|endoftext|> padding on short responses stays in the loss — that is what
teaches the model to end its answer.Each example is encoded as [prompt | response], where
prompt = "### Instruction:\n{instruction}\n\n### Response:\n" (with an
### Input: block when the example has an input field).
| Initialized from | nanodiff-150m-base |
| Examples | 50,760 train / 1,000 val |
| Prompt / response length | 256 / 256 tokens |
| Optimizer | AdamW |
| LR schedule | cosine, warmup 100, 7e-5 → 1e-5 |
| Batch size | 64 |
| Iterations | 5,000. Mirrors the 50M-SFT recipe exactly so the comparison is methodologically clean — only the model architecture and the (1/√width-rescaled) LR differ. |
| Precision | bf16, torch.compile |
| Hardware | NVIDIA DGX-Spark (GB10) |
| Wall-clock | ~80 minutes |
LAMBADA (last-word prediction, single-pass diffusion scoring, full 5153-example test split):
| Model | Best val (SFT) | LAMBADA acc | LAMBADA PPL |
|---|---|---|---|
| nanodiff-50m-sft-alpaca | 1.38 | 14.32% | 3344 |
| nanodiff-150m-sft-alpaca | 1.27 | 15.74% | 1606 |
And for context, on the unaligned base models:
| Model | LAMBADA acc | LAMBADA PPL |
|---|---|---|
| nanodiff-50m-base | 19.83% | 834 |
| nanodiff-150m-base | 21.89% | 358 |
The alignment tax (LAMBADA accuracy drop from base → SFT) is −5.51 pp
for the 50M and −6.15 pp for the 150M — i.e., almost identical in relative
terms (~28% of base accuracy lost) at both scales. So scaling capacity helps
both the base and the SFT model, but does not shrink the alignment tax
proportionally. The perplexity blow-up post-SFT is also similar at both scales
(~4×) — the SFT distribution shift is, to first order, capacity-independent.
df2c6a7sft/configs/150m_alpaca.pypython scripts/prepare_sft_data.py --out-dir data/alpaca_sft
then python sft/train.py --config sft/configs/150m_alpaca.pyhf download Sebasdi/nanodiff-150m-sft-alpaca nanodiff-150m-sft-alpaca.pt --local-dir checkpoints/
# interactive — note the --sft flag
python chat.py --ckpt checkpoints/nanodiff-150m-sft-alpaca.pt --sft
In --sft mode chat.py wraps each turn in the instruction template, treats
it as an independent single-turn instruction, and truncates the answer at the
model's <|endoftext|> end-marker. Prompt it with instructions:
The repetition penalty (--rep-penalty 3.0, on by default) is required — small
diffusion LMs collapse into repetition loops without it.
>>> Give one tip for staying healthy.
<<< One tip for staying healthy is to eat well-balanced foods that are high in
essential nutrients such as vitamins and minerals. This will help you stay
fit over the longer term by boosting your body's natural immune system
function while maintaining a steady weight loss rate throughout the day or
week if you're not getting enough sleep at all! A balanced diet can have a
wide range of benefits, including mental health, physical fitness, and
overall health.
(Sample generated at --gen-length 96 --steps 96 --rep-penalty 3.0 --seed 1337.
The 50M SFT, on the same prompt, gave a stilted "step #1, step #2, step #3"
list — the 150M's longer coherent prose is the qualitative improvement that
goes alongside the LAMBADA gain.)
A learning artifact demonstrating the full base → SFT pipeline at the next rung up from the 50M — not a usable assistant.
@article{nie2025llada,
title = {Large Language Diffusion Models},
author = {Nie, Shen and others},
journal = {arXiv preprint arXiv:2502.09992},
year = {2025}
}