Skip to content

Scaling Embedding Layers in Language Models

optionalextendedfrontierpaperrubric 8/122025 · NeurIPS 2025 · ~25 min

Da Yu, Edith Cohen, Badih Ghazi, …, Chiyuan Zhang

Status

TL;DR. Bigger vocabularies help language models, until updates become too sparse and the output softmax too expensive. SCONE (Scalable, Contextualized, Offloaded, N-gram Embedding) adds a second, input-only embedding table for frequent n-grams, called f-grams. During training, a separate transformer computes these embeddings. After training, they are precomputed and stored in RAM or on SSD. Inference costs only a lookup, so you can scale a model’s input representation without touching accelerator FLOPs or memory.

  1. Find f-grams. Count frequent 2- to K-grams with K − 1 linear scans of the corpus (BPE-style), keeping the top entries by frequency.
  2. Embed with context. For token σi\sigma_i, find the longest f-gram (σj,…,σi)(\sigma_j,\dots,\sigma_i) that ends at it. If one exists, the token’s input embedding is Af-gram\mathcal{A}_{\text{f-gram}} applied to that n-gram’s token embeddings, taking the last position’s output. If none exists, use the normal token embedding T(σi)\mathcal{T}(\sigma_i).
  3. Offload. After training, compute F(g)=Af-gram(g)\mathcal{F}(g) = \mathcal{A}_{\text{f-gram}}(g) for every f-gram gg and store it in a hash table in RAM, or in LMDB on NVMe. The output layer and vocabulary are unchanged, so decoding cost is unchanged.

This gives two new scaling axes at fixed inference cost: more f-grams (more storage) and a larger Af-gram\mathcal{A}_{\text{f-gram}} (more training compute only).

Results. The OLMo baselines are trained on 1T tokens. SCONE models are trained on 500B tokens to match total training FLOPs, with a 1.8B Af-gram\mathcal{A}_{\text{f-gram}}. On zero-shot tasks (Table 1), OLMo-1B averages 53.7 and OLMo-1.9B 56.8. OLMo-1.3B with 10M f-grams matches 1.9B at 56.8 while using about 32% less inference FLOPs and accelerator memory. OLMo-1B with 1B f-grams reaches 57.0, slightly above 1.9B, with about 48% less. OLMo-1B with 10M f-grams (54.9) also beats the over-tokenized OE-12.8M variant (54.4). Storage at d=2048d=2048 in 16-bit is 41.4 GB (10M) and 413.6 GB (100M) in RAM, and 7,665 GB for 1B on SSD, with negligible latency from RAM and a minor slowdown from NVMe. Limitations (Appendix A): training is tested only up to 3B parameters, and exact n-gram keys do not extend to longer or paraphrased queries.

  • Tokenisation: f-gram discovery is BPE-like counting. See BPE.
  • Deployed in Qwen3.8-Flash-Next as off-accelerator n-gram embeddings.
  • Sparse capacity, a different route: MoE layers such as DeepSeekMoE add parameters that are only partly active. SCONE adds parameters that cost only a lookup.
  • IR angle: precomputing contextual representations offline and looking them up at serving time is the same trade made by late-interaction indexes such as ColBERTv2 and PLAID.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Derive / compute

    An f-gram table stores one d = 2048 embedding per entry in 16-bit floats. Estimate the raw size for 10M, 100M and 1B f-grams, compare with the reported 41.4 GB and 413.6 GB in RAM, and say where the 1B table must live on a 512 GB-RAM workstation. Using about 2 USD per GB for RAM and about 0.1 USD per GB for SSD, what does each option cost?

    What a strong answer covers
    • Raw size is entries × 2048 × 2 bytes: 10M gives 40.96 GB, 100M gives about 410 GB, and 1B gives about 4.1 TB. The reported RAM numbers add a hash dictionary from f-gram to row.
    • 1B f-grams do not fit in 512 GB of RAM, so they go on NVMe through LMDB, using about 7,665 GB including the B+ tree overhead.
    • Cost: 10M in RAM costs about 41 × 2, roughly 83 USD. 1B on SSD costs about 7,665 × 0.1, roughly 770 USD. Both are cheap compared with the accelerator memory a 1.9B model would need.
    • Each lookup is per token and independent of model FLOPs. The paper measures it as a minor cost on NVMe and negligible in RAM.
  2. Mechanism

    Explain why simply growing the token vocabulary to millions of entries fails, and how SCONE avoids those problems. Cover sparse updates, the output softmax, and what happens to the f-gram transformer at inference time.

    What a strong answer covers
    • With a larger vocabulary each embedding receives fewer updates. In the GPT-2 study, with 100M training tokens, 97.6% of tokens get more than 100 updates at a 32K vocabulary, but only 7.3% do at 2M. Quality drops beyond about 512K.
    • A larger vocabulary also enlarges the output softmax, which raises decoding cost. SCONE keeps the output vocabulary unchanged.
    • SCONE adds input-side embeddings for frequent n-grams (f-grams). For each token, it finds the longest f-gram ending at that token. A separate f-gram transformer embeds it during training, which shares parameters across f-grams and avoids the sparse-update problem.
    • After training, the f-gram transformer is run once over all f-grams and its outputs are cached in a key-value store off the accelerator. At inference it costs only a lookup, so accelerator FLOPs and memory are unchanged.
    • Two scaling axes result: the number of f-grams, and the size of the f-gram transformer, which is used only during training.
  3. Research idea

    SCONE is a cache of contextual embeddings keyed by exact n-grams, and the authors say longer or semantic keys are the main open problem. Propose a study that applies the same idea to a retrieval or reranking model, and say what the hard part would be.

    What a strong answer covers
    • Analogy: SCONE trades training compute and cheap storage for inference FLOPs, like precomputing document representations offline, as in ColBERT-style indexes.
    • Proposal: add an f-gram table, keyed by frequent query and document n-grams, to a small reranker or embedder. Learn it with a larger model during training, then serve the small model with lookups only.
    • Hard part: keys. Exact n-gram keys miss paraphrases. Semantic keys need discretisation, such as quantised or clustered embeddings, plus an index, which reintroduces approximate-search error.
    • Evaluation: nDCG and latency at matched accelerator memory against a larger reranker. Also check how hit rates change across domains (BEIR), since f-grams are mined from the training corpus.

Done with this page?

Status