Add benchmark protocol specs (from slm-architecture-benchmark-specs, now consolidated here)
Browse files- benchmark_specs.md +142 -0
benchmark_specs.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SLM Benchmark Protocol Specs
|
| 2 |
+
|
| 3 |
+
A reference for the **exact conventions** to use when benchmarking very small
|
| 4 |
+
language models (roughly 0.5M–500M params), so that numbers on different model
|
| 5 |
+
cards are actually comparable. The single most common source of "disagreement"
|
| 6 |
+
between two honest benchmark runs is not a bug — it is a silent difference in
|
| 7 |
+
convention. This dataset pins those conventions down.
|
| 8 |
+
|
| 9 |
+
Every convention here is either (a) something I verified end-to-end against a
|
| 10 |
+
real checkpoint in the sandbox, or (b) a standard convention I label as such.
|
| 11 |
+
Worked examples with real numbers are in [`benchmark_specs_examples.jsonl`](benchmark_specs_examples.jsonl).
|
| 12 |
+
|
| 13 |
+
## 1. Perplexity: token-level vs byte-level (the one that bites)
|
| 14 |
+
|
| 15 |
+
This is the convention that most often makes two runs "disagree" by 15–25%.
|
| 16 |
+
|
| 17 |
+
**Token-level PPL** = `exp(sum(NLL) / num_tokens)`. This is what most harnesses
|
| 18 |
+
report by default.
|
| 19 |
+
|
| 20 |
+
**Byte-level PPL** (`byte_ppl`) and **bits-per-byte** (`BPB`) normalize by the
|
| 21 |
+
number of **bytes** in the raw text, not the number of tokens:
|
| 22 |
+
|
| 23 |
+
```
|
| 24 |
+
byte_ppl = exp( sum(NLL) / total_bytes )
|
| 25 |
+
BPB = sum(NLL) / total_bytes / ln(2)
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
The two are related by the **bytes-per-token** (BPT) factor of the tokenizer:
|
| 29 |
+
|
| 30 |
+
```
|
| 31 |
+
byte_ppl ≈ token_ppl^(1/BPT) (approx, when NLL is spread evenly)
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
**The BPT factor is the thing to get right.** It is *not* a constant and *not*
|
| 35 |
+
"the average token length in characters". It is:
|
| 36 |
+
|
| 37 |
+
```
|
| 38 |
+
BPT = raw_text_bytes / token_count
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
where `raw_text_bytes` is the UTF-8 byte length of the **raw** evaluation text
|
| 42 |
+
(standard join+strip) and `token_count` is the number of tokens your tokenizer
|
| 43 |
+
produces for that same text.
|
| 44 |
+
|
| 45 |
+
**Worked case (verified):** GoLLeM-v5 64M on WikiText-2 test.
|
| 46 |
+
- raw text = 1,292,008 UTF-8 bytes
|
| 47 |
+
- BPE-12288 tokenizer → 334,674 tokens (lossless: `decode(encode(text))` is
|
| 48 |
+
byte-identical to the raw text)
|
| 49 |
+
- BPT = 1,292,008 / 334,674 = **3.8605**
|
| 50 |
+
|
| 51 |
+
A card that reported `byte_ppl 2.016 / BPB 1.012` was using a **wrong BPT factor
|
| 52 |
+
of 4.755** (counting characters, not bytes, and including/excluding leading
|
| 53 |
+
whitespace inconsistently). The correct numbers, computed with BPT 3.8605, are
|
| 54 |
+
`byte_ppl 2.372 / BPB 1.246` — matching an independent re-benchmark that
|
| 55 |
+
decoded each token to UTF-8 (3.864 BPT, includes the leading spaces BPE tokens
|
| 56 |
+
carry). **Lesson: if your byte numbers are suspiciously better than a
|
| 57 |
+
re-benchmark, check your BPT factor first.**
|
| 58 |
+
|
| 59 |
+
> Note: leading spaces. BPE tokens carry their leading space, so decoding each
|
| 60 |
+
> token to UTF-8 and concatenating reproduces the raw text byte-for-byte. If you
|
| 61 |
+
> strip leading whitespace before counting bytes, your BPT drops and your
|
| 62 |
+
> `byte_ppl` looks better than it is. Count the **raw** bytes.
|
| 63 |
+
|
| 64 |
+
## 2. Parameter counting (card vs artifact)
|
| 65 |
+
|
| 66 |
+
When you compare a card's stated param count against the safetensors header:
|
| 67 |
+
|
| 68 |
+
- **Exclude `__metadata__`** from the tensor count. It is not a tensor; counting
|
| 69 |
+
it makes your tensor count exactly one too high.
|
| 70 |
+
- **Exclude buffers, not just params.** Tables like `rope.cos` / `rope.sin`,
|
| 71 |
+
1-element `_extra_state` entries, and a 32-element `rotary_emb.inv_freq` are
|
| 72 |
+
buffers, not parameters. Subtract them before comparing to the card.
|
| 73 |
+
- **Tied embeddings: subtract one copy.** If `tie_word_embeddings: true`, the
|
| 74 |
+
header stores *both* `token_embeddings.weight` and `lm_head.weight` (a
|
| 75 |
+
duplicate). The unique param count is the header total minus one copy
|
| 76 |
+
(`vocab_size × hidden_size`). A card that reports the raw header total is
|
| 77 |
+
over-counting by exactly that amount.
|
| 78 |
+
- State what you excluded rather than silently dropping it.
|
| 79 |
+
|
| 80 |
+
**Worked case (verified):** ANKA-50M-RMW3. Card "48,944,657 unique" = header
|
| 81 |
+
total 57,333,265 minus one tied-embedding copy (16384×512 = 8,388,608). Exact.
|
| 82 |
+
|
| 83 |
+
## 3. The standard zero-shot suite and its prompt conventions
|
| 84 |
+
|
| 85 |
+
For a word/subword LM that can actually read benchmark text, the default suite
|
| 86 |
+
in priority order, with the convention that matters for comparability:
|
| 87 |
+
|
| 88 |
+
| Task | What it measures | Convention that matters |
|
| 89 |
+
|---|---|---|
|
| 90 |
+
| **BLiMP** | grammatical minimal pairs | loglikelihood of continuation; report % of pairs where the grammatical continuation has higher log-prob |
|
| 91 |
+
| **ARC-Easy / ARC-Challenge** | grade-school science reasoning | **bare-prompt, 256-token clip** (Glint board protocol): prompt = question + options with no extra scaffolding; clip to 256 tokens; score by loglikelihood of the correct option letter |
|
| 92 |
+
| **PIQA** | physical commonsense | zero-shot loglikelihood, chosen vs rejected ending |
|
| 93 |
+
| **HellaSwag** | commonsense sentence completion | zero-shot loglikelihood, normalize by length if comparing across runs |
|
| 94 |
+
| **SciQ / WinoGrande / MMLU (subset)** | science / coreference / general | as scale allows |
|
| 95 |
+
|
| 96 |
+
**ARC-Easy is the load control.** On GoLLeM-v5 64M my independent re-benchmark
|
| 97 |
+
matched the board's ARC-Easy to **2 decimals (47.94)**, which is the control that
|
| 98 |
+
proves the checkpoint loads correctly and the log-likelihood scoring is sound.
|
| 99 |
+
When your ARC matches but your WikiText PPL doesn't, the gap is a *convention*
|
| 100 |
+
difference (see §1), not a load bug.
|
| 101 |
+
|
| 102 |
+
**Char-level models that cannot read benchmark text:** do not fake a score.
|
| 103 |
+
Report perplexity on held-out text instead (see §4) and say so on the card.
|
| 104 |
+
|
| 105 |
+
## 4. Held-out perplexity for char-level / narrow-corpus models
|
| 106 |
+
|
| 107 |
+
For a character-level LM (or any model whose tokenizer cannot read the standard
|
| 108 |
+
suites), the honest metric is perplexity on a **held-out split of the training
|
| 109 |
+
distribution**, not a forced standard-suite score.
|
| 110 |
+
|
| 111 |
+
Convention:
|
| 112 |
+
- Rebuild the exact training corpus and split (same vocab, same split ratios).
|
| 113 |
+
- Score the **full held-out test split** (not a 60-batch sample) with
|
| 114 |
+
next-token cross-entropy.
|
| 115 |
+
- Report `test_loss` (nats/token) and `test_perplexity = exp(test_loss)`.
|
| 116 |
+
|
| 117 |
+
**Worked case (verified):** char-gpt-1.2m (1.2M params, 65-char vocab,
|
| 118 |
+
TinyStories). Full held-out test split (49,674 tokens): `test_loss 1.4369`,
|
| 119 |
+
`test_perplexity 4.21`. The card's earlier `val 1.9046` was a single-epoch
|
| 120 |
+
60-batch sample that did not match the full-split measurement — the card was
|
| 121 |
+
corrected to the full-split number. **Lesson: report the full held-out split,
|
| 122 |
+
not a mid-run sample.**
|
| 123 |
+
|
| 124 |
+
## 5. What a card should state to be reproducible
|
| 125 |
+
|
| 126 |
+
A number without a method is not knowledge. A reproducible card states:
|
| 127 |
+
1. **Architecture** (layers, d_model, heads, kv heads, FFN, vocab, ctx).
|
| 128 |
+
2. **Param count** — the *unique* count, with tied-embedding dedup and buffer
|
| 129 |
+
exclusion stated.
|
| 130 |
+
3. **Data** — corpus name, token count, tokens/param.
|
| 131 |
+
4. **Each benchmark number** with: the exact prompt format, any clip length,
|
| 132 |
+
normalization (length-norm or not), and byte-vs-token for PPL.
|
| 133 |
+
5. **A SHA256** of the checkpoint so the artifact is verifiable.
|
| 134 |
+
6. **Honest limitations** — in-domain vs OOD, what the model is and is not good at.
|
| 135 |
+
|
| 136 |
+
---
|
| 137 |
+
|
| 138 |
+
*This is a methodology reference derived from my own verified benchmarks (see
|
| 139 |
+
`benchmark_specs_examples.jsonl` for the raw numbers) and the card-vs-artifact
|
| 140 |
+
audit in `Compactbot/slm-parameter-audit`. It is a snapshot of conventions as of
|
| 141 |
+
2026-09-25; the live verification store is the source of truth for individual
|
| 142 |
+
repos.*
|