Lightweight MoE Model Architecture and Long-Context Agent Deployment
This article explains how total and active parameters in lightweight Mixture-of-Experts (MoE) models translate into memory and compute costs. It covers how attention design drives long-context cost through the KV cache, and how to plan the deployment of long-context AI agents. It also notes which figures need verification against official sources before you make model selection or capacity decisions.
Introduction
Recently, the industry has open-sourced several lightweight MoE multimodal models. Some of them have shown strong coding and agent capabilities in tests. These models share one design idea: the total parameter count is large, but each token activates only a small subset of parameters, which keeps inference cost under control. This article does not repeat any model’s marketing claims. Instead, it focuses on three questions: how total and active parameters translate into resource costs, how the attention mechanism affects long-context cost, and how long-context agents are deployed in practice.
The draft cites several figures: 320B total parameters, 18B active parameters, 45 layers, a 30T-token pretraining corpus, and a 1M-token context window. We could not find an official technical report that supports these numbers. Where this article cites them, it marks them as “according to the draft.” Before you make selection or capacity decisions, check the official technical report and model card.
1. MoE Architecture: Track Total and Active Parameters Separately
An MoE model consists of multiple expert sub-networks. A router selects a small number of experts to process each token. As a result, the model has two parameter metrics to distinguish:
- Total parameters: The sum of all expert and shared-layer parameters. This number determines how much GPU memory the weights occupy.
- Active parameters: The parameters actually used in the forward pass for a single token. This number roughly determines the compute per step and the generation speed.
According to the draft, one model has about 320B total parameters and about 18B active parameters. At this ratio, the compute per token is close to that of an 18B dense model, but storage cost must be calculated based on 320B parameters. In BF16 format (2 bytes per parameter), the weights alone take about 640 GB. FP8 takes about 320 GB, and INT4 takes about 160 GB. Eight 80 GB GPUs provide exactly 640 GB of total memory. Loading the BF16 weights on that setup would leave almost no room for the KV cache. This means that even though each step uses only 18B parameters, memory must hold all expert weights. Otherwise, the service fails when the router sends a token to an expert that is not loaded.
Routing design also affects load balancing. If most tokens concentrate on a few experts, the GPUs hosting those experts become bottlenecks while other GPUs sit idle. In practice, teams typically balance load with an auxiliary loss or an auxiliary-loss-free bias strategy, and they monitor the load distribution across experts during deployment.
2. Layer Count and Latency
According to the draft, the layer count was reduced from 92 to 45. Fewer layers mean fewer sequential computation steps, which usually lowers end-to-end latency per token. Fewer layers are not always better, however. Reducing depth weakens the model’s capacity for abstract representation, so benchmarks must confirm that tasks such as code, math, and long-document question answering do not degrade. When you compare models, keep the evaluation set fixed and record both time to first token and output tokens per second.
3. Attention Mechanism: The Main Source of Long-Context Cost
Standard self-attention compute grows with the square of the sequence length N. During inference, each layer also stores a KV cache. You can estimate the KV cache size with this formula:
KV cache bytes ≈ 2 × number of layers × number of KV heads × head dimension × sequence length × bytes per element × batch size
Both sequence length and batch size scale memory use linearly. Whether the KV cache at a 1M-token context exceeds the size of the weights depends on the specific configuration, including the layer count and the number of KV heads. Substitute the actual model parameters into the formula to find out.
The draft says the model uses a hybrid of sparse attention and linear attention. It also mentions modules named mHC and IndexPool. The draft gives no paper or official documentation for these terms, so this article does not describe their implementation.
According to the draft, under certain configurations, attention compute is about one-third of that of a standard architecture in the same series, and the KV cache is about one-quarter. However, the draft does not name the baseline model, sequence length, batch size, or precision, and it does not state whether the figures include the prefill stage. Treat these numbers as directional only, not as inputs for capacity planning.
Sparse attention computes attention over only a subset of historical tokens. Linear attention approximates attention with a kernel function, which reduces complexity to scale linearly with sequence length. The trade-off of mixing the two is that exact long-range dependencies may be lost. For tasks that require locating distant information precisely, test long-text retrieval directly, for example by hiding a specific fact in a long document and checking whether the model finds it.
4. Native Multimodality: Verify Capabilities in Testing
According to the draft, this model is the first native multimodal model in its series. Vision and text are trained jointly during pretraining. In theory, this design helps with cross-modal reasoning, but you need to measure the actual results. For evaluation, cover three task types: locating code errors in screenshots, extracting data from charts, and following multi-step instructions that mix text and images.
The draft’s “30T-token” pretraining scale also lacks a public definition of how it is counted. The draft does not explain the deduplication rules, data sources, or the image-to-text ratio.
5. Deployment: Start with a Memory Budget
To plan a long-context agent deployment, follow these steps in order:
- Calculate the weight memory. Choose the quantization format first, then determine how many GPUs one model replica needs.
- Choose a parallelism strategy. Tensor parallelism (TP) is typically used within a single multi-GPU machine, and pipeline parallelism (PP) is used across machines. The product of TP and PP determines how many GPUs one replica occupies.
- Reserve space for the KV cache. Use the formula above to estimate usage at your target concurrency and maximum context length. The remaining memory is the cache budget.
- Set rate limits and fallbacks. Requests that exceed the budget should be queued or truncated. This prevents the inference process from crashing with an out-of-memory (OOM) error.
- Estimate cost. Calculate the cost per thousand requests from the GPU hourly rate, the number of replicas, the average request length, and the concurrency. Then compare the result with a retrieval-augmented generation (RAG) approach.
The following is an illustrative Kubernetes configuration. It shows how to write the resource fields only. It cannot be deployed as is, because it lacks the image, startup command, model path, health checks, and storage mounts.
# Illustrative configuration, not directly deployableapiVersion: apps/v1kind: StatefulSetmetadata:name: moe-inferencespec:serviceName: moe-inferencereplicas: 4 # Number of replicas, determined by the parallelism strategy and available nodesselector:matchLabels:app: moe-inferencetemplate:metadata:labels:app: moe-inferencespec:containers:- name: inference-workerimage: <your-inference
