StillDeadcode's picture
Upload folder using huggingface_hub
ab5894b verified
|
Raw History Blame Contribute Delete
14.5 kB
---
license: other
license_name: mixed-open
license_link: LICENSE.md
language:
- multilingual
pretty_name: Qwen3.8-27B Quantization Challenge
size_categories:
- 10M<n<100M
tags:
- quantization
- calibration
- kl-divergence
- gptq
- hessian
- long-context
- agentic
configs:
- config_name: calib
data_files: corpus/calib.jsonl
- config_name: public
data_files: corpus/public.jsonl
---
# Qwen3.8-27B Quantization Challenge
Quantize [Qwen/Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B) and stay as close to it as
possible. Entries are scored by the KL divergence of their next-token distribution from the BF16
model's, teacher-forced over a **private 10M-token corpus**. That corpus is drawn the same way as
the two published here:
| | calib | public | private (not released) |
|---|---:|---:|---:|
| tokens | **10,259,331** | **10,287,924** | **10,324,055** |
| documents | 4,789 | 4,760 | 4,748 |
| 256K-token agentic traces | 8 | 8 | 8 |
- **calib** is for calibration: GPTQ, AWQ, imatrix, QAT, anything. It comes with the BF16 model's
**Hessian of every linear's input** over the whole corpus (257 files) and its golden distributions.
- **public** is for scoring yourself. Its golden distributions use exactly the format and
settings that score the private corpus.
- **private** has the same mix, sampled with a different seed stream and disjoint from both. Its
sha256 is in `corpus/manifest.json`, so the scoring corpus is fixed before any entry exists.
## How the references were made
- Model: Qwen3.8-27B in BF16, every weight as released.
- Engine: [radiance](https://codeberg.org/StillDeadcode/radiance) on 2x AMD Radeon AI PRO R9700
(tensor parallel 2).
- KV cache: BF16. Tensor-parallel wire: exact (BF16 partial sums, never an 8-bit wire).
- Teacher forcing: every document goes through prefill once, with the prefix cache and
speculation off. Each position's full 248,320-token distribution is computed in f32.
- The official FP8 checkpoint was scored with the same settings, run from its own weights
byte for byte.
## Corpus
Each line of `corpus/<split>.jsonl` is
`{"source", "category", "kind", "tokens", "prompt"}`. `prompt` is the exact text the model reads:
plain text, or a conversation already rendered with Qwen3.8's chat template (`kind: chat`).
`tokens` counts the Qwen3.8 tokenizer's tokens, with no BOS. Every token is scored from the first.
Tokens by category:
| category | calib | public | private |
|---|---:|---:|---:|
| long-agentic | 1,980,045 | 1,974,467 | 1,992,019 |
| agentic | 1,089,833 | 1,032,356 | 1,064,965 |
| code | 1,007,333 | 1,004,962 | 1,008,026 |
| web | 900,144 | 900,135 | 901,666 |
| reasoning | 714,092 | 710,288 | 712,599 |
| chat | 704,539 | 708,451 | 700,808 |
| multilingual | 656,900 | 650,380 | 669,740 |
| science | 604,894 | 621,240 | 617,742 |
| books | 559,476 | 554,954 | 560,684 |
| math | 502,916 | 502,530 | 504,829 |
| long | 421,934 | 510,956 | 475,772 |
| tools | 410,310 | 412,341 | 410,778 |
| encyclopedic | 301,326 | 301,085 | 300,719 |
| qa | 300,166 | 301,388 | 300,175 |
| legal | 105,423 | 102,391 | 103,533 |
Documents are capped at 8K-100K tokens depending on the source (the `long` category runs to 100K).
They are deduplicated by content hash across all three splits and dealt round-robin, so each
split has the same mix. Chat, reasoning, tool-calling and agentic sources keep their assistant
turns, including thinking blocks.
### The 256K-token agentic traces
Each split holds 8 agentic coding sessions of about 250K tokens, generated for this challenge by
Qwen3.8-27B itself (the official FP8 checkpoint, its default sampling settings). Each session
works on a real open-source repository pinned to a commit, inside an offline sandbox. It has
`bash`, `read_file`, `write_file` and `edit_file` tools and works through a queue of engineering
tasks: orientation, running and fixing the tests, code review, edge-case and property tests, a
small feature, a refactor, a benchmark, error handling, documentation, typing, git archaeology
and a final self-review. It runs until it reaches 245K tokens. The whole session is one document, rendered with the chat
template, tool definitions included: what the model read before its last turn, plus that turn.
Each split uses different repositories.
| split | repository | commit | tokens | turns |
|---|---|---|---:|---:|
| calib | [attrs](https://github.com/python-attrs/attrs) | `ee66e72748` | 246,898 | 157 |
| calib | [click](https://github.com/pallets/click) | `2247b35ea1` | 245,120 | 172 |
| calib | [cobra](https://github.com/spf13/cobra) | `adbc881390` | 245,199 | 125 |
| calib | [express](https://github.com/expressjs/express) | `1c6f1b0fe4` | 253,163 | 134 |
| calib | [lua](https://github.com/lua/lua) | `8cb93bada5` | 248,066 | 142 |
| calib | [requests](https://github.com/psf/requests) | `611c6162cb` | 245,667 | 166 |
| calib | [rich](https://github.com/Textualize/rich) | `9d8f9a372c` | 250,158 | 169 |
| calib | [ripgrep](https://github.com/BurntSushi/ripgrep) | `6892bc2b7e` | 245,774 | 126 |
| public | [cjson](https://github.com/DaveGamble/cJSON) | `6d9f2443ab` | 247,353 | 164 |
| public | [flask](https://github.com/pallets/flask) | `d086db856b` | 245,423 | 177 |
| public | [gin](https://github.com/gin-gonic/gin) | `0f09c3a9b4` | 246,768 | 114 |
| public | [httpx](https://github.com/encode/httpx) | `b5addb64f0` | 246,459 | 176 |
| public | [more-itertools](https://github.com/more-itertools/more-itertools) | `4aeb4338ae` | 248,470 | 188 |
| public | [redis](https://github.com/redis/redis) | `c039dd784c` | 248,830 | 185 |
| public | [serde-json](https://github.com/serde-rs/json) | `8c535a260c` | 245,866 | 149 |
| public | [tqdm](https://github.com/tqdm/tqdm) | `9cf5a12b1f` | 245,298 | 116 |
### Sources
| dataset | revision | licence |
|---|---|---|
| [HuggingFaceFW/fineweb-edu](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu) | `87f09149ef` | ODC-By 1.0 |
| [epfml/FineWeb2-HQ](https://huggingface.co/datasets/epfml/FineWeb2-HQ) | `c0c06e94fd` | ODC-By 1.0 |
| [wikimedia/wikipedia](https://huggingface.co/datasets/wikimedia/wikipedia) | `b04c8d1ceb` | CC BY-SA 3.0 / GFDL |
| [common-pile/wikimedia_filtered](https://huggingface.co/datasets/common-pile/wikimedia_filtered) | `0641bb84bd` | openly licensed, each record's licence in its metadata (Common Pile v0.1) |
| [common-pile/arxiv_papers_filtered](https://huggingface.co/datasets/common-pile/arxiv_papers_filtered) | `033cf7f53f` | openly licensed, each record's licence in its metadata (Common Pile v0.1) |
| [common-pile/peS2o_filtered](https://huggingface.co/datasets/common-pile/peS2o_filtered) | `297747513b` | openly licensed, each record's licence in its metadata (Common Pile v0.1) |
| [common-pile/pubmed_filtered](https://huggingface.co/datasets/common-pile/pubmed_filtered) | `c156f0569a` | openly licensed, each record's licence in its metadata (Common Pile v0.1) |
| [HuggingFaceTB/finemath](https://huggingface.co/datasets/HuggingFaceTB/finemath) | `e92b25a616` | ODC-By 1.0 |
| [common-pile/libretexts_filtered](https://huggingface.co/datasets/common-pile/libretexts_filtered) | `70388bca52` | openly licensed, each record's licence in its metadata (Common Pile v0.1) |
| [emozilla/pg19](https://huggingface.co/datasets/emozilla/pg19) | `c021754c8e` | public-domain books (PG-19) |
| [common-pile/project_gutenberg_filtered](https://huggingface.co/datasets/common-pile/project_gutenberg_filtered) | `3cdf6879c8` | openly licensed, each record's licence in its metadata (Common Pile v0.1) |
| [common-pile/doab_filtered](https://huggingface.co/datasets/common-pile/doab_filtered) | `defb24ca72` | openly licensed, each record's licence in its metadata (Common Pile v0.1) |
| [common-pile/caselaw_access_project_filtered](https://huggingface.co/datasets/common-pile/caselaw_access_project_filtered) | `50e1961a5e` | openly licensed, each record's licence in its metadata (Common Pile v0.1) |
| [common-pile/stackexchange_filtered](https://huggingface.co/datasets/common-pile/stackexchange_filtered) | `c0ac737383` | openly licensed, each record's licence in its metadata (Common Pile v0.1) |
| [common-pile/stackv2_edu_filtered](https://huggingface.co/datasets/common-pile/stackv2_edu_filtered) | `c354dbe884` | openly licensed, each record's licence in its metadata (Common Pile v0.1) |
| [bigcode/the-stack-smol-xl](https://huggingface.co/datasets/bigcode/the-stack-smol-xl) | `e782ebf35c` | permissively licensed source files (each file's own licence) |
| [allenai/WildChat-4.8M](https://huggingface.co/datasets/allenai/WildChat-4.8M) | `c827c6df8f` | ODC-By 1.0 |
| [HuggingFaceTB/smoltalk2](https://huggingface.co/datasets/HuggingFaceTB/smoltalk2) | `fc6cc2103c` | see the source's card |
| [open-thoughts/OpenThoughts3-1.2M](https://huggingface.co/datasets/open-thoughts/OpenThoughts3-1.2M) | `61bcf9d4eb` | Apache 2.0 |
| [NousResearch/hermes-function-calling-v1](https://huggingface.co/datasets/NousResearch/hermes-function-calling-v1) | `dae3e1d28c` | Apache 2.0 |
| [glaiveai/glaive-function-calling-v2](https://huggingface.co/datasets/glaiveai/glaive-function-calling-v2) | `e7f4b64560` | Apache 2.0 |
| [nvidia/When2Call](https://huggingface.co/datasets/nvidia/When2Call) | `0582f7749d` | CC BY 4.0 |
| [nebius/SWE-rebench-openhands-trajectories](https://huggingface.co/datasets/nebius/SWE-rebench-openhands-trajectories) | `35455389ab` | CC BY 4.0 |
| [nvidia/Nemotron-SWE-v1](https://huggingface.co/datasets/nvidia/Nemotron-SWE-v1) | `0fe17a965b` | CC BY 4.0 |
| [SWE-bench/SWE-smith-trajectories](https://huggingface.co/datasets/SWE-bench/SWE-smith-trajectories) | `08e109b4a5` | MIT |
| agent traces (this dataset) | generated | Apache 2.0 (the model's output); repository content keeps its own licence |
Filtering per source: language and quality filters where the source offers them, a prose check on
book and web text, and an article filter on Wikimedia. Each source's scanned, accepted and skipped
counts are in `corpus/manifest.json` under `datasets.sources`.
## Golden distributions: `golden/<split>/` (42.2 GB + -)
The BF16 model's next-token distribution at every scored position, stored sparse: the 512 most
likely tokens exactly, plus the mass of the rest.
| file | layout |
|---|---|
| `kld.json` | `format` (`radiance-kld-top-1`), `n_vocab`, `top` (512), `rows`, and `docs`: one `{source, tokens, score_from, row0}` per document |
| `tokens.i32` | every document's tokens, concatenated, int32 |
| `top.bin` | `[rows, 512]` of `{int32 id, float32 log p}`, most likely first |
| `rows.f32` | `[rows, 3]` float32: the reference's NLL of the true next token, its entropy (nats), and the tail mass `1 - sum(exp(top lp))` summed from the full row |
Document `d` has `tokens - 1 - score_from` rows, starting at `row0`. Row `row0 + j` is the
distribution after token `score_from + j`, predicting token `score_from + j + 1`.
### The score
Per position, the candidate's distribution `q` is coarsened onto the reference's 513 cells (its
512 tokens and one tail cell holding the rest of `q`'s mass), and
`KL(p || q) = sum_i p_i (log p_i - log q_i)` over the 513 cells.
This is a lower bound on the full-vocabulary KL. At 512 tokens the tail mass is small: its
median per position is below 1e-6. **Mean KL over all positions ranks the leaderboard.** The
leaderboard also shows the median, p99 and p99.9 KL, top-1 agreement (argmax match), the
perplexity ratio, and the mean KL over the 256K-token traces alone.
Every position is scored, user and tool turns of a conversation included. There the BF16 model is
often confidently wrong (it expects the turn to end), so the per-position KL has a heavy tail: a
candidate that moves a near-certain wrong guess pays for it.
llama.cpp running the Q8_0 GGUF reproduces these reference distributions (median KL 0.0004, top-1
agreement 98.4%), so the tail is the model's, not the engine's.
## Hessians: `hessians/<split>/` (50.4 GB + -)
`H = sum over tokens of x x^T` for the whole input `x` of every linear in the text model. That is
the matrix GPTQ / OBQ / LDLQ start from, accumulated over every token of the corpus. One
safetensors file per input. Linears that read the same input share one file: q/k/v (or the delta
net's in-projections) share the layer input, and gate/up share the post-attention input.
- `hessian_upper`: f32 `[k (k + 1) / 2]`, the upper triangle packed row by row (row `i`'s entries
`j = i .. k-1` after row `i-1`'s).
- metadata: `k`, `rows` (tokens summed), `linears` (the checkpoint tensors that read this input).
- H is the raw sum: divide by `rows` for the second moment. Under tensor parallelism the inputs
split by column (`o_proj`, `out_proj`, `down_proj`) were gathered to their full width first, so
every file holds the whole matrix, cross terms included.
```python
import numpy as np, safetensors.numpy as st
t = st.load_file("hessians/calib/model.language_model.layers.3.mlp.down_proj.input.safetensors")["hessian_upper"]
k = int((np.sqrt(8 * t.size + 1) - 1) / 2)
H = np.zeros((k, k), np.float32); H[np.triu_indices(k)] = t; H = H + np.triu(H, 1).T
```
## Scoring an entry yourself
- **GGUF** (llama.cpp): `tools/llama_kld.cpp` is a single-file scorer that builds against llama.cpp
(see its header). It reads `golden/public/` and writes the same report and score as the
leaderboard, with a BF16 KV cache and flash attention.
- **radiance**: `radiance --model ENTRY.rad --tp 2 --kv-cache-dtype bf16 --tp-wire exact
--max-model-len 262144 --kld-ref golden/public --kld-out report.json`.
- **Anything else**: compute your model's log-softmax at every row's position, coarsen onto the
row's 512 ids plus the tail, and average. `tools/score.py` is a reference implementation in numpy;
its `score_rows` takes a document a slice of positions at a time, since a 256K-token document's
full logits fit nowhere.
Every engine must reproduce the corpus tokens exactly: feed `tokens.i32`, never re-tokenize
`prompt`.
## Leaderboard (private corpus)
The initial entries are scored on a fixed subset of the private corpus: every 8th document and 2
of its 256K-token traces. The official FP8 is also
scored on the whole private corpus, which shows how closely the subset tracks it.
All entries were measured with a BF16 KV cache. Sizes and bits per weight count the text model
only (embeddings, 64 layers, lm_head), so formats that ship the vision tower or the MTP head are
not charged for them.
_(being scored)_