Skip to content
Language modelsPrototype

Verace V0 Baseline

The lab's PyTorch implementation of the Kimi Team's hybrid linear-attention mixture-of-experts language model, from pretraining to serving.

Verace Research
  1. Fixed-size recurrent state: Kimi Delta Attention state, decayed per channel
  2. Gated NoPE latent attention: Used in every fourth layer and the last
  3. Delta-attention output: Passes a per-head norm and a sigmoid gate
  4. Delta-rule write: Write strength set per token by a sigmoid
Figure 1. Fixed-size delta state beside full-context latent attention. Schematic of the Kimi Team's hybrid design, implemented in code by the lab in Verace V0 Baseline: Kimi Delta Attention keeps a fixed-size state, while latent attention looks back over the whole context. The code is not yet trained or evaluated.
Open the simulator on its own pageLooking back, or keeping a fixed memory: an interactive toy model of the principle. You can also try it below

Overview

Verace V0 Baseline is the lab's own code for the language model architecture described in a technical report by the Kimi Team (arXiv:2607.24653). The architecture is the Kimi Team's design. The implementation written from the report is the lab's. It is the starting point of the Verace V series, which builds on it in Verace V1 and later versions. The baseline addresses one question: can the full system in the report be reproduced as working code, covering the model, optimizer, data pipeline, post-training and serving path? The Kimi Team's own released tokenizer and reference model files sit alongside the code and are not the lab's work.

The model is a decoder that mixes two attention types. Most layers use Kimi Delta Attention, a linear attention whose fixed-size recurrent state decays per channel and is written with a delta rule. Every fourth layer, and the last, uses Gated NoPE Multi-Head Latent Attention. Block Attention Residuals replace the plain residual stream. Stable LatentMoE feed-forward layers route tokens with Quantile Balancing. These components, and SiTU-GLU, MoonViT, Per-Head Muon, the XTML chat template, MXFP quantization and MOPD distillation, are all the report's designs, implemented here by the lab.

The research implementation covers the configuration, every model module, a vision encoder, a draft model in the style of EAGLE-3, a speculative decoding method by other authors, for multi-token prediction and speculative decoding, the Per-Head Muon optimizer, streaming pretraining and SFT/RL dataloaders, a four-stage context curriculum, MOPD post-training, Triton kernels, a KDA prefix cache and a generation engine. The pretraining workspace holds a second copy of the same code. It also holds a copy of the BitNet b1.58 paper by other authors and a copy of a third-party GPT-2 fine-tuning codebase. The configuration records that its hyperparameters were cross-checked against the Kimi Team's released model.

The architecture, training loop, post-training step and serving path are implemented in code, and a single-device pretraining entry point with checkpointing exists. No training run, loss curve or benchmark score is recorded. The evaluator scores answers by substring match and ships only default toy samples. Several serving parts are reference stand-ins. The decode step has a pure PyTorch version of the fused kernel, and DRAM prefetch in the prefix cache only flips a flag. Whether the implementation matches the report's reported behaviour has not been measured.

Status

Prototype. The full architecture, training, post-training and serving code is implemented, but no training run or evaluation result is recorded.

Simulator

A row of tokens is read two ways at once: the newest token looks back at every earlier one, and every token is also written into one memory of fixed size that fades.

  • looking back: one arc for every earlier token
  • fixed memory: how much of each token it still holds
  • newest token at the right
Looking back, this token
23 comparisons
Looking back, whole sequence
276 comparisons
State kept: looking back / fixed
24 tokens / 1 state
Fixed memory: a token is half faded after
4.3 tokens

Lengthen the sequence: the arcs multiply, the fixed memory stays one state. Lower the decay and it forgets sooner.

This simulator is an illustration of the principle, with made-up numbers. It does not run the lab's code or show the lab's data, and nothing in it is a measurement.

