The paper studies whether an already-strong LLM can keep improving by allocating
more computation to each token while leaving the Transformer backbone fixed.
Hidden Decoding expands each token into multiple hidden streams, supervises only
the final stream, and retains the intermediate streams’ KV cache so their
latent computation remains available to later tokens.
Key Idea
Hidden Decoding scales computation along the sequence-length dimension:
Each input token is expanded into n streams with independent embedding tables.
The expanded length-nL sequence is processed by the same Transformer backbone.
Only the final stream predicts the next token.
Intermediate streams act as latent computation states and keep their own KV cache.
This differs from recurrent-depth or looped Transformers: the extra computation
is a longer sequence in a single forward pass, which fits the pipeline-parallel
training stack used for large MoE models.
To make the expanded sequence trainable at scale, the paper introduces
Stream-Factorized Attention. Most layers attend only within each stream, and
only a subset of layers mix information across streams. This reduces the
attention growth from quadratic in n to roughly linear in n.
Main Results
Frontier-Scale MoE
We train WeLM-HD4-80B and WeLM-HD4-617B with n=4 during continued pretraining.
The matched autoregressive and Hidden Decoding models use the same early
SFT-only post-training recipe, with no reinforcement learning. Active
Transformer parameters per token stay unchanged: 3B for 80B and 23B for 617B.
Benchmark
WeLM 80B
WeLM-HD4 80B
Delta
WeLM 617B
WeLM-HD4 617B
Delta
GPQA Diamond
87.6
88.8
+1.2
89.1
91.2
+2.1
HLE
27.4
28.4
+1.0
33.6
35.4
+1.8
MMMLU
84.4
85.6
+1.2
86.4
87.5
+1.1
FrontierMath
45.8
49.0
+3.2
49.0
51.0
+2.0
PHYBench
69.8
73.8
+4.0
75.3
76.3
+1.0
MathArena Apex
16.4
20.1
+3.7
24.2
24.7
+0.5
HMMT
93.3
94.1
+0.8
96.0
96.2
+0.2
IMO-AnswerBench
85.0
85.3
+0.3
87.5
88.5
+1.0
SciCode
45.8
50.0
+4.2
51.4
52.1
+0.7
The 4x expanded sequence costs 5.1x per batch on WeLM-HD4-80B and
4.4x per batch on WeLM-HD4-617B, close to the 4x linear reference and far
below the 16x dense-attention baseline.
Expansion-Factor Scaling
Increasing the expansion factor improves language modeling loss and downstream
accuracy while keeping the Transformer backbone fixed.
Model / Metric
Base
n=2
n=4
n=8
80B MoE Pile-test BPB (lower is better)
0.386
0.387
0.382
0.378
80B MoE MMLU
85.1
85.0
86.7
87.5
80B MoE BBH
87.5
88.3
90.0
90.6
Qwen3-8B MMLU
79.8
80.9
81.9
82.2
Qwen3-8B BBH
78.8
81.3
83.0
83.9
Qwen3-8B MATH
56.0
58.2
60.0
61.1
Released Demonstration Models
The released HuggingFace checkpoints are not the main models of the paper.
They are Qwen3-8B based demonstration models provided to show that Hidden
Decoding can scale with the expansion factor n: as n increases, the same
Transformer backbone receives more latent computation per token and generally
improves. The main paper results are the WeLM-HD4-80B and WeLM-HD4-617B studies
above.
Base Models
All released base models share the same 8B Transformer backbone. They differ by
the Hidden Decoding expansion factor n.
These released 8B models are included as a public, reproducible demonstration of
expansion-factor scaling. They are not intended to be the paper’s main model
release.
Base Model
Evaluated on Qwen3-8B-Base with
progressive Hidden Decoding scaling:
Benchmark
# Shots
8B Baseline
8B scale n=2
8B scale n=4
8B scale n=8
BBH (EM)
3-shot
78.8
81.3
83.0
83.9
MMLU (EM)
5-shot
79.8
80.9
81.9
82.2
MBPP+ (Pass@1)
1-shot
66.7
69.4
68.7
69.4
MATH (LLM-judge)
4-shot
56.0
58.2
60.0
61.1
ARC-C
25-shot
93.9
94.3
94.4
94.7
HellaSwag
10-shot
79.7
83.1
85.0
85.3
GSM8K
4-shot
92.5
93.3
93.9
94.6
Instruct Model
Instruction-tuned from Hidden-Decoding-8B-n8 and compared with
Qwen3-8B-Instruct plus a matched Qwen3-8B SFT baseline trained on the same data:
Hidden Decoding models process n times longer sequences internally, so
--chunked-prefill-size -1, --attention-backend fa3, and conservative batch
sizes are important for stability and performance. Adjust --tp-size for
multi-GPU setups.
Usage
Chat Completions
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8080/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="default",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain hidden decoding in simple terms."},
],
max_tokens=512,
temperature=0.7,
)
print(response.choices[0].message.content)
Text Completions
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8080/v1", api_key="EMPTY")
response = client.completions.create(
model="default",
prompt="The meaning of life is",
max_tokens=128,
temperature=0,
)
print(response.choices[0].text)
Chat UI
We also provide a lightweight, zero-dependency web chat interface for interactive
testing:
python chat_ui.py
Then open http://localhost:8081 in your browser. The Chat UI connects to
http://localhost:8080/v1 by default.
Streaming responses with real-time token speed display
Thinking/reasoning block visualization
Configurable system prompt, temperature, and max tokens
Pure Python standard library implementation
Patch Contents
The patch adds the qwen3_scale_seq model architecture and modifies the
scheduler, batch manager, and CUDA graph runner to handle expanded sequence
lengths.
Citation
If you find this work useful, please cite:
@article{hidden_decoding_at_scale_2026,
title = {Hidden Decoding at Scale: Latent Computation Scaling for Large Language Models},
author = {WeChat AI Team},
year = {2026},
url = {https://github.com/Tencent/Sequential-Hidden-Decoding/blob/main/paper/hidden_decoding_at_scale.pdf}
}
This project is released under the License Terms of Hidden-Decoding.
The dependent open-source models and software components remain licensed under
their respective original licenses. See LICENSE for details.
Hidden Decoding at Scale
Latent Computation Scaling for Large Language Models
WeChat AI Team, Tencent
Same Transformer backbone, more latent computation per token.
This repository hosts the Hidden Decoding paper, public demonstration checkpoints, and inference patch.
Updates
n=2,n=4,n=8) and SGLang inference patch.Paper
Hidden Decoding at Scale: Latent Computation Scaling for Large Language Models
The paper studies whether an already-strong LLM can keep improving by allocating more computation to each token while leaving the Transformer backbone fixed. Hidden Decoding expands each token into multiple hidden streams, supervises only the final stream, and retains the intermediate streams’ KV cache so their latent computation remains available to later tokens.
Key Idea
Hidden Decoding scales computation along the sequence-length dimension:
nstreams with independent embedding tables.nLsequence is processed by the same Transformer backbone.This differs from recurrent-depth or looped Transformers: the extra computation is a longer sequence in a single forward pass, which fits the pipeline-parallel training stack used for large MoE models.
To make the expanded sequence trainable at scale, the paper introduces Stream-Factorized Attention. Most layers attend only within each stream, and only a subset of layers mix information across streams. This reduces the attention growth from quadratic in
nto roughly linear inn.Main Results
Frontier-Scale MoE
We train WeLM-HD4-80B and WeLM-HD4-617B with
n=4during continued pretraining. The matched autoregressive and Hidden Decoding models use the same early SFT-only post-training recipe, with no reinforcement learning. Active Transformer parameters per token stay unchanged: 3B for 80B and 23B for 617B.The
4xexpanded sequence costs 5.1x per batch on WeLM-HD4-80B and 4.4x per batch on WeLM-HD4-617B, close to the4xlinear reference and far below the16xdense-attention baseline.Expansion-Factor Scaling
Increasing the expansion factor improves language modeling loss and downstream accuracy while keeping the Transformer backbone fixed.
n=2n=4n=8Released Demonstration Models
The released HuggingFace checkpoints are not the main models of the paper. They are Qwen3-8B based demonstration models provided to show that Hidden Decoding can scale with the expansion factor
n: asnincreases, the same Transformer backbone receives more latent computation per token and generally improves. The main paper results are the WeLM-HD4-80B and WeLM-HD4-617B studies above.Base Models
All released base models share the same 8B Transformer backbone. They differ by the Hidden Decoding expansion factor
n.Instruct Model
Qwen3-8B Results
These released 8B models are included as a public, reproducible demonstration of expansion-factor scaling. They are not intended to be the paper’s main model release.
Base Model
Evaluated on Qwen3-8B-Base with progressive Hidden Decoding scaling:
n=2n=4n=8Instruct Model
Instruction-tuned from Hidden-Decoding-8B-n8 and compared with Qwen3-8B-Instruct plus a matched Qwen3-8B SFT baseline trained on the same data:
n=8SFTSampling:
temperature=0.7,top_p=0.8,top_k=20,presence_penalty=1.5,max_tokens=4096. Judge: GPT-4o.Installation (Inference)
Option 1: Docker Image
Option 2: Use the Forked SGLang
Option 3: Apply Patch Manually
Apply the patch on top of SGLang:
Serving
Launch the server:
Docker
Hidden Decoding models process
ntimes longer sequences internally, so--chunked-prefill-size -1,--attention-backend fa3, and conservative batch sizes are important for stability and performance. Adjust--tp-sizefor multi-GPU setups.Usage
Chat Completions
Text Completions
Chat UI
We also provide a lightweight, zero-dependency web chat interface for interactive testing:
Then open
http://localhost:8081in your browser. The Chat UI connects tohttp://localhost:8080/v1by default.Docker (serve model + Chat UI together)
Features:
Patch Contents
The patch adds the
qwen3_scale_seqmodel architecture and modifies the scheduler, batch manager, and CUDA graph runner to handle expanded sequence lengths.Citation
If you find this work useful, please cite:
Contact
Sijun Zhang (nepheloturbulence@gmail.com), Aiwei Liu (liuaiwei20@gmail.com)
License
This project is released under the License Terms of Hidden-Decoding. The dependent open-source models and software components remain licensed under their respective original licenses. See LICENSE for details.