layers int64 | experts int64 | topk int64 | tokens int64 | zipf_s float64 | zipf_s_per_layer list | hit_rates list | che_mae float64 | che_zipf_mae float64 | distinct_per_batch list | reuse_prev_token list | working_set dict | mass_top25pct float64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
16 | 64 | 8 | 49,152 | 0.652729 | [
0.5168399731353996,
0.45216287722374227,
0.611280793656683,
0.5906835171510877,
0.7793981775030502,
0.6480099103325739,
0.8399621101649059,
0.7226159598776765,
0.6574479012815251,
0.6178199900164697,
0.5407503482861278,
0.7115751165458343,
0.6219601450559994,
0.7641232197074124,
0.786931... | [
{
"frac": 0.02,
"cap": 20,
"measured": 0,
"static": 0.06245549519856771,
"che_measured_pop": 0.026580850797751226,
"che_zipf": 0.03699199460718677
},
{
"frac": 0.05,
"cap": 51,
"measured": 0,
"static": 0.13478676478068033,
"che_measured_pop": 0.0673864982202855,
"... | 0.112842 | 0.100509 | [
{
"batch": 1,
"measured": 8,
"irm_measured_pop": 7.565598081578889,
"irm_zipf": 7.244434802265509
},
{
"batch": 2,
"measured": 14.635,
"irm_measured_pop": 14.21605904627252,
"irm_zipf": 13.146814196509677
},
{
"batch": 4,
"measured": 24.785,
"irm_measured_pop": 25... | [
0.2499567658847226,
0.2796840349128197,
0.3672738092816016,
0.3708393522003621,
0.44042084596447684,
0.4547211653882932,
0.46631045146589084,
0.4375648511729161,
0.3781764358812639,
0.3395353095562654,
0.31294632866065797,
0.36515025126650524,
0.3588685886350227,
0.38883491688877136,
0.3... | {
"1": 8,
"4": 21.099609375,
"16": 42.0537109375,
"64": 56.6220703125,
"256": 61.19140625,
"1024": 63.161458333333336
} | 0.449439 |
Quantization as Cache Amplification
Trillion-Parameter Mixture-of-Experts Inference on a Commodity Laptop
Kavin Kumar, Neural Metrics
π Read the paper β 11 pages
What this is
Weight quantization is usually justified as footprint reduction. This work argues that for offloaded mixture-of-experts inference that framing misses the leverage. The binding resource is not storage capacity but the fraction of expert slots resident in DRAM β and storage traffic depends on that fraction through a cache hit rate that is both concave and, for recency-based policies, discontinuous.
The central measured result: a least-recently-used expert cache hits exactly
zero whenever its capacity falls below the kΒ·L expert slots a single token
touches. A token routes to k experts in each of L layers and revisits none of
them until the next token β a cyclic reference string, the classical worst case
for LRU. On real OLMoE-1B-7B traces (k=8, L=16, so 128 slots) we measure 0.0%
hit rate at 2%, 5% and 10% capacity, jumping to 25.3% the moment capacity reaches
128. Quantization is what carries a system across that threshold.
Everything here was measured on one laptop: NVIDIA RTX A500 (4 GB VRAM), 32 GB DRAM, consumer NVMe, Windows 11.
Headline numbers
| Result | Value |
|---|---|
| LRU hit rate below per-token working set | 0.0% (measured, all capacities tested) |
| LRU hit rate at working set (128 slots) | 25.3% |
| Popularity-pinned hit rate at 10% capacity | 22.9% (vs 0.0% for LRU) |
| Codec @ 2.01 bits, WikiText-2 PPL | 12.17 (bf16 reference: 8.11) |
| Frequency-conditioned allocation @ 1.51 bits | 22.02 vs 25.54 uniform β 13.8% better at identical rate |
| NVMe random read @ expert-block granularity | 6.01 GB/s (β₯ sequential) |
| GPU device bandwidth | 88.2 GB/s |
Ablations (all at 1.51 bits, WikiText-2 PPL)
| Configuration | PPL |
|---|---|
| RVQ + RHT + LDLQ (full codec) | 25.54 |
| β without block-LDL error feedback | 7,701.98 |
| β without incoherence processing | 352.10 |
| RTN uniform @ 2.25 bits (scalar baseline) | 22,793.90 |
Both codec components are load-bearing, and error feedback matters more than rotation.
Contents
| Path | Contents |
|---|---|
paper/ |
Paper PDF + full LaTeX source and figures |
code/codec.py |
Sub-2-bit codec: randomized Hadamard transform, residual VQ, block-LDL error feedback |
code/quant_model.py |
Layer-sequential quantization + perplexity for OLMoE-1B-7B |
code/trace_routing.py |
Captures per-token expert routing traces |
code/cache_policy.py |
LRU / popularity-pinned / hybrid cache simulation |
code/bench_io.py |
Page-cache-bypassing NVMe, PCIe and DRAM benchmarks |
code/project_1t.py |
1T reference configuration and throughput roofline |
results/routing_trace.npy |
Raw routing traces: int16[16, 49152, 8] β the top-8 expert indices selected at every layer for 49,152 held-out tokens |
results/*.json |
Every measurement artefact behind the paper's numbers |
Using the routing traces
import numpy as np
T = np.load("results/routing_trace.npy") # [layers=16, tokens=49152, topk=8]
# distinct expert slots touched by one token:
print(T.shape[0] * T.shape[2]) # 128 -> the LRU threshold
Every number in the paper is generated programmatically from results/ via
code/gen_numbers.py and code/gen_tables.py; nothing is transcribed by hand.
Scope β please read
No trillion-parameter model was executed. No 1T checkpoint was downloaded,
quantized, or run. The 1T figures (196 GB at 1.5 bits, 1.81β3.08 tokens/s) are an
analytical projection composing measured host parameters with a cache model
validated against real 7B-scale routing traces. They are not benchmark results
and should not be cited as such. The paper's Limitations section states this, and
identifies the weakest assumption: that the Zipf exponent of expert popularity
(measured s = 0.65 at 64 experts/layer) is scale-invariant up to 320
experts/layer. A full sensitivity curve across the entire hit-rate range is
included precisely because that assumption cannot be foreclosed.
The paper also reports a negative result that constrains any system in this class: sustaining the storage stream while materializing fp16 weights would require ~116 GB/s of device bandwidth against 88.2 GB/s measured, so dequantization must be fused into the GEMM rather than staged through VRAM. No fused kernel was implemented here.
Quality cost is stated plainly rather than buried: sub-2-bit operation on a 1.3B-active-parameter MoE is expensive (8.11 β 22.02 PPL at 1.51 bits), which is why the systems analysis is parameterized by rate rather than asserting a single favourable operating point.
Model used
allenai/OLMoE-1B-7B-0924 β
6.9B total / 1.3B active, 16 layers, 64 experts/layer, top-8. Evaluation on
WikiText-2.
- Downloads last month
- 38