Architecture

  1. Kimi Delta Attention layers

    The report's linear attention layer, implemented with cached causal short convolutions, a delta-rule state update and lower-bounded per-channel decay. It has both a sequential path and a chunkwise path.

  2. Gated NoPE latent attention

    The report's Multi-Head Latent Attention variant without rotary position encoding. It uses low-rank query and key-value compression, FP32 attention and a sigmoid output gate, and caches the compressed latent.

  3. Hybrid layer schedule

    A configuration rule that sets every fourth layer and the final layer to latent attention and the rest to delta attention. The first layer uses a dense feed-forward block.

  4. Block Attention Residuals

    The report's residual scheme, implemented in AttnResMixer. A layer's input is a learned softmax mixture of earlier block snapshots and the running residual.

  5. Stable LatentMoE

    The report's mixture-of-experts layer in StableLatentMoE, combining a full-width shared expert with 896 routed experts that run in a down-projected latent space. The code uses one shared expert of twice the expert width, while the report's table lists 2 shared experts.

  6. MoonViT vision encoder

    The report's vision transformer for images and video. Its patch tokens are reduced and projected into placeholder positions in the language model's token sequence.

  7. EAGLE-3 style draft model

    A one-layer draft decoder, EAGLE3DraftDecoderLayer, following EAGLE-3, a method by other authors, that fuses features from the backbone to predict tokens ahead. It is used for the multi-token prediction loss during training and for speculative acceptance at generation time.

  8. Per-Head Muon optimizer

    The report's per-head variant of the Muon optimizer. Muon itself is by other authors. This variant orthogonalizes attention projection updates separately for each head.

  9. Pretraining and context curriculum

    A streaming domain-mixed dataloader, a pretraining step with cosine schedule, and ProgressiveContextCurriculum. The curriculum raises sequence length in four stages from 8192 to 1048576 tokens.

  10. Post-training with MOPD

    An SFT step and an on-policy RL step using the report's multi-teacher on-policy distillation reward. Data comes from conversations formatted in XTML with assistant-only action masks.

  11. Serving stack

    A generation engine with prefill and per-layer cache decoding, Triton kernels for SiTU-GLU and the KDA decode recurrence, and KDAPrefixCacheManager, a prefix cache for delta-attention states.

  12. MXFP quantization

    The report's block microscaling quantization, implemented as fake quantization in MXLinear for quantization-aware training.

Implementation

Mechanisms as they are implemented in the source code, with the constants the code uses.

