4.5 Various LLM Architectures
You have room for the weights, but does another pass through the same layers need more memory? In the CPU experiment below, 24 decoder layers run 72 times. There is still one copy of each layer, yet each repeat leaves new keys and values for the next token to read.
This chapter follows three design decisions through an inference request. Which earlier tokens can a layer see? Which parameters does it touch? What stays in memory after the request advances by one token?
The November 24 update adds GLM-5.4’s shared-depth design and GPT-6.2’s documented interface. Earlier dated tables remain historical snapshots.
Why Architectures Keep Diverging
Chapter 3 gave us the canonical Transformer. Real systems, however, run into recurring pressure points:
- Long contexts make full attention expensive.
- KV caches become costly during autoregressive serving.
- Dense feed-forward layers scale poorly as models get larger.
- Training objectives that work for next-token prediction are not always optimal for throughput or reasoning.
Most modern architectural changes can be understood as responses to one or more of these bottlenecks.
1. Hybrid and Linear Attention
Standard self-attention has quadratic cost in sequence length, so it becomes expensive when context grows. One increasingly common response is a hybrid attention stack.
Instead of using full attention in every layer, hybrid models mix expensive but expressive attention layers with cheaper mechanisms such as linear attention, local attention, or state-space style updates. The intuition is simple: not every layer needs to perform global token-to-token lookup with the same fidelity.
This is a recurring pattern in modern model design. Keep some layers that are excellent at exact retrieval and composition, then use cheaper layers elsewhere to carry longer-range state at lower cost.
Recent open-weight releases make this trend concrete. MiniMax-Text-01 scaled a hybrid stack where seven Lightning Attention layers are followed by one Softmax attention layer, combined with MoE, to support very long contexts [4]. Kimi Linear then pushed the idea further with Kimi Delta Attention (KDA), a refined gated-delta linear attention module, interleaved with global MLA layers in a 3:1 ratio; its model card reports up to 75% KV-cache reduction and up to 6x decoding throughput at 1M context [5]. Qwen3.6-35B-A3B shows the same direction in a smaller open-weight package: 35B total parameters, 3B active, a repeated 3 x Gated DeltaNet + 1 x Gated Attention layout, MoE after each attention block, multi-token prediction, and native 262K context extendable to about 1M tokens [6]. Ling-2.6-flash, released as an open model in April 2026, is another recent example: it upgrades a GQA design into a 1:7 MLA + Lightning Linear hybrid with highly sparse MoE, targeting faster agent-style inference rather than simply longer chain-of-thought outputs [7].
The important update is not that softmax attention disappeared. It has not. The newer pattern is selective full attention: keep a small number of global attention layers as high-fidelity retrieval/composition checkpoints, and let linear-attention layers carry most of the long-context state. This makes hybrid linear attention look less like an exotic research branch and more like a practical production architecture for agentic and long-context workloads.
2. KV-Cache Compression and Memory-Aware Attention
For autoregressive models, serving cost is often dominated not just by compute, but by memory movement. Every generated token extends the KV cache, and that cache must be read repeatedly during inference.
DeepSeek-V3’s Multi-head Latent Attention (MLA) caches a shared content vector and a separate positional key per token. Each head reads that state through its own projections. Count the bytes for a 4,096-token request and compare two ways to read the same cache [1].
3. Mixture of Experts in the Feed-Forward Stack
Another major lever is the feed-forward block. Dense FFNs scale cost with the full parameter count, while Mixture of Experts (MoE) activates only a subset of experts for each token.
MoE is attractive because it increases total model capacity without paying the full inference cost of a dense model of the same size. The trade-off is engineering complexity: routing, load balancing, expert parallelism, and communication overhead become first-class concerns. In other words, MoE often trades arithmetic cost for systems complexity.
4. Multi-Token Prediction (MTP)
Most language models are trained to predict exactly one next token. Multi-token prediction (MTP) changes the objective so that the model predicts several future positions at once.
This can improve training efficiency and create a cleaner path to faster inference schemes such as speculative decoding. Conceptually, it is a reminder that architecture is not only about layers and blocks. Training objectives also shape which serving optimizations become natural later.
5. Optical Context Compression
The previous examples change how the model processes tokens once they are already inside the Transformer. A newer line of work asks a stranger question: what if a long text context should not enter the model as a long 1D token sequence at all?
DeepSeek-OCR is an example of this idea. Despite the name, its most interesting contribution is not simply “better OCR.” It investigates contexts optical compression: mapping text-heavy documents into a 2D visual representation, encoding that page image into a small number of vision tokens, and then using a language decoder to recover or reason over the content [3]. A page full of text can sometimes be cheaper to pass through a vision encoder than to feed as thousands of text tokens.
The intuition is familiar if you have ever screenshotted a long paragraph. A screenshot preserves line breaks, tables, mathematical notation, and spatial layout in one compact object. DeepSeek-OCR turns that intuition into a model pipeline:
- Render or receive the document as an image-like 2D signal.
- Compress the page with a vision encoder, DeepEncoder, into a bounded number of vision tokens.
- Decode the compressed representation with a DeepSeek3B-MoE-A570M language decoder.
- Produce OCR text, markdown, layout-aware outputs, or document-grounded responses.
This does not mean the system has abandoned text. The output is still text, and the decoder is still a language model. The architectural shift is at the input boundary: text is treated as something that can be optically compressed before it becomes model context.
For practitioners, the key quantity is the compression ratio:
If a document would normally consume 2,000 text tokens but can be represented by 200 vision tokens, then . The DeepSeek-OCR paper reports that when this ratio stays below about , OCR precision remains around 97%; at roughly , accuracy falls to about 60% [3]. That trade-off is the whole story: optical compression can buy context length, but it is not a lossless replacement for text tokenization.
Technically, this moves some of the burden from sequence modeling into visual representation learning. The encoder must preserve fine-grained glyph identity, reading order, table structure, and layout geometry while producing far fewer tokens than a conventional OCR or document parsing pipeline. The decoder then has to turn those compressed visual tokens back into exact symbols or structured text. This is very different from ordinary image captioning: a one-character error in code, math, legal text, or a table cell may be unacceptable.
The deeper implication is that “context length” is no longer only an attention problem. Long-context systems can be attacked at several levels:
- make attention cheaper over long token sequences with hybrid linear attention;
- make the KV cache cheaper during generation;
- route computation sparsely with MoE;
- predict or verify multiple tokens at once;
- or compress the input representation before it becomes a token sequence.
Optical context compression belongs to the last category. It is promising for scanned documents, PDFs, tables, receipts, historical archives, and layout-rich corpora. It is riskier for workloads where exact byte-level fidelity matters, such as source code patches, formal proofs, contracts, and safety-critical numeric tables. A robust production system would often pair it with confidence scoring, selective fallback to text OCR, or verification against the original document image.
The Open-Model Frontier: Architecture Versus Disclosure
Historical release snapshot: as of 2026-09-15. The local-context correction and October additions below supersede the conflated hosted/checkpoint limits.
The most useful comparison is not a product-name table. It is a claim-boundary table: what can be verified from weights and configuration files, what is described only in a launch post, and what is still promised.
| Model | Public state on September 15, 2026 | Verified architectural disclosure | What is still unknown |
|---|---|---|---|
| GLM-5.2 | MIT-licensed weights and configuration are public | 753B MoE, 78 layers, first 3 dense layers, 256 routed + 1 shared expert, 8 routed experts per token, 1M positions, DeepSeek Sparse Attention, IndexShare, and one MTP layer [8] [9] | The complete pre-training corpus mixture and filtering recipe are not published |
| Kimi K3 | Released/open-weight; weights, technical report, MoonEP, FlashKDA, and AgentEnv are public [14] | 2.8T parameters, native multimodality, 1M context, Kimi Delta Attention, Attention Residuals, Stable LatentMoE, and 16-of-896 expert routing [11] [14] | The exact pre-training data mixture and complete filtering recipe remain undisclosed |
| Qwen3.7 | Released as an agent-oriented Qwen generation | 1M-context product configuration and long-horizon agent examples are documented [12] | It is not evidence for Qwen3.8 internals |
| Qwen3.8-2.4T-A95B (downloadable checkpoint) | Released/open-weight as Qwen3.8-2.4T-A95B [15] | Public weights and configuration establish 2.4T total parameters, 95B active parameters, 262,144 native positions, and documented context extension [13] [15] | The exact corpus mixture and complete data-filtering and post-training recipes remain undisclosed |
This distinction matters. “Open” is not a future promise, an API endpoint, or a parameter-count announcement. For reproducible engineering, an open-weight claim starts when the actual weight files and a usable configuration are available.
GLM-5.2: sharing the indexer, not the attention result
GLM-5.2’s most interesting long-context idea is IndexShare. Sparse attention normally needs an indexer to decide which historical positions deserve expensive attention. GLM-5.2 shares one learned sparse indexer across a group of four layers. The selected positions can still be processed by each layer’s own attention projections; it is the retrieval decision machinery that is amortized. Z.ai reports 2.9× lower per-token FLOPs for this long-context path at 1M tokens [8].
The configuration reveals an intentionally staged stack: three dense layers establish early representations, then the remaining layers use fine-grained MoE with one always-on shared expert and eight selected routed experts. One MTP layer supplies a draft signal for speculative decoding. The launch report also describes IndexShare/KVShare, rejection sampling, and an end-to-end total-variation objective that raised average accepted speculative length from 4.56 to 5.47 tokens [8]. That is roughly a 20% gain in accepted draft length—not automatically a 20% end-to-end latency reduction, because verification, memory traffic, batching, and scheduler overhead remain.
The post-training pipeline is equally instructive. Z.ai describes parallel on-policy distillation that merges more than ten expert policies in roughly two days, critic-based PPO for compacted long trajectories, token-level loss normalization for imbalanced trajectory lengths, and a two-stage anti-reward-hacking filter. When a suspicious tool call is blocked, the rollout receives a dummy result and continues. This creates training data for recovery behavior instead of simply deleting the episode [8]. The broader lesson is that an “agent model” is increasingly a coupling of architecture, rollout compression, verifier design, and serving kernels.
Kimi K3: three disclosed ideas, one important denominator
K3 combines Kimi Delta Attention (a recurrent/linear attention path), Attention Residuals (cross-layer attention-style residual mixing), and Stable LatentMoE. Its router selects 16 of 896 experts per token. That is about 1.8% of the expert pool, not proof that only 1.8% of the model’s total parameters are active: embeddings, attention, shared components, and expert sizes all affect the true active-parameter ratio. Moonshot reports 2.5× scaling efficiency over K2; the subsequently released technical artifacts make the architecture and systems claim inspectable, while the exact training-data mixture is still undisclosed [11] [14].
K3 also exposes a subtle product constraint: a reasoning session should preserve its thinking history. Switching modes mid-session can destabilize the trajectory. That is an architectural clue with operational consequences—conversation state is part of the inference contract, not merely UI decoration.
Qwen3.8: artifact arrival changes the claim boundary
Qwen3.8 is valuable precisely because its release history teaches evidence discipline. At preview time, Alibaba had announced a 2.4T model and future open weights, so its internals had to remain undisclosed rather than inherit Qwen3.7 details [13]. The later Qwen3.8-2.4T-A95B repository changed that boundary: weights and configuration now support claims about total and active parameters and the documented native/extended context distinction [15]. They still do not disclose the exact corpus mixture or complete filtering and post-training recipes. A living technical comparison must change when the artifact changes—not when a future promise is first published.
October Update: Separate Compute, Memory, and Release State
As of 2026-10-13. The following additions are supported by current primary artifacts. They extend the historical September table above.
| Model | Access | Disclosed mechanism | Boundary |
|---|---|---|---|
| DeepSeek V4.1 Flash | released/open-weight | Causal Encoder-Decoder (CED), CSA2 cross-layer cache reuse, FP4 KV, and Engram conditional memory [16] [17] | Backbone parameters and lookup memory are different accounting categories; full data mixture remains undisclosed |
| GLM-5.3 | released/open-weight | Its documentation describes post-training improvements on the GLM-5.2 base, text-only inputs, and always-on reasoning [18] | Do not infer a new backbone or borrow the separate Flash model’s cache layout |
| Mistral Large 4 | preview/API-only | The launch post reports a 1T multimodal MoE with 52B active parameters [19] | Weight release and additional technical detail are planned for later in October |
| Beam | announced/planned | The launch post reports a 501B MoE with 23B active parameters [20] | Early-access signup is available; weights and technical artifacts are promised later in October |
Autoregressive does not mean decoder-only
V4.1 Flash uses a causal encoder followed by a decoder. Its card explains that global decoder KV is projected from the encoder’s final states, rather than rebuilt independently from each decoder layer [16]. This differs from T5’s bidirectional source encoder while still generating text autoregressively. Output factorization, attention visibility, and the prefill/decode execution path are separate design choices.
Conditional memory is a different sparsity axis
Engram studies token-conditioned lookup as a complement to MoE computation [21]. A deterministic address can enable prefetching, but a lookup is not free: storage capacity, host bandwidth, transfer overlap, and miss behavior matter. It is also not the external, refreshable document index of RAG. For a deployment comparison, separate neural compute, lookup storage, KV state, and communication; one active-parameter ratio cannot describe all four.
Hosted and downloadable Qwen3.8 are distinct artifacts
The local Qwen3.8 configuration declares max_position_embeddings: 262144 [22]. Its model card describes 262,144 native positions and extension to 1,010,000 tokens, while the hosted Qwen3.8-Max product has additional capabilities and a different default context [15]. Pin the scaling configuration and evaluate retrieval, multi-document reasoning, position sensitivity, memory, and latency at the intended length. “1M context” is a configuration and evaluation claim, not a guarantee inherited by every serving path.
A Better Way to Compare Modern Architectures
Rather than memorizing product names, it is more useful to compare architectures by the bottleneck they target.
| Design Pressure | Common Architectural Response | What You Gain | What You Give Up |
|---|---|---|---|
| Long contexts | Hybrid linear attention, local attention, sparse attention | Lower asymptotic attention cost | Less uniform behavior across layers and more custom kernels |
| KV-cache growth | GQA, MQA, MLA, sliding windows | Lower memory traffic during serving | More specialized implementation details |
| Massive parameter counts | MoE layers | Higher capacity per unit inference compute | Routing and load-balancing complexity |
| More computation without duplicating a layer block | Shared-depth loops | More transformations using the same block weights | Repeated computation, state management, and stability checks |
| Throughput during decoding | MTP, speculative-friendly objectives | Faster generation paths | More training and serving coordination |
| Input context token growth | Optical 2D mapping, vision-token compression | Large documents fit into fewer context tokens | OCR errors, layout dependence, and verification burden |
| Long-context stability | QK-Norm, RoPE variants, windowing | Better optimization at scale | Extra design tuning and validation |
This lens also explains why there is no single “best” modern architecture. A model optimized for short, frequent chat requests may choose very different internals from one optimized for long-context document work or large-scale coding assistance.
What does a DeepSeek-V3 attention layer keep for the next token?
Suppose one request already has 4,096 tokens in its cache. For each token, DeepSeek-V3 keeps a 512-coordinate vector that encodes the content keys and values, plus a 64-coordinate key carrying rotary position information. All 128 heads in the layer share these two stored vectors. At two bytes per coordinate, the persistent attention payload for this one layer and one request is bytes, or 4.5 MiB. Counting only the compressed content misses half a MiB. The dimensions and the two tensors to cache come from sections 2.1.1 and 4.2 of the DeepSeek-V3 report [1].
How can the heads still return different answers? Let hold one latent row per cached position, and be one head’s key and value projections, and its content query. The head can compute the same content scores as by first projecting the query and then reading the latents, . Add the positional scores before scaling and softmax. Once softmax gives weights , the head can project the weighted latent to obtain the same output as .
Scope of the CPU example. One unpadded sequence grows one position at a time. The FP32 tensors stand in for the outputs of the trained projections and RoPE. The code compares the two evaluation orders for each head. It omits weight loading, the final output projection, allocator overhead and optimized kernels. Appending with
torch.catcopies tensors.
import math
import torch
rng = torch.Generator().manual_seed(7)
def sample(*shape):
return torch.randn(*shape, generator=rng, dtype=torch.float32, device="cpu")
# Two heads, each projecting a 3-coordinate latent to 4 content coordinates.
key_up = sample(2, 3, 4)
value_up = sample(2, 3, 4)
latent = sample(0, 3)
position_keys = sample(0, 2)
scale = math.sqrt(4 + 2)
for _ in range(4):
latent = torch.cat((latent, sample(1, 3)))
position_keys = torch.cat((position_keys, sample(1, 2)))
for wk, wv in zip(key_up, value_up):
query = sample(4)
position_scores = position_keys @ sample(2)
keys, values = latent @ wk, latent @ wv
weights = (((keys @ query) + position_scores) / scale).softmax(dim=0)
reference = weights @ values
latent_query = wk @ query
weights = ((latent @ latent_query + position_scores) / scale).softmax(dim=0)
result = (weights @ latent) @ wv
torch.testing.assert_close(result, reference, atol=1e-5, rtol=1e-5)
print(tuple(latent.shape), tuple(position_keys.shape), latent.nbytes + position_keys.nbytes)
The script prints (4, 3) (4, 2) 80. Four positions each hold three content coordinates and two positional coordinates, all in FP32. The explicit keys and values in the reference calculation are temporary. Each of the eight head outputs (two heads after each of four appends) must match before the shapes are printed.
Interactive Visualization: Attention Masking
How many positions can the second token, “Learning,” read? Count the ones in its row as you switch from bidirectional attention to causal attention and then to a three-token prefix. The count goes from five to two to three. In the prefix setting, “Learning” can read “Is” because both belong to the prefix. A one permits the connection. The learned query and key determine how much attention it receives.
Attention Mask Visualizer
Select architecture to see the attention mask pattern
November 15 Update: Artifacts, Architecture, and State Must Be Separated
As of 2026-11-15. The September and October 13 tables above are historical records. The following primary artifacts update their release states and add distinct designs; they do not retroactively change earlier announcement dates.
| Model / milestone | Current release state | What is disclosed | What the disclosure does not establish |
|---|---|---|---|
| Beam 1.0, weights October 16 | released/open-weight, Apache 2.0 | The card reports 501.3B total/23.4B active parameters, gated GQA plus sliding-window attention, and a modified Harmony template [23] | Full training mixture; complete technical report remains marked pending |
| Muse Spark Open, October 15 | released/open-weight, gated Muse Model License | Meta reports 816B total/42B active and multimodal input with text output [24] | Equivalence to the hosted Spark revision or unrestricted weight access |
| Muse Wonder / Wonder Full, October 12 | released/hosted access; Full in subscriptions | The announcement distinguishes API and subscription access [25] | Parameter count, detailed architecture, and full training recipe are undisclosed |
| Nemotron 3.5 Super VL, October 15 | released/open-weight, OpenMDW-1.1 | The card reports 120B total/12B active, interleaved Mamba-2/MoE/attention and a vision encoder [26] | That attention KV alone describes its serving state |
| Nemotron 3.5 Bolt 74B-A9B, October 15 | released/open-weight, OpenMDW-1.1 | The card reports 74B total/9B active, hybrid LatentMoE and IQ2 QAT [27] | A universal 24GB running-memory guarantee at all contexts and batches |
| Step 5 Preview, October weight milestone | released/open-weight, StepFun Model License 1.0 | The card reports a 600B total/27B active MoE [28] | That a Preview name means unavailable weights, or that its license is MIT |
| DeepSeek V4.1 Flash 1017, October 17 | released/open-weight, MIT; API alias updated | The card publishes a revision and protocol-aware encoding guidance [29] | A redesigned backbone or equivalence to September; Section 17.6 separately records the 1017/max evaluation |
| Hy-Memory-30B-A3B, October 15 | released/open-weight, Apache 2.0 | A specialized external-memory writer and its protocol integrations [30] | General-purpose agent quality or model-internal permanent memory |
The engineering distinction is architecture → numerical artifact → runtime → deployed system. Packed storage may change tensor element counts without changing logical parameter count. A hybrid model adds recurrent state to its attention cache; a specialized memory writer updates an external bank instead. Neither can be evaluated correctly by reading a single parameter or context number.
For adoption, pin the model and numerical format, tokenizer or encoding toolkit, template, vision preprocessing, kernels, state layout, and tool schema. Verify which details are actually disclosed. Run local capability, memory, latency, and recovery checks rather than transferring a hosted score to a different artifact. Section 17.6 tracks the dated release/evaluation profiles; Sections 12.5, 13.5, and 16.5 examine the resulting state, compression, and memory contracts.
November artifact additions
As of 2026-11-15. These rows supersede earlier planned-weight states; revision dates are not assumed to be first launch dates.
| Artifact / milestone | Public disclosure | Boundary |
|---|---|---|
| Mistral Large 4, weights October 29 | Public multimodal MoE weights; 1T total/52B active [31] | Custom ecosystem license; Model-as-a-Service businesses need an additional agreement |
| Kimi K3.1 Pro, checked November 5 revision | Public 2.8T total/104B active; KDA plus gated sparse attention and QAT formats [32] | Hosted Highspeed is a separate profile; full training mixture undisclosed |
| Inkling 2 Small, weights November 12 | Apache-2.0, 594B total/17B active, text/image input, mixed formats and draft head [33] | Packed storage is not logical parameter count or a throughput guarantee |
| Qwen3.8 Flash Next, checked November 7 revision | Main network 125B/6B active, separate 51B n-gram embeddings and 4B MTP; native context 262,144 [34] | Do not merge parameter categories or identify it with hosted Flash |
| GLM-5.3 Flash, checked October 15 revision | MIT, separately trained multimodal base, 320B/18B active [35] | Do not inherit the text-only GLM-5.3 description |
GPT-6.1 Terra and Claude Fable/Mythos 5.2 add hosted operating points, but their parameter counts and detailed training recipes remain undisclosed. Section 17.6 separates their access, pricing and evaluated profiles from these downloadable artifacts.
Qwen4: Separate Backbone, Active Compute, and Lookup Capacity
As of 2026-11-17. Qwen’s November 16 launch reports a 2.4T backbone, 71B active parameters per token, plus 328B n-gram embedding parameters. It combines three Gated DeltaNet layers per Qwen Sparse Attention layer, micro-block context selection, four gated residual branches, and second-layer n-gram lookup [36]. These are provider disclosures; training data composition remains undisclosed. Smaller open models are announced/planned, not released weights.
Engineering inference: active parameters estimate neither resident weight memory nor lookup traffic. Benchmark recurrent-state compression, sparse retrieval and lexical lookup separately; do not attribute a system-level gain to one component without ablations. This connects Chapters 5, 12 and 13: compute, stored capacity and recoverable context are different budgets.
GLM-5.4: Reusing Layers Separates Depth from Capacity
As of 2026-11-24. Z.ai’s November 23 announcement describes a 750B-scale Loop Transformer adapted from a pretrained GLM-5 base, with 28 shared layers executed twice [37]. Exact total/active parameter counts, the complete training mixture and a future weight license remain undisclosed.
Think of applying the same editing procedure to a revised draft. The procedure is reused, but its second application sees a changed representation and still takes work. A simple execution count makes this distinction concrete. Let be the original number of layers, the size of the shared block, and its iteration count. If all other layers execute once, the number of layer executions per forward pass is
Here counts executions, not separately stored layer weights. With the disclosed and , the count is ; this does not establish the model’s full layer count. It also does not give a FLOP multiplier: attention, expert routing, gates, cache reads and kernel execution have different costs. Reusing a matrix saves duplication of that matrix, not the arithmetic needed to apply it again.
The announcement identifies three supporting mechanisms [37]:
| Mechanism | Disclosed operation |
|---|---|
| Per-iteration, per-token gates | Control residual updates to stabilize repeated computation |
| Shared global KV plus a local window | The second pass reuses first-pass sparse KV and retains its own sliding-window KV |
| Sparse index reuse | The second pass reuses first-pass retrieval indices |
The reported controlled ablation uses a 30B model, with about 10% more training compute, after 200K-context SFT with thinking enabled. It is not a flagship benchmark result. Adaptive iteration counts remain future work [37]. For a private evaluation, hold tool access, effort, context and stopping rules fixed; measure task success, total generated tokens, tail latency and budget exhaustion. Fewer output tokens need not mean less internal computation.
Access boundary: Coding Plan, ZCode and Z.ai Chat are live; the standard pay-as-you-go API and weights remain planned [37]. Coding Plan integration documents 1M context, image input and low/high/max effort; disabling thinking maps to low [38]. This is a hosted serving contract, not a downloadable configuration. Section 17.6 tracks release and evaluation evidence separately.
Why can one token position contribute two cache entries?
Z.ai’s architecture guide says the second pass can attend to a first-pass representation and its updated local representation at the same position (as of 2026-11-25) [43]. Suppose the first-pass index picks positions 1, 5 and 7, and the second pass reads a local window covering 6 and 7. These positions are an example chosen for the calculation.
| Source of keys and values | Positions read by this query |
|---|---|
| Reused first-pass entries | 1, 5, 7 |
| Local second-pass entries | 6, 7 |
The query sees five entries at four positions. If a cache keeps only the latest entry for position 7, the second pass loses access to the earlier representation. This count describes one query’s reads. To budget resident memory you would also need the sizes and lifetimes of the underlying buffers. Compare it with the dense SmolLM2 cache measurement, where every layer stores one key and one value for each allocated batch position.
How can 24 decoder layers execute 72 times?
Thinking Machines Lab released the weights of a separate variable-depth research model on November 20. Its checkpoint, TML-d24-varloop-research, lets you choose how often the middle of the decoder runs. As of 2026-11-25, the public configuration specifies 24 text layers and a default of three passes. You can inspect the execution order with Python’s standard library by downloading just the configuration. [44] [45]
import json
from urllib.request import urlopen
repo = "thinkingmachines/TML-d24-varloop-research"
revision = "91a57fe2b779bbd12c0f74d1f518cbd5b84e8d0d"
url = f"https://huggingface.co/{repo}/resolve/{revision}/config.json"
with urlopen(url, timeout=15) as response:
config = json.load(response)["text_config"]
layers = list(range(config["num_hidden_layers"]))
loop = config["loop_config"]
start, end = loop["core_start"], loop["core_end"]
for passes in (1, loop["num_passes"], 5):
schedule = layers[:start] + layers[start:end] * passes + layers[end:]
print(passes, len(schedule), len(set(schedule)))
The columns are passes, layer executions per token, and distinct decoder layers. The script prints 1 24 24, 3 48 24, and 5 72 24. Layers 0–5 run once, layers 6–17 repeat, and layers 18–23 run once. At five passes the middle block does 60 executions. Reusing its weights still costs memory during decoding. The Transformers implementation gives each extra pass its own cache entries for those 12 layers. [46]
What would a quality comparison at one and five passes tell you? It holds the checkpoint fixed, but training favored three passes. The lab sampled one through five passes in a 1:2:6:2:1 ratio during later midtraining and used three during post-training. A test on the same prompts shows what changing depth buys on this checkpoint. A claim about the best depth to train from scratch needs a separate experiment. [44]
One more token, less KV backing storage
Run the 24-layer schedule in the Inkling2LoopTextModel implementation with small, randomly initialized weights. The 232,704 parameters fit on a CPU. Twenty layers use a four-token attention window and four use full attention. Give the model six tokens, measure its keys and values, then decode a seventh. The code runs the seven-token sequence from scratch as a check on the cached result. [46]
| Passes | Layer calls at prefill | KV payload after six tokens | KV backing storage after six | KV backing storage after seven |
|---|---|---|---|---|
| 1 | 24 | 10.5 KiB | 18 KiB | 13.5 KiB |
| 3 | 48 | 21 KiB | 36 KiB | 27 KiB |
| 5 | 72 | 31.5 KiB | 54 KiB | 40.5 KiB |
Why does storage fall when the sequence grows? Look at one sliding layer. After prefill it keeps the last three keys for the next query. Their 192-byte tensor is a view into a 384-byte allocation holding all six keys. Decoding appends the seventh key to those three. The next three-key view occupies the same 192 logical bytes, now backed by a 256-byte allocation. The four full-attention layers grow with the sequence, but here the savings across the sliding layers outweigh that growth. [47]
You can see the difference with a single key tensor.
import torch
kept = torch.zeros(1, 2, 6, 8, dtype=torch.float32)[:, :, -3:, :]
print(kept.nbytes, kept.untyped_storage().nbytes()) # 192 384
next_key = torch.ones(1, 2, 1, 8, dtype=kept.dtype)
kept = torch.cat([kept, next_key], dim=2)[:, :, -3:, :]
print(kept.nbytes, kept.untyped_storage().nbytes()) # 192 256
Download the CPU experiment (Python) · Inspect the six- and seven-token measurements (JSON)
These are FP32 measurements on the small text model in Transformers 5.24.1, without pretrained weights. The script counts each underlying KV storage allocation once. Convolution state, activations, allocator reservations and process memory need separate measurements. GLM-5.4 uses a different cache design, described above. [43]
GPT-6.2: Documented Interfaces and Undisclosed Internals
As of 2026-11-25. OpenAI released GPT-6.2 Astra and GPT-6.2 Sol on November 17 through its API, ChatGPT Work and Codex. The weights remain undisclosed. [42] Both models accept text or images and return text. The API supports Responses and Chat Completions, with tool calling available through Responses. These interfaces tell us little about the attention layers, expert routing, parameter counts or training mixture. [39] [40] [41]
Both model pages distinguish a 1,050,000-token context window, 922,000 maximum input tokens and 128,000 maximum output tokens. Both reject reasoning effort none [39] [40]. These are useful integration constraints, but they cannot identify an architecture from outside the service. Similarly, subagent delegation is a documented Responses capability, not evidence for a particular arrangement of experts inside the model.
For an agent comparison, record whether a result used a single model call or orchestration, then pin the model ID, reasoning effort, tools, scaffold, context management, retries and grader. A system result cannot isolate a backbone improvement unless those factors are controlled. The practical comparison with GLM-5.4 is therefore about evidence: use the architectural mechanisms a provider actually discloses, and evaluate the complete deployed system where internals remain undisclosed.
Quizzes
Quiz 1: Why would a model designer choose a hybrid attention stack instead of using full self-attention in every layer?
Because full self-attention gives strong token-to-token interaction but becomes expensive at long sequence lengths. A hybrid stack keeps some layers that are good at exact global retrieval while replacing other layers with cheaper mechanisms such as local, linear, or state-space style updates. The goal is to preserve enough expressiveness while reducing cost.
Quiz 2: At two bytes per coordinate, why does a 4,096-token request need more than 4 MiB of MLA cache in one DeepSeek-V3 layer?
The 512 content coordinates account for 4 MiB. The shared 64-coordinate positional key adds 0.5 MiB for the same positions. The resulting 4.5 MiB is the persistent tensor payload under the assumed precision.
Quiz 3: Why do long-context models often introduce stabilizers such as QK-Norm or attention windowing?
As sequence length grows, attention scores and memory use can become harder to control. Stabilizers such as QK-Norm help keep attention values numerically well-behaved during training, while windowing reduces how much context each layer must process at once. Together they make long-context optimization more practical.
Quiz 4: Why is optical context compression not equivalent to simply increasing a model’s text context window?
Increasing the text context window preserves the input as discrete text tokens and asks attention and KV-cache systems to handle more positions. Optical compression changes the representation before the model sees it: text and layout are encoded as vision tokens. This can reduce token count, but it introduces a lossy reconstruction problem, layout sensitivity, and the need to verify exact symbols when precision matters.
Quiz 5: A block of 28 layers runs twice with shared weights. Does that double parameter storage or make the extra computation free?
Neither follows. The block’s main weights can be stored once, while its transformations execute twice; additional gates and state also require accounting. The execution count grows by 28 under the stated assumptions, but full FLOPs, memory and latency require the actual implementation.
Quiz 6: Can a 30B loop ablation or a hosted agent score establish which flagship backbone is better?
The ablation supports a conclusion about its tested model scale, training compute and evaluation setup. A hosted agent score measures the model together with effort, tools and orchestration. Neither supplies an uncontrolled model-to-model comparison or reveals undisclosed internals; use matched system evaluations and keep the evidence boundaries explicit.
References
-
DeepSeek-AI. (2024). DeepSeek-V3 Technical Report. arXiv:2412.19437.
-
Ainslie, J., et al. (2023). GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints. arXiv:2305.13245.
-
Wei, H., Sun, Y., & Li, Y. (2025). DeepSeek-OCR: Contexts Optical Compression. arXiv:2510.18234.
-
MiniMaxAI. (2025). MiniMax-Text-01 model card. Hugging Face.
-
Moonshot AI. (2025). Kimi Linear: An Expressive, Efficient Attention Architecture. Hugging Face.
-
Qwen. (2026). Qwen3.6-35B-A3B model card. Hugging Face.
-
Inclusion AI. (2026). Ling-2.6-flash model card. Hugging Face.
-
Z.ai. (2026). GLM-5.2: From Long Context to Long-Horizon Agents. Z.ai.
-
Z.ai. (2026). GLM-5.2 model card. Hugging Face.
-
Z.ai. (2026). GLM-5.2 configuration. Hugging Face.
-
Moonshot AI. (2026). Kimi K3: A Native Multimodal Agent Model. Kimi.
-
Qwen Team. (2026). Qwen3.7: The Agent Frontier. Alibaba Cloud Community.
-
Alibaba Group. (2026). Alibaba Unveils Qwen3.8-Max-Preview. Alibaba Group.
-
Moonshot AI. (2026). Kimi K3 Open Day: weights, technical report, and infrastructure. Kimi.
-
Qwen Team. (2026). Qwen3.8-2.4T-A95B. Hugging Face model repository.
-
DeepSeek-AI. (2026). DeepSeek-V4.1-Flash model card. Source.
-
DeepSeek-AI. (2026). DeepSeek-V4.1-Flash technical report. Source.
-
Z.ai. (2026). GLM-5.3 developer documentation. Source.
-
Mistral. (2026). Introducing Mistral Large 4. Source.
-
Reflection. (2026). Introducing Beam. Source.
-
Cheng, X., et al. (2026). Conditional Memory via Scalable Lookup. Source.
-
Qwen Team. (2026). Qwen3.8-2.4T-A95B configuration. Source.
-
Reflection. (2026). Beam 1.0 model card. Source.
-
Meta. (2026-10-15). Muse Spark Open release. Source.
-
Meta. (2026-10-12). Muse Wonder release. Source.
-
NVIDIA. (2026). Nemotron 3.5 Super VL model card. Source.
-
NVIDIA. (2026). Nemotron 3.5 Bolt model card. Source.
-
StepFun. (2026). Step 5 Preview model card. Source.
-
DeepSeek. (2026-10-17). DeepSeek V4.1 Flash 1017 model card. Source.
-
Tencent. (2026). Hy-Memory-30B-A3B model card. Source.
-
Mistral Large 4. Model card, verified 2026-11-15. Source.
-
Kimi K3.1 Pro. Model card, verified 2026-11-15. Source.
-
Inkling 2 Small. Model card, verified 2026-11-15. Source.
-
Qwen3.8 Flash Next. Model card, verified 2026-11-15. Source.
-
GLM-5.3 Flash. Model card, verified 2026-11-15. Source.
-
Qwen Team. Qwen4-Max: Your New Teammate Has Arrived. Verified 2026-11-17. Source.
-
Z.ai. (2026-11-23). GLM-5.4: Toward Generalized Coding with Our First Loop Transformer. Verified 2026-11-24. Source.
-
Z.ai. How to Switch Models: GLM-5.4 Coding Plan integration. Verified 2026-11-24. Source.
-
OpenAI. GPT-6.2 Astra model documentation. Verified 2026-11-24. Source.
-
OpenAI. GPT-6.2 Sol model documentation. Verified 2026-11-24. Source.
-
OpenAI. API changelog, November 17, 2026: GPT-6.2. Verified 2026-11-24. Source.
-
Z.ai, GLM-5.4 architecture guide, hybrid KV cache and shared attention indexing. Checked 2026-11-25.
-
Thinking Machines Lab, research model card and training pass distribution.
-
Hugging Face Transformers, decoder passes and cache allocation.