The Vocabulary Table Eats 60% of Parameters in Small Language Models

    In small language models built for phones and laptops, the embedding (vocabulary) table can hold the majority of the parameters while doing little of the actual computation. This article breaks down where the parameters go in a ~268M-parameter model, explains why mainstream quantization methods tend to skip the embedding layer, and works through the size, bandwidth, power, and startup-cost tradeoffs of "freezing" the vocabulary versus compressing it. It also surveys practical alternatives—vocabulary pruning, dimensionality reduction, embedding clustering, low-bit quantization, and storage-format choices—along with a deployment and validation workflow for edge scenarios.

    Have you ever done the math on this: when a small language model runs on your phone, how many of its parameters are actually “thinking,” and how many are just “memorizing words”?

    Take a general-purpose small model with roughly 268 million parameters, designed for phones and laptops. Break down its internal structure, and the result may surprise you: the feed-forward layers—the part that does feature transformation and the actual “heavy lifting”—hold only about 71 million parameters, while the vocabulary embedding table—the part that “looks things up in a dictionary”—holds a full 168 million parameters, about 63% of the total.

    1. As Small Models Shrink, the Vocabulary Becomes Dead Weight That’s Hard to Shed

    Small models are “good enough,” and edge deployment is the main battlefield

    Over the past few years, one clear trend has run through the small-model space:

    • Ultra-low-bit quantization is becoming practical: the industry has shown that ternary networks—where weights are compressed into just three values, -1, 0, and +1—can retain most of their quality as long as they’re trained properly;
    • Sub-billion-parameter models are genuinely usable: models at the hundreds-of-millions to billion-parameter scale, released by several organizations, can already hold their own on everyday tasks like question answering, summarization, rewriting, classification, and information extraction;
    • From the cloud to the edge: small models are being deployed on phones, PCs, in-car systems, and smart devices. In these scenarios, file size, memory footprint, load time, and even power consumption translate directly into user experience and hardware cost.

    As requirements change, so do engineering constraints. Large models worry about “do we have enough VRAM, is throughput high enough”; edge small models worry about “will it fit, is it fast to read, does it drain the battery.” This means the goal of compression shifts from “reduce compute” to “reduce memory traffic and reduce size.” Intuitively, the more thoroughly you compress, the greater the payoff—yet the vocabulary, this piece of “fat,” has never really been cut.

    What is an embedding table, and why does it matter so much for small models

    Almost every language model contains an embedding table: it assigns each entry in the vocabulary (more precisely, each subword token) a learnable vector, so that words with similar meanings sit close to each other in vector space. Word vectors serve two purposes:

    • Input side: retrieve the corresponding row by the token’s ID, as the input representation for that position;
    • Output side: most models have the final output projection share parameters with the embedding table. The model first computes a score vector (logits) as long as the vocabulary, then runs it through softmax to get a probability distribution over the next word.

    Let the vocabulary size be V and the hidden dimension be d. The embedding table’s parameter count is:

    1. N_embed = V × d
    2. If input and output share parameters, the table is counted once.
    3. If they are separate, it must be counted twice, and its share doubles.

    This multiplicative effect is exactly where small models feel the pain.

    Note: Many small models use a “reduce dimension first, then look up” design: they first project the hidden vector down to a low dimension with a very small matrix, then look up in a reduced vocabulary. In this article, “embedding table” refers to the corresponding reduced vocabulary (i.e., the low-dimensional lookup table) and the output projection table.

    A rounding error in large models, half the story in small models

    The parameter share depends on the relative size of the model’s main body and the vocabulary. Large models usually have dozens of layers and hidden dimensions in the thousands; their embedding tables often account for less than 5%—a rounding error. Small models are the opposite:

    • To keep compute low, the hidden dimension is cut to a few hundred and there are only a dozen or so layers, so the main-body parameters are compressed heavily;
    • To cover multiple languages, code, and a rich symbol system, the tokenizer often keeps the huge vocabulary of a large model, with token counts reaching into the hundreds of thousands.

    This scissors gap makes the vocabulary the most “puffed up” part of a small model:

    Token count Hidden dimension Embedding parameters ~16-bit storage Typical case
    32K 768 ~25M ~49 MB Small model with a trimmed vocabulary
    128K 1024 ~131M ~262 MB Medium-scale small model
    256K 640 ~168M ~335 MB The opening case of this article

    Table 1: Embedding table size grows linearly with vocabulary size (illustrative figures; actual values depend on each model’s configuration)

    The token counts and hidden dimensions in rows two and three are exactly the intuitive result of converting common values (such as 1024 and 262144) to powers of two.

    A larger vocabulary doesn’t just mean covering more languages—deeper representations can also become more refined. The difficulty is that vocabulary size is decided at the tokenizer-design stage and is essentially “locked in” once training is complete: you can subtract from it, but you can’t easily add to it.

    2. Why Quantization “Skips” the Vocabulary

    Three routes, one blind spot

    Many people assume that if weights can be pushed down to around 1 bit, the vocabulary should be even easier to compress. In practice, all three mainstream compression routes habitually leave the vocabulary outside:

    • Ultra-low-bit quantization: while the whole model is pushed close to 1 bit, the embedding layer usually stays at 16-bit;
    • Mainstream post-training quantization methods (such as gradient-based error compensation and activation-aware approaches): quantization targets linear layers by default, and the embedding layer is excluded from the search space;
    • Common local inference engines: the output layer is compressed to at most 6–8 bits, and the input embedding usually doesn’t participate in quantization at all.

    Why it’s skipped: not because it can’t be compressed, but because it’s “hard to compress and risky to get wrong”

    Difficulty How it shows up
    Highly non-uniform weights Embedding rows are affected by token frequency: high-frequency words get updated repeatedly and have larger values, while long-tail words are nearly “frozen” with smaller values; when the whole table shares one quantization range, precision loss is obvious
    Input side is sensitive to precision If one token’s representation is distorted, it propagates and amplifies layer by layer through all subsequent layers
    Output side directly affects sampling Quantization error in the logits changes the relative ordering within the vocabulary, causing the sampling distribution to drift and generation quality to drop
    Not worthwhile in engineering terms The input embedding is a “row lookup” rather than a “whole-matrix multiply-add,” so only a limited number of rows are accessed; compressing it saves little bandwidth while adding decoding overhead and quantization error for nothing

    The result: the model’s “body” is compressed to nearly 1 bit, yet the vocabulary still wears a 16-bit “coat.” By industry estimates, a ternary-weight model at the ~270M-parameter scale has a “body” plus attention of about 20 MB, while the 16-bit vocabulary is about 335 MB. The two differ by roughly 16x, making the vocabulary the uncontested largest item in the model file.

    More interesting is the measurement basis. When some vendors publish technical reports for ultra-low-bit models, the memory-usage line reads “excluding the embedding layer.” Technically, the embedding layer isn’t part of the main computation and is hard to quantize, so calling it out separately isn’t entirely unreasonable. But when the embedding layer really accounts for more than half the model’s parameters, removing it from the count makes claims like “94% memory savings” worth a second look: whose memory, exactly, was saved?

    An easily overlooked detail: the embedding table isn’t a monolith

    The embedding table plays both input and output roles, and these two roles have completely different sensitivity to precision:

    • Input side: each token retrieves only one row vector, and after the embedding error enters the hidden state, it gets further processed by subsequent layers;
    • Output side: every generation requires a matrix multiplication of “hidden dimension × vocabulary size,” and the embedding error becomes logit error directly, deciding which word gets picked.

    If input and output share the same table, “the input can be compressed aggressively” and “the output must hold steady” pull against each other. In addition, with structures like GQA (grouped-query attention) and MLA (multi-head latent attention) that keep the KV cache small, the decoding bottleneck falls almost entirely on vocabulary output; whereas with ordinary multi-head attention and a long context, reading the KV cache also consumes significant bandwidth.

    From this we can see that vocabulary compression isn’t as simple as “turning a bit-count dial”—it means reallocating a budget among precision, speed, and size.

    3. “Freezing” Is a Smart Compromise—But You Have to Do the Math First

    “Freezing the vocabulary” is essentially an explicit precision-budget allocation: since the vocabulary is the hardest to compress and the most costly to get wrong, accept its current state and concentrate the limited compression budget on safer, higher-payoff places. The decision criterion behind this is:

    How much size and speed benefit can a unit of precision loss buy?

    From this angle, “freezing” is a completely reasonable engineering decision. But it holds only when the frozen part is a small share of the whole. When the vocabulary accounts for 60% of the parameters, “freezing” also means giving up most of the optimization space. So before rushing to freeze, it’s worth doing three sums.

    1. The size account: how much space to fit into a device

    Using the opening case again:

    • Ternary body ~20 MB, 16-bit vocabulary ~335 MB, model file ~355 MB total;
    • The vocabulary alone accounts for ~94%.

    If the vocabulary is quantized to 4 bits, it drops to ~84 MB and the model file shrinks to ~100 MB. Combining this with vocabulary pruning or dimensionality reduction can make it even more compact.

    For mobile products with app-store size limits, or those that need to ship the model preinstalled with the app, this few-hundred-megabyte gap can be the difference between “can be bundled in” and “must be downloaded on first launch.”

    2. The bandwidth account: the vocabulary gets “read” once per generated token

    This is the most easily overlooked yet most critical sum. During autoregressive decoding, every new token requires the model to do one matrix multiplication between the current hidden state and the entire output vocabulary, then feed the result into softmax. On memory-bandwidth-bound edge devices, this process’s time is governed mainly by “how much weight has to be moved from memory,” not by compute. A simplified estimate:

    1. Minimum data moved per token ≈ 2048 × 262144 × 2 bytes ≈ 1.0 GB
    2. Memory bandwidth 10 GB/s → theoretical ceiling ~10 tokens/s
    3. Switch to 4-bit → theoretical ceiling ~40 tokens/s

    Note: the above is an order-of-magnitude estimate, assuming the output vocabulary isn’t cached resident and that bandwidth is a sustained decoding bottleneck. Structures like GQA and MLA have small KV caches, so the estimate’s error is also small; with ordinary multi-head attention and long contexts, you also need to add the cost of reading the KV cache.

    These numbers show that the vocabulary isn’t dead weight you can “load and forget”—it’s a “toll” you pay again every time you generate a word. For edge applications that aim for smooth interaction, this cost deserves more attention than the size itself.

    3. The power and latency account: the tail often decides the experience

    Edge devices are limited by heat dissipation and battery; the power draw from sustained high-bandwidth access directly shortens battery life. Time to first token (TTFT) and time per output token (TPOT) also depend heavily on vocabulary access efficiency.

    This also explains why some vendors exclude the embedding layer separately in reports: statistically, using a smaller attention structure and shorter contexts concentrates the bandwidth bottleneck on more compute-intensive parts, producing better-looking throughput numbers. But if the deployment scenario is long context or very long output, the vocabulary remains a major item that must be faced.

    4. A bonus of freezing: don’t ignore “startup cost”

    Beyond the three sums above, “freezing” has another easily overlooked benefit: it eliminates dequantization overhead.

    Low-bit weights are compact to store but must be “decompressed” into floating-point numbers before computation. In many inference engines this happens at model-load time; if you use on-demand loading or block-wise streaming, dequantization is further spread across the inference process, adding latency. Keeping the vocabulary at 16-bit means you can look it up and use it directly, which is especially suited to:

    • Interactive applications that need frequent cold starts;
    • Edge devices sensitive to load time;
    • Lightweight scenarios where a complex inference framework isn’t convenient to use.

    Summary: when the vocabulary’s share is low (say around 10%), freezing is usually a wise move. The higher the share, the more deliberate you should be about evaluating alternatives.

    4. If You Don’t Want to “Freeze,” What Other Paths Optimize the Vocabulary

    The good news is that the vocabulary-compression toolbox is far richer than you might think. Below, they’re arranged from “lowest risk to highest” and “smallest payoff to largest”; in practice, they’re usually combined.

    1. Vocabulary pruning: first ask, “do you really need this many words?”

    A huge vocabulary usually contains a large number of rarely-occurring tokens—obscure languages, rare symbols, fine-grained byte fragments. Measure their frequency in real corpora, remove the low-frequency tokens from the vocabulary, and replace them with high-frequency tokens.

    • Payoff: linear reduction in vocabulary size. Trimming from 256K to 80K drops the vocabulary’s size to about one-third of the original;
    • Caution: pruned tokens need a reasonable fallback path. A common approach is character-level fallback, which guarantees text information isn’t lost at the cost of only “longer sequences.” In multilingual settings, an entire language’s tokens may all be low-frequency, so you must evaluate the impact by language distribution before pruning.

    2. Dimensionality reduction and low-rank: turn “wide and thin” into “narrow and thick”

    The embedding table is large because the two-dimensional grid of “token count × dimension” is wide. The basic idea of dimensionality reduction is to squeeze the grid narrower, then restore the dimension with a small projection matrix:

    1. Original: one-hot × E E has shape V × d
    2. Decomposed: one-hot × E_low × P E_low is V × r, P is r × d
    3. Parameters: V × r + r × d (when r is much smaller than d, r × d is negligible)
    • Payoff: with r = d/4, the vocabulary parameters drop to about 1/4, and both size and per-token bandwidth fall in step;
    • Cost: it requires additional fine-tuning so the model adapts to the compressed representation;
    • Fit: suitable for structural optimization during pre-training or continued training, rather than a patch “slapped on” after training is complete.

    3. Embedding clustering and codebooks: let multiple tokens “share” a vector

    Leveraging the property that “semantically similar words have similar vectors,” cluster all tokens’ vectors into K clusters, store only the cluster ID for each token, and share the cluster-center vectors. In the extreme case, a token is represented by just one index.

    • Payoff: parameters drop from V×d to K×d (K is usually only hundreds to thousands), a compression ratio that can reach one to two orders of magnitude;
    • Cost: the precision loss from sharing is the most noticeable, usually requiring fine-tuning to recover the compressed-away expressive power;
    • Fit: scenarios extremely sensitive to size but without extreme semantic-distinction requirements, such as classification or retrieval in a specific domain.

    4. Low-bit quantization: the most direct, but it needs careful “target selection”

    Compressing the vocabulary from 16-bit to 4-bit or 2-bit is one of the highest return-on-investment methods. The key isn’t “can it be compressed,” but “where to compress and how.” An input/output differentiated strategy is recommended:

    Component Recommended precision Reason
    Input embedding 2–4 bits Each token retrieves only one row, and errors can still be “repaired” by later layers
    Output projection 4–8 bits Directly affects each token’s probability distribution, needs more caution
    If input and output are shared Take the more conservative value Or just decouple them: compress the input harder, keep the output at higher precision

    5. Format choice: low bit-width ≠ low bandwidth

    A common misconception is that compressing weights to 2 bits will definitely drop memory bandwidth to one-quarter. In reality it depends on the storage format:

    • Per-scalar bit-width storage: each weight occupies 2 bits independently. Reading it requires bit-level splitting and reassembly first, which is unfriendly to memory access patterns;
    • Packed storage: pack multiple low-bit weights into one byte or word, then extract and unpack them in bulk, which is friendlier to memory bandwidth and cache;
    • Lookup-table (LUT) indirect indexing: each weight stores only a few-bit codebook index. The index itself is compact, but it must access the codebook, and the codebook usually doesn’t fit in cache, potentially introducing new random access.

    At the same 2 bits, packed storage is usually faster than per-scalar bit-width, while lookup tables need to be tested case by case. A quantization scheme can’t be judged on “average bit count” alone—it also has to match the inference engine’s memory access pattern.

    5. Sample Code: Quantizing the Vocabulary and Looking It Up

    The following sample code helps illustrate the basic flow of “quantize—look up.” It’s not a directly runnable engineering implementation; the focus is on showing how group-wise quantization keeps precision loss within an acceptable range.

    1. # Illustrative pseudocode: for explanation only, not tied to any specific product API
    2. import torch
    3. GROUP_SIZE = 64 # every 64 weights share one group of quantization parameters
    4. def quantize_groupwise(W: torch.Tensor, bits: int):
    5. """
    6. Quantize the 2-D embedding table W (V × d) into unsigned integers, by row and by group.
    7. Returns: the quantized integer tensor, the scale per group, the min per group.
    8. """
    9. V, d = W.shape
    10. assert d % GROUP_SIZE == 0
    11. # Rearrange into (V, d/64, 64); the last dimension is the group
    12. Wg = W.view(V, d // GROUP_SIZE, GROUP_SIZE)
    13. w_min = Wg.amin(dim=-1, keepdim=True) # min per group
    14. w_max = Wg.amax(dim=-1, keepdim=True) # max per group
    15. levels = 2 ** bits - 1 # 4-bit is 15, 2-bit is 3
    16. # Avoid division by zero in the scale
    17. scale = (w_max - w_min).clamp_min(1e-8) / levels
    18. # Linearly map to [0, levels] and round
    19. q = ((Wg - w_min) / scale).round().clamp(0, levels).to(torch.uint8)
    20. return q, scale.squeeze(-1), w_min.squeeze(-1)
    21. def embedding_lookup(q: torch.Tensor, scale: torch.Tensor,
    22. w_min: torch.Tensor, token_id: int) -> torch.Tensor:
    23. """
    24. Given a token_id, retrieve the quantized values of the corresponding row and restore them to a float vector.
    25. """
    26. row_q = q[token_id] # uint8 of length d
    27. row = row_q.float() * scale[token_id].repeat_interleave(GROUP_SIZE)
    28. row = row + w_min[token_id].repeat_interleave(GROUP_SIZE)
    29. return row
    30. def output_logits(h: torch.Tensor, q: torch.Tensor,
    31. scale: torch.Tensor, w_min: torch.Tensor) -> torch.Tensor:
    32. """
    33. Compute output logits: restore the whole quantized vocabulary and multiply by the hidden state.
    34. Illustrative logic: real implementations usually process group-wise / block-wise streaming,
    35. avoiding restoring the entire table at once.
    36. """
    37. E = (q.float() * scale.repeat_interleave(GROUP_SIZE, dim=1)
    38. + w_min.repeat_interleave(GROUP_SIZE, dim=1))
    39. return h @ E.t()

    Why does group-wise quantization matter so much? If the whole table uses a single scale, then under the influence of high-frequency tokens, most long-tail tokens’ quantization intervals get “squashed flat” and lose effective bits significantly. Group-wise quantization lets each group scale independently, limiting the precision loss to within the group.

    Also note repeat_interleave: it “expands” each group’s scale onto every weight in the group. This detail shows that group-wise quantization saves storage space, but the expansion step that must happen at compute time can’t be skipped—which also explains why a quantization scheme must be designed in coordination with how the inference engine executes.

    6. Deployment Workflow: From “Doing the Math” to “Verifying Well”

    1. Inspect first, then decide

    Before applying any compression, use tools to confirm three things:

    • The embedding table’s actual share in the model file;
    • Whether input and output share parameters;
    • The target hardware’s memory bandwidth and available memory.

    Many teams chase “extreme compression” right away but overlook a simple fact: if the vocabulary is only 10%, the size you save by compressing it may be less worthwhile than compressing a few more feed-forward layers by 1 more bit.

    2. Decision checklist

    You can self-test as needed:

    • Vocabulary share < 15%: prefer freezing, and put effort into main-body quantization;
    • Share 15%–40%: apply group-wise low-bit quantization to the input embedding, and be conservative with the output layer;
    • Share > 40%: consider a combination of vocabulary pruning + dimensionality reduction/clustering, and accept some structural-adjustment cost;
    • In all cases, prefer a scheme whose packed storage matches the inference engine’s execution, and verify the real bandwidth payoff through measurement.

    3. Verification must cover “real tasks,” not just perplexity

    After compression, you must re-evaluate, and you can’t look only at perplexity. It’s recommended to cover at least:

    • General text generation quality: manual spot checks or automatic metrics;
    • Domain tasks: code completion, structured output, information extraction;
    • Multilingual ability: if the model targets multiple languages, be sure to test separately;
    • Boundary inputs: overly long tokens, rare characters, special symbols;
    • Edge metrics: load time, time to first token, time per output token, peak memory, power consumption.

    7. The Cloud’s Role: A “Test Field” for Training, Compression, and Evaluation

    The final battlefield for edge inference is phones and edge devices, but the ceiling on compression effectiveness is set as early as the cloud training and evaluation stage. Whether it’s dimensionality reduction during continued training, or quantization calibration and precision-recovery fine-tuning after training, all of it needs compute, data, and an evaluation system behind it.

    In this kind of work, the cloud typically calls on the following capabilities (as general references only):

    • Elastic compute: to run continued training, quantization calibration, fine-tuning, and other tasks;
    • Object storage: to hold massive training corpora, multiple model-file versions, and before/after comparison samples for quantization;
    • Task orchestration and container platforms: to turn “compress—evaluate—roll back” into a repeatable, traceable pipeline;
    • Log services and monitoring/alerting: to record how different compression schemes perform on latency, memory, and power, providing data support for selection.

    Cloud capabilities offered by platforms like Baidu AI Cloud can help teams run this chain more smoothly. That said, it’s worth stressing that cloud-based evaluation can only give an “expected” result; real on-device performance must be judged by actual device testing.

    8. Conclusion: Re-examining That “Default-Accepted” Assumption

    Back to the opening question: in a small model, how much is “thinking,” and how much is “memorizing words”? The answer isn’t unique, but it reminds us of one thing:

    Accepting by default that “embedding layers are hard to compress and not worth compressing” is itself an assumption worth questioning.

    “Freezing” isn’t the endpoint, but an explicit decision made after weighing tradeoffs. It can be a wise starting point, but only on the condition that:

    • You clearly know how much of the model the vocabulary takes up;
    • You’ve done the math on bandwidth, size, and power;
    • You have the ability to produce alternatives when its share is too high.

    Vocabulary pruning, dimensionality-reduction decomposition, clustering with sharing, and group-wise low-bit quantization—these tools aren’t new. What’s really missing is an engineering perspective that re-examines their value in the new context of small models and edge deployment.

    Next time, we can talk specifically about: how to verify, with real-device data, the actual payoff of a given vocabulary-compression scheme on specific hardware.