Delta-rule recurrence with decay
Per token, the state SS of shape [b, h, d_k, d_v] is scaled row-wise by the decay α\alpha, then updated as S←S−βk(k⊤S)+βkv⊤S \leftarrow S - \beta k (k^\top S) + \beta k v^\top, and the output is o=S⊤qo = S^\top q. Queries and keys are L2-normalized SiLU outputs of a causal depthwise convolution with kernel 4. The write strength is β=σ(Wβx)\beta = \sigma(W_\beta x).
Lower-bounded channel-wise decay
A low-rank projection plus bias bαb_\alpha produces the decay logit zz. The decay is gt=gmin⁡ σ(eAz)g_t = g_{\min}\,\sigma(e^{A} z) with α=egt\alpha = e^{g_t}, and gmin⁡g_{\min} defaults to −5.0-5.0. log_scale_A is initialized per head to the log of a uniform draw between 1 and 16.
Chunkwise UT-transform form
When use_chunkwise is set and the sequence length is divisible by 16, the sequence is split into 16-token chunks with cumulative decay γ=∏α\gamma = \prod \alpha. Each chunk solves the unit lower-triangular system (I+β tril<((Kγ)(K/γ)⊤))V~=β(V−(Kγ)S)(I + \beta\,\mathrm{tril}_{<}((K\gamma)(K/\gamma)^\top))\tilde{V} = \beta(V - (K\gamma)S). The output is (Qγ)S+tril((Qγ)(K/γ)⊤)V~(Q\gamma)S + \mathrm{tril}((Q\gamma)(K/\gamma)^\top)\tilde{V}.
Output gating and head norm
The delta-attention output passes through a per-head RMSNorm, is multiplied by σ(Wgatex)\sigma(W_{gate} x) and is projected by WoutW_{out}. GatedNoPEMLA applies the same sigmoid gate before its output projection.
Latent attention projections
Queries go from hidden to 1536, through RMSNorm, then to per-head widths of 128 plus 64. Keys and values come from a hidden-to-512-plus-64 projection. The 512 part is normalized and expanded per head, and the 64-wide slice is shared across heads with no rotary transform. Scores use scale dq−1/2d_q^{-1/2} in FP32 with a causal mask.
Layer type assignment
is_mla_layer returns true when (i+1) mod (r+1)=0(i+1) \bmod (r+1) = 0 or when ii is the last layer, with hybrid_kda_ratio rr defaulting to 3. Layers with index below first_k_dense_replace (default 1) use a dense SiTU-GLU feed-forward block of intermediate size 33792 instead of the MoE.
Attention residual mixing
Each layer stacks committed block snapshots with the current prefix sum and scores each entry by a linear projection of its RMSNorm. The softmax-weighted sum is computed separately as the input to attention and to the feed-forward block. At layers where the index is a multiple of attn_res_layers_per_block (default 12), the raw value is appended as a snapshot and the accumulator restarts.
SiTU-GLU activation
The activation computes y=[β1tanh⁡(g/β1) σ(g)]⊙[β2tanh⁡(u/β2)]y = [\beta_1 \tanh(g/\beta_1)\,\sigma(g)] \odot [\beta_2 \tanh(u/\beta_2)] with g=Wgxg = W_g x, u=Wuxu = W_u x, β1=4.0\beta_1 = 4.0 and β2=25.0\beta_2 = 25.0. The Triton kernel computes tanh⁡(z)=2σ(2z)−1\tanh(z) = 2\sigma(2z) - 1 in fp32 with BLOCK_SIZE 1024.
Normalized latent MoE
The layer output is y=Shared(x)+Wup RMSNorm(u)y = \mathrm{Shared}(x) + W_{up}\,\mathrm{RMSNorm}(u), where uu is the weighted sum of routed expert outputs on z=Wdownxz = W_{down} x. Defaults are latent width 3584, expert hidden width 3072, 896 experts with 16 active, and a single shared feed-forward block of twice the expert hidden width. Only routed experts take use_qat; the shared expert stays in full precision.
Quantile balancing router
Scores are σ(Wrx)\sigma(W_r x), and the router selects the top k+1k+1 experts on score plus bias. The top-k weights are the unbiased scores normalized to sum to 1, and the (k+1)(k+1)-th biased score is the cutoff. In training, per-expert margins against the cutoff are sorted and b^=−margin⌊mk/n⌋\hat{b} = -\mathrm{margin}_{\lfloor mk/n \rfloor}. The bias is updated with a 0.9 weight on its previous value, with no auxiliary loss.
Per-head Muon update
Momentum is m←0.95 m+gm \leftarrow 0.95\,m + g. The Newton-Schulz iteration normalizes XX and runs 5 steps of X←aX+(bA+cA2)XX \leftarrow aX + (bA + cA^2)X with A=XX⊤A = XX^\top and (a,b,c)=(3.4445,−4.7750,2.0315)(a, b, c) = (3.4445, -4.7750, 2.0315). Attention query, key and value projections are reshaped into heads and orthogonalized per head, while embeddings and the output head fall back to plain momentum.
Draft fusion and LK loss
Features from block snapshots 1 and 4 and the final hidden state are concatenated and mapped by w_e3, which is initialized to [0,0,I][0, 0, I], before the next-token embedding is added. The acceptance loss is L=−log⁡∑xmin⁡(p(x),q(x))L = -\log \sum_x \min(p(x), q(x)), clamped at 1e-8 and averaged over at most 7 unroll steps.
Pretrain step and schedule
The loss is shifted next-token cross-entropy plus 0.1 times a multi-token prediction cross-entropy against labels two positions ahead. Gradients are norm-clipped to 1.0, and after each step every 2D parameter is clamped to [−1,1][-1, 1]. The learning-rate factor warms up linearly, then follows r+(1−r) 12(1+cos⁡(πp))r + (1-r)\,\frac{1}{2}(1 + \cos(\pi p)) for minimum ratio rr and progress pp.
Domain-mixed data packing
Domains are sampled with weights web 0.4, code 0.3, math 0.15 and knowledge 0.15, and documents end with EOS and are packed into fixed-length chunks. With synthetic long-range markers enabled and sequence length above 200, positions 100 and the hundredth from the end repeat the first token. Positions 128 to 191 become placeholder id 163605, paired with a random image tensor.
MOPD reward and policy loss
The per-token reward is r=clip(log⁡pT−log⁡pS,−2,2)r = \mathrm{clip}(\log p_T - \log p_S, -2, 2) times the action mask, computed without gradient. The teacher is chosen by a domain and effort key. The advantage is A=rv+0.5 rA = r_v + 0.5\,r with verifier reward rvr_v, and the loss is −mean(log⁡pS⋅m⋅A)-\mathrm{mean}(\log p_S \cdot m \cdot A).
MX block fake quantization
The last dimension is padded to a multiple of 32 and split into blocks with shared scale s=2⌊log⁡2(max⁡∣x∣/fmax⁡)⌋s = 2^{\lfloor \log_2(\max|x| / f_{\max}) \rfloor}. Values are clamped, rounded and rescaled, with fmax⁡f_{\max} of 448.0 for activations and 6.0 for weights. MXLinear applies this with a straight-through estimator whenever use_qat is set.
Prefix cache hashing
A checkpoint stores the delta-attention state on CPU under a SHA-256 hash of the token prefix truncated to a multiple of 512. Lookup hashes prefixes at 512, 1024 and so on, keeps the last hit and stops at the first miss. The manager tracks a 6144-token page size and a pool of 1000 free pages; prefetching only clears a flag.
Vision token reduction
A 14x14 stride-14 convolution forms patches that pass through 27 blocks with residual width 1024 and QKV width 1536. Video adds one temporal attention block and averages frames in groups of 2. The patch grid is padded to even size, and each 2x2 neighbourhood is concatenated before an MLP projector.
Speculative acceptance in generation
After each target sample, the draft model proposes the next token from the current block features. If the target's next independent sample equals the draft, the token is emitted and one more target step runs in the same iteration. Sampling uses temperature with a 1e-5 floor.

