On-Device LLM Deployment: Understanding Effective Parameters and Per-Layer Embeddings

    On-device LLM deployment shifts the focus away from headline parameter counts toward a three-way tradeoff among capability, speed, and memory. This article explains two frequently misunderstood concepts — Effective Parameters and Per-Layer Embeddings (PLE) — and why embedding tables dominate memory usage while barely affecting compute. It walks through the on-device memory model (weights, embeddings, KV cache, and runtime overhead), provides code for estimating embedding-table and KV-cache sizes, and presents a practical evaluation matrix covering effective vs. total parameters, hardware fit, quantization, tokenization quality, latency, and thermals. It closes with cloud-device collaboration guidance and a clear framework for selecting on-device models based on real-device data rather than raw parameter numbers.

    LLMs keep expanding the boundaries of their capabilities, but one unavoidable truth stands out: what really shapes user experience often isn’t “how large the parameter count is” but “whether the model can run on the target device and complete inference at an acceptable speed and power budget.” As models move from data-center accelerators to phones, wearables, smart-home hubs, and various edge computing boxes, the hardware’s compute, memory bandwidth, power, and thermals all come under strict constraints. That is why “how can on-device LLMs be made fast and efficient” has become one of the hottest topics in engineering practice.

    Rather than focusing on any specific product, this article abstracts out two of the most critical and most easily misunderstood concepts in on-device model design — Effective Parameters and Per-Layer Embeddings — and breaks them down systematically across four dimensions: principles, the memory model, engineering practice, and evaluation methods.

    1. The Core Tension in On-Device Deployment: A Three-Way Game of Capability, Speed, and Memory

    In the cloud, we’re used to measuring a model’s capability and cost by its parameter count, such as 7B, 13B, or 70B. On-device, however, this number can be seriously misleading, because on-device work cares about three independent resource dimensions:

    1. Memory footprint (static cost): model weights, embedding tables, and the KV cache all have to reside in memory, which directly determines whether the device “can even fit it.”
    2. Compute per inference (FLOPs): this determines the inference speed and latency per token and is the key to “can it run, and can it run fast.”
    3. Power and thermals: mobile devices are often constrained by battery capacity and fanless cooling, so sustained high load leads to throttling.

    The key insight is this: memory footprint is determined mainly by total parameter count, while inference compute is determined mainly by the parameters that are actually activated. These two are not the same, and a large share of on-device model optimization work is devoted precisely to “widening the gap between them.”

    2. What Are “Effective Parameters”?

    In the traditional view, every parameter in a model participates in multiply-accumulate operations during each forward pass. But for large models built on the Transformer, that isn’t the case — embedding-layer parameters do almost no computation; they only do “lookups.”

    Consider an intuitive example. Given a vocabulary size of V and a hidden dimension of H, the standard embedding table has this many parameters:

    1. embedding_params = V × H

    For a common larger vocabulary, with V = 250,000 and H = 2,048:

    1. embedding_params = 250000 × 2048 ≈ 512 million parameters

    A single embedding table already swallows more than 500 million parameters. And as the vocabulary grows larger and the model shrinks further, the proportion taken up by the embedding table becomes extreme — in the worst case, a single embedding table’s parameter count can even exceed the total of the entire Transformer body (attention layers plus feed-forward layers).

    This is where the concept of “effective parameters” comes from:

    Effective Parameters: the portion of parameters that actually participate in floating-point operations during a single inference and determine computational complexity — usually not including the large embedding tables that are only used for lookups.

    Total Parameters: the sum of all parameters, including the embedding tables, that must be fully loaded into memory.

    Here is a typical correspondence: one on-device model might advertise “~2.3B effective parameters, ~5B including embeddings,” while another advertises “~4.5B effective parameters, ~8B including embeddings.” This explains why “advertised parameters” and “memory-footprint parameters” can differ by nearly a factor of two — the difference is precisely the memory-hungry, compute-light embedding tables.

    What this means for developers in practice:

    • When judging inference speed, look at effective parameters, which are closer to the real FLOPs;
    • When judging memory/storage footprint, you must look at total parameters (including embeddings);
    • In resource-constrained scenarios like mobile and IoT, figuring out how to compress the memory cost of the embedding tables while preserving tokenization quality becomes the central engineering problem.

    3. The Principles Behind Per-Layer Embeddings

    Once you understand the “memory-heavy, compute-light” nature of embedding tables, a natural optimization idea emerges: since the embedding table is only used for lookups, can we make it “smarter” so as to improve parameter-reuse efficiency while keeping compute in check?

    Per-Layer Embeddings (PLE) is exactly such a technique. Its core idea is:

    Instead of maintaining only one global, shared, giant embedding table, equip each decoder layer of the Transformer with a small embedding table that the layer uses for its own lookups.

    3.1 Comparison With a Traditional Single Embedding Table

    In the traditional architecture, input tokens are mapped to vectors through one large embedding table and then passed layer by layer; the output layer is often “weight-tied” with the input embeddings to save parameters. In the per-layer embedding scheme:

    1. # Traditional: one shared big table
    2. token_ids → big_embedding_table[vocab, H] → embeddings → Layer1 → Layer2 → ... → LayerN
    3. # Per-layer embeddings: one small table per layer
    4. token_ids → small_table_1[vocab, h] → Layer1
    5. token_ids → small_table_2[vocab, h] → Layer2
    6. ...
    7. token_ids → small_table_N[vocab, h] → LayerN

    Here, the dimension h of each layer’s small table is usually far smaller than the body’s hidden dimension H, and it’s only when the multiple small tables are combined that they equal the capacity of one large table.

    3.2 Why It Improves Parameter Efficiency

    The clever part of per-layer embeddings lies in rebalancing “storage” and “compute”:

    • For storage: these small embedding tables scattered across the layers are large in number, so the total parameter count (memory footprint) rises noticeably;
    • For compute: a lookup is an O(1) gather operation that only accesses the rows corresponding to the tokens actually present in the current sequence, so it adds almost no floating-point burden;
    • For expressiveness: different layers can learn token representations at different granularities (shallow layers lean toward local/lexical features, while deep layers lean toward semantic/contextual features), improving model quality per unit of compute.

    Put differently, per-layer embeddings trade “larger but compute-cheaper storage” for “a smaller effective-parameter scale with richer representational capability.” This is precisely the technical underpinning of the design philosophy that “effective parameters are far smaller than total parameters.”

    3.3 Understanding the Lookup/Compute Decoupling With Pseudocode

    1. # Conceptual pseudocode to illustrate the essence of "light lookup, heavy compute"
    2. def forward(tokens, layers, per_layer_tables):
    3. hidden = None
    4. for layer_idx, layer in enumerate(layers):
    5. # Lookup: only gathers the token rows that appear, with almost no FLOPs
    6. emb = per_layer_tables[layer_idx][tokens] # dominated by memory access
    7. # Compute: attention + FFN, with FLOPs mainly determined by "effective parameters"
    8. hidden = layer.attention_and_ffn(emb, hidden)
    9. return hidden

    This pseudocode reveals a counterintuitive but critically important fact: no matter how large an embedding table is, as long as it is “accessed” through a lookup rather than “computed,” its drag on inference speed is far smaller than that of an attention or feed-forward layer with the same number of parameters. This is why on-device models can afford to carry embedding tables that “look heavy.”

    4. The On-Device Memory Model: Doing the Math

    To make things work on real hardware, you must estimate memory footprint precisely. An on-device model’s runtime memory consists mainly of:

    1. Total memory ≈ model weights + embedding tables + KV cache + runtime overhead

    Where:

    • Model weights: the parameters of the main Transformer body (corresponding to the main portion of the “effective parameters”);
    • Embedding tables: often an underestimated major item, and they expand further when per-layer embeddings are used;
    • KV cache: grows linearly with context length and can, in long-text scenarios, surpass the weights themselves;
    • Runtime overhead: the inference framework, operator buffers, and so on.

    A simplified formula for estimating the KV cache (autoregressive decoding, caching the Key/Value for every token):

    1. # L: number of layers d: per-head dimension H_kv: KV heads seq: sequence length bytes: bytes per param
    2. kv_cache_bytes = 2 * L * H_kv * d * seq * bytes
    3. # The factor 2 means one copy each for K and V

    From this, it’s clear that even if the effective parameters aren’t large, long context can still bring considerable memory pressure. So during on-device selection, “total parameters set the memory floor, and the KV cache sets the long-text ceiling” — both must be factored into the evaluation.

    5. On-Device Model Selection and Evaluation Methodology

    Faced with a wide range of on-device small models, how do you choose scientifically? Build an evaluation matrix across the following dimensions rather than looking at a single “parameter count” number:

    1. Effective parameters vs. total parameters: the former estimates speed, the latter estimates memory/storage — look at both.
    2. Match with target hardware: clarify the deployment target (phone SoC, edge computing box, IoT microcontroller), whose memory, compute, and dedicated inference-acceleration units differ enormously.
    3. Inference framework and quantization support: on-device deployment almost always depends on INT8/INT4 quantization to shrink size and boost throughput, so confirm the model’s compatibility with mainstream quantization formats.
    4. Tokenization quality: large-vocabulary schemes like per-layer embeddings can improve multilingual and code coverage, but verify the actual effect on your target corpus.
    5. First-token latency and sustained throughput: distinguish the performance of the two stages — prefill (processing the input) and decode (generating token by token) — since the end-to-end experience is jointly determined by both.
    6. Power and thermal behavior: run long, sustained inference stress tests on real devices and observe whether throttling occurs.

    6. Engineering Practice Recommendations and Cloud-Device Collaboration

    Even when the model ultimately runs on-device, the cloud still plays an irreplaceable role. A typical “cloud-device collaboration” rollout path looks like this:

    • The cloud handles training, evaluation, and distribution: use container platforms to orchestrate training and batch evaluation jobs, host model weights and versions in object storage, and continuously track each version’s quality and inference metrics through logging and monitoring alerts.
    • The device handles real-time inference: push quantized, trimmed models down to devices to guarantee privacy and low latency.
    • A continuous iteration loop: desensitized real-usage data flows back from devices to the cloud, forming an “evaluate → optimize → re-distribute” iteration loop.

    For teams building out this pipeline, general-purpose cloud platforms can support the full model lifecycle — from training, compression, and quantization to distribution and deployment. Baidu AI Cloud, for example, offers supporting tooling across these general capability categories (such as containerized training, object storage, and monitoring/alerting), which can help teams move an on-device model from the experimentation stage to a scaled rollout. It’s worth emphasizing, though, that on-device model performance depends heavily on the specific hardware and scenario, so always validate against real-device test data rather than paper specifications.

    7. Summary

    Back to the initial question — how do you evaluate an on-device large model? The answer isn’t “how large its parameters are,” but rather this set of judgments:

    • Effective parameters determine how fast it runs and are the first deciding factor in on-device experience;
    • Total parameters (including embeddings) determine how much memory it occupies and are the key to whether it fits on the device;
    • Parameter-efficiency techniques like Per-Layer Embeddings (PLE), by “trading storage for compute,” give the model stronger representational capability under a limited compute budget;
    • Quantization, KV cache management, and real-device evaluation are the engineering safeguards that make it truly deployable.

    Once you grasp the two core insights — “effective parameters ≠ total parameters” and “lookup ≠ compute” — you can step out of the fog of parameter numbers when choosing models for phones, IoT, or edge devices, and make more rational engineering decisions that fit real-world scenarios.