Concepts

Kimi Team technical report
The source of the architecture the baseline implements (arXiv:2607.24653). Its named components are the Kimi Team's design; the code that implements them is the lab's.
Linear attention
An attention form that keeps a fixed-size state instead of a growing key-value cache, so each decode step costs the same regardless of context length. Kimi Delta Attention is the report's linear attention.
Delta rule
A state update that first removes what the state currently predicts for a key, then writes the new value. This lets the memory overwrite old associations instead of only adding to them.
Hybrid attention
Mixing cheap linear-attention layers with periodic full-attention layers. In the baseline, three delta-attention layers alternate with one latent-attention layer by default.
Multi-Head Latent Attention
Attention where keys and values are compressed into a small shared latent vector that is cached and expanded per head. This reduces cache memory. The report's variant drops rotary position encoding, hence NoPE.
Block Attention Residuals
The report's replacement for the plain residual sum. Each layer reads a learned weighted mixture of earlier block outputs instead of their unweighted sum.
Mixture of experts
A feed-forward layer made of many expert networks of which a router activates only a few per token. In the baseline, 16 of 896 routed experts are active, plus one shared expert.
Quantile Balancing
The report's method for keeping expert load even without an auxiliary loss. Per-expert biases are set from quantiles of routing margins, so each expert's share of tokens moves toward the target.
SiTU-GLU
The report's gated activation, in which both the gate and the up branch are soft-capped with tanh to bound their magnitude.
Muon and Per-Head Muon
Muon is an optimizer by other authors that orthogonalizes momentum updates with a Newton-Schulz iteration. The report's per-head variant applies the orthogonalization to each attention head separately.
Multi-token prediction
Training an extra head to predict tokens beyond the next one. In the baseline, an EAGLE-3 style draft model serves this role and also proposes tokens for speculative decoding.
Speculative decoding
A generation method in which a small draft model proposes tokens and the main model keeps those it agrees with, so more than one token can be emitted per main-model step.
MOPD distillation
The report's multi-teacher on-policy distillation. A student is rewarded per token by its log-probability gap to a teacher chosen for the task's domain and effort level.
MXFP quantization
The report's use of microscaling formats, in which each block of 32 values shares one power-of-two scale. The baseline uses fake quantization during training.
XTML chat template
The report's chat markup, built from open, separator and close tokens. It encodes messages, options, tool declarations, reasoning, responses and tool calls.
MoonViT
The report's vision transformer. Here it encodes images and video into tokens that are inserted at placeholder positions in the text sequence.
Progressive context curriculum
Raising training sequence length in stages. The baseline defines stages of 8192, 65536, 262144 and 1048576 tokens.
BitNet b1.58 reference
A paper by other authors on language models with ternary weights in {−1,0,1}\{-1, 0, 1\}, obtained by absmean scaling and rounding. A copy is kept with the pretraining workspace; it is not the lab's work and is not implemented in the baseline.

About this page

Written from the lab's own documents and source code. Figures and results are the lab's measurements as it recorded them at the time, and have not been independently replicated.

The Verace V series is the lab's line of language model architectures. It started from the lab's own code for the architecture described in a technical report by the Kimi Team (arXiv:2607.24653), listed here as the V0 baseline. Later versions replace the baseline's main parts with the lab's own designs and keep some of the report's components, which each page credits to the report.

Published under the PolyForm Noncommercial License 1.0.0: free for noncommercial use.