betaFeedback

WorksComputer Science

DAGFormer: Global Topology Prediction for Transformer Cross-Layer Connections

Abstract

We propose DAGFormer, a Transformer language model whose cross-layer connections are planned by a jointly trained topology predictor. Beyond the residual connections in a standard Transformer, DAGFormer adds direct connections from earlier layers to later ones, and the predictor controls the strength of every connection based on input tokens. Unlike existing cross-layer routing architectures, which set each layer's connections separately, DAGFormer plans the routing of the whole model at once. On matched OLMo-2 pairs from 75M to 1B parameters, DAGFormer lowers WikiText-2 perplexity by 17% to 25% over the vanilla Transformer, and a 1B DAGFormer trained on 5B tokens outperforms the vanilla model trained on 10B. Against four routing baselines with the same data and budget, it reaches the lowest perplexity at 75M, 300M and 1B. The gain carries over to 13 commonsense, science, reading and math evaluation tasks (2.0 to 2.5 points higher mean accuracy at 300M and 1B) and to instruction finetuning (63% to 70% AlpacaEval win rate against the vanilla Transformer, leading every routing baseline), and under structured pruning DAGFormer degrades the least in five of six settings.

Introduction

A Transformer (Vaswani et al., 2017) composes its layers through residual connections (He et al., 2016): every attention head and MLP reads the same running sum and writes back into it. Mechanistic analyses describe this residual stream as the communication channel between model components (Elhage et al., 2021). Its bandwidth is shared by every layer, so which earlier computation a layer can read is fixed by design: a late layer sees an early result only inside a sum to which every intermediate layer has added its own.

A line of work relaxes this fixed connectivity. Dense connections (Huang et al., 2017) and depth-weighted averaging with learned static weights (Pagliardini et al., 2024) let a layer read earlier layers’ outputs directly. Hyper-connections (Zhu et al., 2025) widen the residual stream into several streams whose mixing weights are learned and, in the dynamic variant, input-dependent, and mHC (Xie et al., 2026) constrains those mixing matrices so the scheme trains stably at scale. Multiway dynamic dense connections (Xiao et al., 2025) compute input-dependent weights over all earlier layers’ outputs, separately for the query, key, value and residual inputs of a block. Each token can then follow its own path through the layers, and these models reach the loss of Transformers trained with substantially more budget (Zhu et al., 2025; Xiao et al., 2025).

All of the dynamic variants above, however, make the same design choice: routing is local. Each layer carries its own router, which reads the hidden state entering that layer and decides what that layer reads and, in hyper-connections and mHC, where its output is written. The cross-layer routing topology is therefore assembled greedily, one layer at a time, and no module takes a global view of it. Consequently, cross-layer coordination cannot be planned explicitly from the input, and the topology cannot be inspected as an individual object.

In this paper, we propose DAGFormer, where the global routing topology is predicted with a separate module that reads only the input tokens, before the backbone processes each token. DAGFormer implements this idea on an OLMo-2 backbone (Walsh et al., 2025) with added cross-layer connections on attention heads. Instead of reading the running residual stream, each attention head computes its query, key and value from weighted mixtures of the embedding and all earlier layer outputs. The residual input of each layer is also such a mixture. A small causal encoder predicts all of these mixing weights: it reads the same token ids as the backbone, embedded with its own randomly initialized 256-dimensional table rather than the backbone’s embeddings, and is pretrained jointly with the backbone, as shown in Figure 1. Additionally, an auxiliary local refinement, zero-initialized, lets each layer correct the predicted weights of its own heads from its input, so the predictor plans the graph and each layer refines its rows of it.

Figure 1. DAGFormer. For token xtx_t the predictor outputs the planned graph as four triangular matrices A^Q\hat{A}^{Q}, A^K\hat{A}^{K}, A^V\hat{A}^{V} and A^R\hat{A}^{R} that collect the planned weights α^(l)\hat{\alpha}^{(l)} of Eq. (1): one column per earlier output and, per layer, one row per head for QQ, KK and VV (the weights α^q,h,j(l)\hat{\alpha}^{(l)}_{q,h,j}) and a single row for RR (the weights α^r,j(l)\hat{\alpha}^{(l)}_{r,j}). Only the edges into layer 5, its outlined rows, are drawn, as rings on its heads (value in front; key, query and residual behind) with edge width proportional to the magnitude of the entry; every routed layer reads along its own rows in the same way, after the auxiliary local refinement of Eq. (2) (not drawn for demonstration). All weights shown are real values from a trained DAGFormer on training data.

To study this model architecture, we train matched pairs of the standard OLMo-2 Transformer (vanilla Transformer) and DAGFormer from 75M to 1B parameters on Dolma (Soldaini et al., 2024), charging the routing cost in every compute comparison. DAGFormer is better at every size and at equal compute, and a 1B DAGFormer beats the 1B vanilla Transformer trained on twice as many tokens. It also beats four routing baselines trained with the same pipeline at every size but 150M, and the gain carries over to evaluation tasks and instruction finetuning. Ablations show that the shared predictor carries most of the gain, and under structured pruning DAGFormer loses the least of all baselines in five of six settings.

Our contributions are as follows:

  • DAGFormer, a Transformer variant with dynamic cross-layer connections on attention heads, where the connections are predicted from the input tokens by a separate topology predictor which is pretrained together with an OLMo-2 backbone from scratch (§ 2).

  • A matched scaling study from 75M to 1B with the routing cost charged and with Dense-Former, hyper-connection, mHC and MUD-DFormer baselines on the same pipeline, carried through instruction finetuning and instruction-following evaluation (§ 3).

  • Ablations of the routing source and a structured-pruning study showing that the learned topology makes models degrade more gracefully, without re-planning by the predictor (§ 4, § 5 and § 6).

DAGFormer

DAGFormer pairs a Transformer backbone with a small topology predictor that reads the input tokens and predicts a weighted directed acyclic graph assigning every attention head and every layer its sources among the earlier outputs; the backbone computes along this graph (Figure 1). The predictor, a causal encoder over the tokens, plans the graph for the whole depth at once; an auxiliary local refinement, a tiny network at each layer, refines that layer’s planned rows from the layer’s own input.

Setup

Let X0(t)∈RDX_0(t) \in\mathbb{R}^{D} be the embedding of token tt and Xl(t)X_l(t) the output of layer ll in an LL-layer decoder of width DD with HH attention heads; we omit tt when it is clear from context. A vanilla OLMo-2 Transformer layer (Walsh et al., 2025) reads Xl−1X_{l-1} 3H+13H+1 times: head hh forms qh=WqhXl−1q_h = W_q^h X_{l-1}, kh=WkhXl−1k_h = W_k^h X_{l-1} and vh=WvhXl−1v_h = W_v^h X_{l-1}, and the residual Rl=Xl−1R_l = X_{l-1} carries the stream forward, with the update

Xl=Rl+al+ml,al=Norm⁡(Attn⁡l(q,k,v)),ml=Norm⁡(MLP⁡l(Rl+al)).\begin{aligned} X_l &= R_l + a_l + m_l,\\ a_l &= \operatorname{Norm}(\operatorname{Attn}_l(q,k,v)),\\ m_l &= \operatorname{Norm}(\operatorname{MLP}_l(R_l+a_l)). \end{aligned}

All 3H+13H+1 reads see the same vector, and an earlier layer’s output reaches them only inside the sum Xl−1X_{l-1}. DAGFormer instead gives every read of a routed layer (l≥2l \ge2) its own weight on each earlier output X0,…,Xl−1X_0,\ldots,X_{l-1}; the (3H+1)l(3H+1)l weights of layer ll, written α(l)(t)\alpha^{(l)}(t), together over all routed layers make up the graph of token tt, and they fill the four triangular matrices of Figure 1, one row per read and one column per source.

Topology predictor

The input sequence first goes into a small network, called the topology predictor, that generates the connection graph for the backbone LLM. The predictor embeds the tokens with its own token and position embeddings of width 256, encodes them with two causal Transformer layers with four heads, passes each output vector zz through a shared trunk u=GELU⁡(WuLN⁡(z))∈R512u = \operatorname{GELU}(W_u \operatorname{LN}(z)) \in\mathbb{R}^{512}, and ends in one linear head per routed layer, which produces that layer’s adjacency matrix, with rows for the query, key and value reads of every head and for the residual (Figure 1, top):

α^(l)=W(l)u+b(l).(1)\hat{\alpha}^{(l)} = W^{(l)}u + b^{(l)}. \tag*{(1)}

where W(l)∈R(3H+1)l×512W^{(l)} \in\mathbb{R}^{(3H+1)l \times512} and b(l)∈R(3H+1)lb^{(l)} \in\mathbb{R}^{(3H+1)l} are the head’s weight and bias; the (3H+1)l(3H+1)l outputs are reshaped into the matrix. Its entries are signed mixing coefficients: unconstrained real values that, unlike attention probabilities, are not softmax-normalized, so a read can amplify a source or subtract one source from another. W(l)W^{(l)} starts at zero and every row of b(l)b^{(l)} at the one-hot vector that selects Xl−1X_{l-1}. The graph thus depends on the input and changes as the sequence grows during generation.

As an auxiliary component, each layer refines its planned matrix with a local term computed by a tiny network from the layer input Xl−1X_{l-1}:

α(l)=α^(l)+W2(l)GELU⁡(W1(l)LN⁡(Xl−1)),(2)\alpha^{(l)} = \hat{\alpha}^{(l)} + W_2^{(l)}\operatorname{GELU}(W_1^{(l)}\operatorname{LN}(X_{l-1})), \tag*{(2)}

where W1(l)∈R128×DW_1^{(l)} \in\mathbb{R}^{128 \times D} and W2(l)∈R(3H+1)l×128W_2^{(l)} \in\mathbb{R}^{(3H+1)l \times128}, with W2(l)W_2^{(l)} initialized to zero. The refinement lets a layer correct the plan with what the backbone has computed so far, which the predictor, reading only the tokens, cannot see. It acts at the granularity of the plan, one correction per head and read, and it corrects the predicted weights rather than producing them.

Since the encoder is causal, the graph of a token never depends on later tokens, and DAGFormer generates left to right like any decoder. All layers are planned from the same encoding of the sequence, because the trunk is shared; a deeper backbone only adds linear heads. The planned term never sees the backbone and is fixed before the first layer runs, which is what lets § 4 read the graph, average it over inputs, freeze it, and swap it between inputs with the backbone unchanged.

Routed layers

The backbone LLM then runs along this graph. In routed layer ll, each head forms its query, key and value from weighted sums of the earlier outputs, and so does the residual:

qh=∑j<lαq,h,j(l)WqhXj,kh=∑j<lαk,h,j(l)WkhXj,vh=∑j<lαv,h,j(l)WvhXj,Rl=∑j<lαr,j(l)Xj.(3)\begin{aligned} q_h &= \sum_{j<l}\alpha_{q,h,j}^{(l)}W_q^hX_j,\qquad k_h = \sum_{j<l}\alpha_{k,h,j}^{(l)}W_k^hX_j,\\ v_h &= \sum_{j<l}\alpha_{v,h,j}^{(l)}W_v^hX_j,\qquad R_l = \sum_{j<l}\alpha_{r,j}^{(l)}X_j. \tag*{(3)} \end{aligned}

where αq,h,j(l)\alpha_{q,h,j}^{(l)} is the entry of α(l)\alpha^{(l)} in the row of head hh’s query read and the column of source XjX_j, and likewise for kk, vv and rr. Other modules, attention with Q/K normalization on qhq_h and khk_h, the MLP on Rl+alR_l+a_l, and the layer output Xl=Rl+al+mlX_l = R_l + a_l + m_l, remain unchanged from the standard Transformer; at 300M and 1B, DAGFormer also applies an RMSNorm to the mixed values vhv_h (V normalization; Table 15). In practice, each layer runs its fused query, key and value projection once over the stacked sources and then takes the weighted sums of Eq. (3) in head space. Layer 1 has the embedding as its only source and is not routed. At initialization every row of α(l)\alpha^{(l)} selects Xl−1X_{l-1}, so Eq. (3) reduces to the vanilla layer and DAGFormer starts as exactly the vanilla OLMo-2 Transformer, up to the V normalization where enabled; predictor and backbone are then trained jointly from scratch on the language-modeling loss.

size75M150M300M1B
layers / width / heads6 / 512 / 88 / 768 / 1212 / 1024 / 1616 / 2048 / 16
MLP width2048307240968192
backbone params (M)76.6152.6304.11279.4
routing params (M)29.130.032.336.7
steps30006000120009540 (+9540)
tokens (B)1.573.156.295.0 (10.0)
peak LR backbone / predictor5e−45\mathrm{e}{-4} / 3e−43\mathrm{e}{-4}5e−45\mathrm{e}{-4} / 3e−43\mathrm{e}{-4}5e−45\mathrm{e}{-4} / 3e−43\mathrm{e}{-4}4e−44\mathrm{e}{-4} / 2e−42\mathrm{e}{-4}
warmup steps300300300500
DAGFormer V normalization (RMSNorm on mixed vhv_h)nonoyesyes
routed FLOPs / vanilla1.181.331.652.13

Table 15. Pretraining configurations. Common to all: 1024-token sequences, 512 sequences (524K tokens) per step, AdamW (0.9, 0.95), weight decay 0.1, gradient clipping 1.0, linear decay to zero, bf16, tied embeddings, vocabulary 100,352 (the OLMo-2 tokenizer). Predictor: 256-d token and position embeddings, 2 causal encoder layers with 4 heads, trunk width 512, local refinement width 128. The 1B runs were continued from 5B to 10B tokens with the schedule re-stretched and the learning rate re-warmed over 500 steps. Instruction tuning: global batch 64 sequences of 1024 tokens, cosine learning rate 2×10−42 \times10^{-4} (10−410^{-4} at 1B), assistant-only loss, ChatML format. The 1B hyper-connections model was pretrained and instruction-tuned on four H100 GPUs, with 8 sequences per micro-batch in pretraining against 2 for the other 1B models on A100s; the 1B mHC and DenseFormer instruction tuning used 2 sequences per micro-batch instead of 4 to fit in memory. Micro-batching changes neither the global batch nor the sequences in each step.

Experiments

Data

All pretraining uses Dolma v1.7 ((Soldaini et al., 2024)). Three tokenizations were used (a 12B-token slice for the 75M to 600M pairs, a local rebuild of it, and a 21B-token one for the 300M and 1B pairs), so every final checkpoint is re-evaluated on the same held-out sets: WikiText-2 ((Merity et al., 2017)), a held-out slice of MathInstruct ((Yue et al., 2024)), GSM8K solutions ((Cobbe et al., 2021)), and a source-balanced Dolma set drawn from files no training corpus consumed (Appendix § 12). WikiText-2 is the primary metric; the balanced set gives the same orderings with gaps 10% to 25% smaller.

For instruction finetuning we use two datasets: Alpaca ((Taori et al., 2023)) in its cleaned release plus Dolly ((Conover et al., 2023)), about 67K single-turn instructions, and the smol-smoltalk subset of SmolTalk ([1]), about 460K conversations, the mix used to finetune SmolLM2 at 135M and 360M parameters. The held-out instruction data of Table 3 are 1% of Alpaca plus Dolly and the test split of smol-smoltalk.

sizemodel+Alpaca NLL ↓+Alpaca win ↑+SmolTalk NLL ↓+SmolTalk win ↑
300Mvanilla2.392–1.760–
DenseFormer2.3420.551.7220.57
hyper-conn.2.2980.591.6840.58
mHC2.2770.581.6640.62
MUDDFormer2.2560.631.6390.64
DAGFormer2.2030.651.5950.70
1B (5B)vanilla2.208–1.728–
DenseFormer2.1860.461.7060.50
hyper-conn.2.1500.511.6730.56
mHC2.1100.551.6330.61
MUDDFormer2.1040.571.6170.56
DAGFormer2.0420.631.5580.66
1B (10B)vanilla2.120–1.669–
DAGFormer1.9740.661.5160.70

Table 3. Instruction following after finetuning. NLL: held-out negative log-likelihood on the instruction data. Win: AlpacaEval (Li et al., 2023) win rate against the vanilla Transformer of the same size and recipe, both answer orders judged by gpt-5.6-sol, ties half, 249 of the 805 prompts. 1B (5B), 1B (10B): the 1B models pretrained on 5B and 10B tokens.

Setup and baselines

Matched pairs. Every comparison is between a vanilla OLMo-2 Transformer and a DAGFormer with the identical backbone, tokenizer, data order, token budget and optimizer. Sizes are 75M (6 layers, D=512D=512, 8 heads), 150M (8, 768, 12), 300M (12, 1024, 16) and 1B (16, 2048, 16), counting backbone parameters with tied embeddings; routing adds 29M to 37M parameters, 25.7M of them the predictor’s token embedding. Sequences are 1024 tokens, 524K tokens per step (Table 1). The 75M, 150M and 300M runs train for about 21 tokens per parameter, close to the compute-optimal ratio of about 20 implied by Hoffmann et al. (2022); the 1B pair trains for 5B tokens and is continued to 10B with a re-warmed schedule, giving matched pairs at both budgets. Seed 42 fixes initialization and data order; the 300M pair is repeated with a second seed.

sizevanillaDenseFormerhyper-conn.mHCMUDDFormerDAGFormergap to vanilla
75M4.9975.0274.9644.9134.9744.711+0.29
150M4.2684.2464.2204.2094.0414.085+0.18
300M3.8083.7453.6923.6523.6493.544+0.26
1B, 5B tokens3.5693.5133.4923.4383.4233.307+0.26
1B, 10B tokens3.446––––3.219+0.23
75M1.001.011.991.751.401.49
150M1.001.022.111.781.481.61
300M1.001.022.141.741.541.89
1B1.001.011.901.541.361.81

Table 1. Held-out WikiText-2 NLL (nats per token); every model of a row shares recipe, data, token budget and seed. Gap to vanilla: vanilla − DAGFormer. Bottom: measured prefill time per token relative to the vanilla Transformer (a forward pass over 8 sequences of 1024 tokens); training cost in Appendix § 11. Bold: best per row; underlined: second best (not marked at 1B, 10B tokens, with two models). –: not run (the baselines are trained at 5B tokens only due to computing budget limit).

Compute. Projecting the ll sources of layer ll and then mixing them, as in training, adds ∑l≥2(l−1)⋅3D2\sum_{l\ge2}(l-1)\cdot3D^2 multiply-accumulates over the vanilla Transformer’s ∑l(4D2+3DI)\sum_l(4D^2+3DI), plus the mixing sums, the predictor and the local refinements: 1.18× the vanilla Transformer’s FLOPs per token at 75M, rising to 2.13× at 1B; mixing per head before projecting gives the same result at 1.02 to 1.04× but is memory-bound (Appendix § 11.§ 1). Compiled and in the faster order (Table 1, bottom), a DAGFormer token takes 1.5 to 1.9× the vanilla Transformer’s prefill time, the predictor 1 to 3% of it: more than MUDDFormer (1.4 to 1.5×) and, from 300M, mHC (1.5 to 1.8×), less than hyper-connections (1.9 to 2.1×); DenseFormer adds nothing measurable. MUDDFormer and the hyper-connection variants add few FLOPs (MUDDFormer reports 0.4%; (Xiao et al., 2025)), so most of their cost lies outside the FLOP count; none of the implementations uses hand-written kernels, with which mHC reports a 6.7% training-time overhead at four streams ((Xie et al., 2026)). Training costs are in Appendix § 11; compute-matched comparisons charge the analytic training FLOPs of the training order.

Baselines. Besides the matched vanilla Transformer, we train four cross-layer baselines with the recipe, data, tokens and seed of the pair of the same size: DenseFormer (Pagliardini et al., 2024), whose cross-layer weights are static; dynamic hyper-connections with four streams (Zhu et al., 2025); manifold-constrained hyper-connections (mHC; Xie et al., 2026); and MUDDFormer (Xiao et al., 2025), whose per-layer routers read the hidden state. Implementation details, parameter-matched vanilla Transformers and static hyper-connections are in Appendix § 13.§ 2. We do not compare with mixture-of-experts or mixture-of-depths models, which route computation rather than connectivity.

Evaluation tasks. Base models are evaluated with the lm-evaluation-harness (Gao et al., 2024) on twelve tasks (ARC-Easy/Challenge, HellaSwag, PIQA, WinoGrande, OpenBookQA, SciQ, BoolQ, LAMBADA, CommonsenseQA, Social IQa, MathQA; Clark et al., 2018; Zellers et al., 2019; Bisk et al., [5]; Sakaguchi et al., 2020; Mihaylov et al., 2018; Welbl et al., 2017; Clark et al., [7]; Paperno et al., 2016; Talmor et al., 2019; Sap et al., 2019; Amini et al., [2]) and on GSM8K (3-shot exact match with flexible numeric extraction, on the first 200 test problems). The models finetuned on each instruction dataset (Section 3.1; hyperparameters in Appendix § 13.§ 3) are

compared by negative log-likelihood on held-out instruction data and by the AlpacaEval (Li et al., 2023) win rate against the vanilla Transformer of the same size and recipe, judged by gpt-5.6-sol; an MT-Bench comparison (Zheng et al., 2023) is in Appendix § 13.§ 1.

Main results

DAGFormer has the lowest WikiText-2 loss of all baselines at every size but 150M (Table 1). It is 0.18 to 0.29 nats below the vanilla Transformer at every size (17% to 25% lower perplexity) and 0.1 to 0.2 nats below the strongest routing baseline at 75M, 300M and 1B; at 150M MUDDFormer is 0.04 nats lower (§ 6). The gap to the vanilla Transformer opens early in training (Figure 2c) and holds on the other held-out sets, a second corpus and seed, and across learning rates (Appendix § 13.§ 4, Table 13). On the 13 downstream evaluation tasks, DAGFormer has the highest mean accuracy of all models at both sizes we tested (Table 2): 2.0 to 2.5 points above the vanilla Transformer and 0.7 to 0.8 points above the strongest routing baseline. It also leads on the commonsense, science and reading tasks and has the best mean rank at both sizes; on math, where MathQA and GSM8K are close to chance, mHC is 0.1 points ahead. At 1B with 10B tokens, DAGFormer is ahead of the vanilla Transformer on all 13 tasks.

sizemodelcommonsense (5)science (4)reading (2)math (2)Meanmean rank
300Mvanilla39.836.538.111.734.24.15
DenseFormer38.936.540.812.734.44.23
hyper-conn.38.538.538.312.334.43.69
mHC39.238.841.812.935.42.54
MUDDFormer39.738.640.911.535.23.08
DAGFormer39.939.843.512.836.22.38
1B (5B)vanilla40.038.942.112.135.74.54
DenseFormer40.239.543.011.436.04.38
hyper-conn.40.740.741.612.036.43.77
mHC41.142.243.812.537.42.62
MUDDFormer40.742.438.312.236.53.15
DAGFormer41.843.044.712.438.12.08
1B (10B)vanilla40.541.043.011.536.6–
DAGFormer42.444.147.012.839.1–

Table 2. Base models on the evaluation tasks of § 3.2: mean accuracy (%) over the commonsense (HellaSwag, PIQA, WinoGrande, CommonsenseQA, Social IQa), science (ARC-Easy/Challenge, OpenBookQA, SciQ), reading (BoolQ, LAMBADA) and math tasks (MathQA, GSM8K; close to chance at these sizes), and over all 13 (Mean). Mean rank: rank within the block, averaged over the 13 tasks (1 = best). Bold: best per block; underlined: second best per kind of task (neither marked nor ranked in the two-model block). 1B (5B), 1B (10B): pretrained on 5B and 10B tokens. Per-task accuracies in Table 8.

Figure 2. Scaling of DAGFormer (solid) against the matched vanilla OLMo-2 Transformer (dashed). (a) Final WikiText-2 loss against backbone parameters, with power laws whose irreducible loss is shared by the two families (coefficients in the panel); the 1B runs, trained on fewer tokens per parameter, appear only in (b). (b) Loss against training FLOPs with the routing cost included, fitted likewise: the 1B DAGFormer at 5B tokens is below the 1B vanilla Transformer at 10B tokens at about the same compute. (c) Held-out loss along training for the four matched pairs: the gap opens early and persists.

75M, WikiText-2 NLL ↓2.5e-45e-41e-32e-3
vanilla5.8784.9974.6544.563
DAGFormer5.5584.7114.4134.329
gap0.320.290.240.23

Table 13. Learning-rate sweep at 75M (12B’ corpus, 1.58B tokens; the predictor’s learning rate is 0.6× the backbone’s). Both models improve up to the largest rate; the matched-rate gap moves from 0.32 to 0.23 nats and the best-against-best gap is 0.23. The same holds on MathInstruct, GSM8K and the balanced set (best-against-best narrows the 5e-4 gap by 5 to 19%; 30% on the Dolma tail).

We further evaluate the instruction-finetuned models on held-out instruction data and on commonly used instruction-following benchmarks (Table 3). DAGFormer has the lowest negative log-likelihood on held-out instruction data of all models at every size and under both recipes, 0.15 to 0.19 nats below the vanilla Transformer and 0.04 to 0.06 below the strongest routing baseline. On AlpacaEval it wins 0.63 to 0.70 of the comparisons against the vanilla Transformer, above every routing base-

line (0.46 to 0.64). On the 80 MT-Bench first turns, judged pairwise by a second LLM, DAGFormer wins 0.56 to 0.69 of the comparisons against the vanilla Transformer, and the 95% interval excludes 0.5 in seven of ten (Table 10).

SFTDAGFormer vs. vanillawin rate ↑ [CI]W/L
Alpaca300M vs. 300M, seed 10.57 [0.50, 0.64]16/10
Alpaca300M vs. 300M, seed 20.61 [0.54, 0.67]19/8
Alpaca1B@5B vs. 1B@5B0.58 [0.51, 0.66]26/12
Alpaca1B@5B vs. 1B@10B0.56 [0.48, 0.64]23/17
Alpaca1B@10B vs. 1B@10B0.56 [0.48, 0.63]19/14
SmolTalk300M vs. 300M, seed 10.69 [0.63, 0.75]27/2
SmolTalk300M vs. 300M, seed 20.64 [0.57, 0.71]30/5
SmolTalk1B@5B vs. 1B@5B0.59 [0.52, 0.66]23/8
SmolTalk1B@5B vs. 1B@10B0.60 [0.52, 0.67]27/10
SmolTalk1B@10B vs. 1B@10B0.64 [0.57, 0.72]30/9

Table 10. Judged chat quality on the 80 MT-Bench first turns. Win rate of DAGFormer against the vanilla Transformer, judged by Qwen3-Coder-30B-A3B-Instruct (Yang et al., 2025; Qwen Team, 2025) with the MT-Bench pairwise prompts (with the reference answer for math, reasoning and coding), with ties counted as half, averaged over both answer orders, with a 95% bootstrap interval; W/L counts prompts where both orders agree. “Seed 1/2” are two independent instruction-finetuning runs of both models from the same pretrained checkpoints. The judge prefers DAGFormer in every comparison; the interval excludes 0.5 in seven of ten.

Analysis

Scaling with compute and parameters

For each family we fit L=E+AN−αL = E + AN^{-\alpha} to the final WikiText-2 loss against backbone parameters NN and L=E+KC−γL = E + KC^{-\gamma} against training compute CC, routing cost included, with the irreducible loss EE shared by the two families (Figure 2). We share EE because it estimates the entropy of the evaluation text, which does not depend on the architecture. At equal training compute the margin is larger at 300M and 1B than at the smaller sizes: on the vanilla compute fit, the vanilla Transformer needs 1.2 to 1.4× DAGFormer’s training compute to reach its loss at 75M and 150M, and 1.7 to 2.0× at 300M and 1B. DAGFormer’s fitted exponents are also larger (0.56 against 0.48 for parameters, 0.30 against 0.27 for compute), so on the fit the compute multiplier keeps growing (1.9× at 102010^{20} FLOPs and 2.3× at 102110^{21}), although in each fit the two exponents differ by about one standard error and nothing beyond our largest run is tested. Without any fit, the 1B DAGFormer trained on 5B tokens beats the 1B vanilla Transformer trained on 10B tokens at about the same training compute, on WikiText-2, MathInstruct and GSM8K.

Extra parameters explain most of the gain at the smallest size and less than half at the larger one. Vanilla Transformers given DAGFormer’s routing parameters as extra width close 70 to 89% of the gap at 75M but only 4 to 42% at 150M, extra depth closes less, and DAGFormer stays ahead of every control on every held-out set (Table 4).

sizemodelparamsWikiTextMathGSM8Kbalanced
75Mvanilla77M4.9974.2714.2425.167
vanilla, hidden 656107M4.7694.0574.0524.961
vanilla, 13 layers106M4.8714.2154.1745.094
DAGFormer106M4.7113.9843.9734.937
150Mvanilla153M4.2683.5993.6084.471
vanilla, hidden 864182M4.1993.5373.5994.409
DAGFormer183M4.0853.3833.4024.305

Table 4. Capacity controls: vanilla Transformers given DAGFormer’s routing parameters as extra width or, at 75M, as extra depth, trained with the pair’s recipe, data, tokens and seed (12B’ corpus). Params: total, including the predictor and refinement. Math: MathInstruct; balanced: the balanced DoLMA set. Bold: best per size and column.

Where the gain comes from

The predictor carries most of the gain, and the refinement completes it. The routing-source ablation varies only where α\alpha comes from in one 75M backbone (Table 14, Appendix § 13.§ 6). The predictor alone, which never sees a hidden state, recovers about 90% of DAGFormer’s gain over the vanilla Transformer, and adding the refinement gives the best result on every held-out set. Sharing matters: independent per-layer predictors reading the same tokens recover under 80%, with 7M more parameters.

routing source (75M)routing paramsheld-out NLL ↓ ownheld-out NLL ↓ WikiTextheld-out NLL ↓ Mathheld-out NLL ↓ GSM8Ktasks acc. ↑
none (vanilla)04.2136.5935.3735.40425.7
static table, no input5004.1716.5295.2435.279n/a
per-layer predictors35.6M4.0586.2565.0255.14826.0
predictor only28.7M4.0316.2074.9815.11626.2
predictor + refinement29.1M4.0146.1634.9325.08026.5

Table 14. Routing-source ablation: one 75M backbone, granularity and 1.57B tokens of a 1.7B-token Dolma slice, varying only the source of α\alpha. Static table: one learned weight per read and source, no input; per-layer predictors: an encoder over the token ids per layer, nothing shared; predictor + refinement is DAGFormer. Own: the run’s held-out Dolma tail; Math: MathInstruct; tasks acc.: the 13-task mean of Table 2 before instruction finetuning (the static table was not run on the tasks).

The refinement is cheap, under 0.5% of DAGFormer’s forward multiply-accumulates, and unlike the per-layer routers of hyper-connections and MUDDFormer, which produce a layer’s weights on their own, it corrects the predictor’s plan per attention head. DAGFormer’s cost lies instead in projecting every earlier output through each layer’s query, key and value weights before mixing (Appendix § 11), where MUDDFormer mixes the hidden states first and projects once.

Structured pruning

If the benefit is structural, heads that read many earlier layers should lose less when units are removed, without the routers re-planning. We finetune every model of Table 1 up to 300M from its own checkpoint on MathInstruct ((Yue et al., 2024)) and, during finetuning, permanently remove attention heads and MLP channels (two of CoFi’s unit types; (Xia et al., 2022)) by first-order Taylor importance on unit gates ((Michel et al., 2019; Molchanov et al., 2019)) on a gradual cubic schedule ((Zhu and Gupta, 2018)), followed by recovery steps. Routers are never pruned, and we report backbone sparsity.

DAGFormer loses the least of all models in five of the six settings (Table 5). With half the heads and channels removed, it degrades less than the vanilla Transformer and every routing baseline at every size, and remains about as good as or better than the unpruned vanilla Transformer. With 70% removed, it degrades the least at 150M and 300M; at 75M the vanilla Transformer, DenseFormer and both hyper-connection variants lose less, although DAGFormer’s pruned loss is still the lowest. MUDDFormer, the closest dynamic design, loses the most at every size and sparsity.

model75M NLL 0%75M damage (%) 50%75M damage (%) 70%150M NLL 0%150M damage (%) 50%150M damage (%) 70%300M NLL 0%300M damage (%) 50%300M damage (%) 70%
vanilla2.3879.017.91.8549.921.21.6767.417.8
DenseFormer2.3839.518.71.8309.520.71.6417.918.5
hyper-conn.2.3069.519.51.8049.721.41.6047.717.8
mHC2.3289.020.11.8139.521.01.5858.418.4
MUDDFormer2.36210.622.31.69212.828.61.5589.322.0
DAGFormer2.1857.622.21.7249.220.21.5076.916.5

Table 5. Pruning during domain finetuning on MathInstruct, every model of Table 1 from its own checkpoint (75M and 150M: 12B’ corpus; 300M: 21B): held-out NLL of the unpruned finetune (0%) and the damage (loss increase relative to it) at 50% and 70% backbone sparsity. Bold: best per column. All sparsities and the frozen-router controls: Table 23.

No model relies on re-planning its routing: freezing DAGFormer’s predictor, or the baselines’ routers, during pruning barely changes the result (Table 23). The advantage lies in the sources each head can draw on (Appendix § 17); with units removed at random both families lose much more and the gap shrinks at 75M (Appendix § 13.§ 8).

sizemodel0%30%50%70%all routerspredictor only
75Mvanilla2.3872.4752.6022.815––
DenseFormer2.3832.4822.6102.8292.640–
hyper-conn.2.3062.4002.5262.7562.517–
mHC2.3282.4082.5372.7962.549–
MUDDFormer2.3622.4612.6122.8892.618–
DAGFormer2.1852.2582.3502.6692.3712.365
150Mvanilla1.8541.9302.0382.248––
DenseFormer1.8301.9012.0042.2102.004–
hyper-conn.1.8041.8781.9782.1901.981–
mHC1.8131.8831.9862.1951.990–
MUDDFormer1.6921.7901.9082.1761.905–
DAGFormer1.7241.7881.8822.0731.8941.883
300Mvanilla1.6761.7221.7991.975––
DenseFormer1.6411.6901.7711.9451.770–
hyper-conn.1.6041.6511.7271.8891.730–
mHC1.5851.6361.7191.8761.719–
MUDDFormer1.5581.6111.7021.9011.706–
DAGFormer1.5071.5491.6101.7561.6351.613

Table 23. All matched-corpus pruning runs of Table 5: held-out MathInstruct NLL after 2000 finetuning steps of 32K tokens (units removed between steps 200 and 1400, then 600 recovery steps) at 0 to 70% sparsity, and at 50% with every router frozen during finetuning (DenseFormer’s depth weights, the hyper-connection modules, MUDDFormer’s routers, DAGFormer’s predictor and local refinement) or, for DAGFormer, only the predictor. Bold: best per size and column.

Discussion

Token dependence. Most of DAGFormer’s gain lies in the learned graph, a set of cross-layer connections and their weights, rather than in re-planning it for every token: the predictor’s output can be replaced by its per-position mean at almost no cost (Appendix § 14), and the predictor alone recovers about 90% of the gain (§ 4.2). Input dependence, which dynamic cross-layer architectures cite to motivate their routers, matters mostly while the graph is learned: static weights trained directly (DenseFormer, static hyper-connections, an input-free table) recover little of it (Appendix § 13.§ 2). At inference the trained models still rely on the refinement’s per-token corrections, and sparsifying the graph post hoc is costly (Appendix § 15); distilling it into a fixed topology that a dense kernel can execute is future work.

Shared predictor and per-layer routers. A shared predictor beats per-layer predictors that read the same tokens (§ 4.2), and DAGFormer has a lower loss than hyper-connections, mHC and MUDDFormer, whose per-layer routers read the hidden state, at every size but one (MUDDFormer at 150M; one seed per model; Table 1). At this scale, loss separates the two designs only partly. A separate module also makes the graph an object of its own: it can be averaged, frozen and patched, which is how Appendix § 14 locates the gain, and the pruned models degrade more gracefully. Whether the predictor keeps its lead at larger scale, for instance by planning routing that no single layer can see, is untested.

Inspecting the learned graph. The predictor’s output is a natural place to audit or steer an inference pass: it fixes which earlier results each head and layer combine before the backbone runs, and averaging, freezing and patching it are the causal interventions that generative interpretability asks of intermediate checkpoints (Yang, 2026). We read the graph only in aggregate (Appendix § 15); in the trained models the per-token variation lives mostly in the refinement, and whether the graph is meaningful to a human for a given input remains open. A larger predictor-only DAGFormer whose graph varies with the input in nameable ways, such as task or domain, could make the topology such a checkpoint, and routing among specialised modules (begun by the modular variant, Appendix § 18) could make module outputs readable too.

Related work

Cross-layer connectivity. After highway and residual skips ((Srivastava et al., 2015; He et al., 2016)), DenseNet (Huang et al. (2017)) connected every layer to every earlier one, and transparent attention (Bapna et al. [3]), ELMo (Peters et al. (2018)), DenseFormer (Pagliardini et al. (2024)) and LAuReL (Menghani et al. (2025)) learn static weights over layer outputs. Hyper-connections (Zhu et al. (2025)) widen the residual stream into several streams whose connections can depend on the incoming hidden state, and mHC (Xie et al. (2026)) constrains their residual-mixing matrices to be doubly stochastic. MUDDFormer (Xiao et al. (2025)) generates per-position query, key, value and residual weights from each layer’s hidden state; DAGFormer shares this decomposition (per head for qq, kk, vv) but plans the weights of all layers with one predictor over the tokens, which each layer refines per head from its input.

Conditional computation. Conditional computation runs part of a network per input ([4] (Han et al. 2022)): mixture-of-experts layers send each token to a few experts ((Jacobs et al., 1991; Shazeer et al., 2017; Lepikhin et al., 2021; Fedus et al., 2022; Zhou et al., 2022)), adaptive-depth models halt or exit early ((Graves, 2016; Dehghani et al., 2019; Elbayad et al., 2020; Schuster et al., 2022)), and mixture-of-depths lets tokens skip whole blocks (Raposo et al. (2024)). Block-Drop (Wu et al. (2018)), the closest analogue to a planned topology, picks all blocks an image skips with one policy network instead of per-layer gates ((Wang et al., 2018; Veit and Belongie, 2020)). These methods choose how much computation an input receives; DAGFormer keeps it fixed and chooses which earlier results each layer reads.

Conclusion

We introduced DAGFormer, a Transformer whose cross-layer connections are planned by one predictor over the input tokens, trained jointly with the backbone. From 75M to 1B it lowers loss at every size and at equal compute, beats four routing baselines at every size but 150M, carries its gain to evaluation tasks and instruction finetuning, and degrades the least under structured pruning in five of six settings. Most of the gain lies in the learned graph, which the separate predictor makes an object that can be inspected and intervened on.

Limitations

Scale and seeds. Our largest model has 1B parameters trained on 5 to 10B tokens, below its compute-optimal budget. Every pretraining run but the 300M pair is a single seed. Repeating the 300M pair with a second pretraining seed changes a model’s held-out NLL by up to 0.08 nats per token (the vanilla Transformer on GSM8K solutions; at most 0.03 on WikiText-2; Appendix § 13.§ 4), so smaller differences are noise; the pruning cells are single runs too. Cost. Routing costs 1.18 to 2.13×2.13 \times the vanilla Transformer’s FLOPs per token in the order used for training, and the trained models rely on the refinement’s per-token corrections, so they cannot run with a fixed topology without retraining. Comparisons. MUDDFormer trained with our recipe beats DAGFormer at 150M and loses at the other sizes, each a single seed, so loss alone does not settle that comparison; the 1B baselines are trained at 5B tokens only, the parameter-matched vanilla Transformer controls exist at 75M and 150M, and only the 75M pair was swept over learning rates. Evaluation. Models of this size sit near chance on harder benchmarks, and a single LLM judge scored the chat and AlpacaEval comparisons. Interpretability and scale. We intervene on the learned graph only as a whole and read it only in aggregate; whether its input-dependent part can be named, and whether the gains persist beyond 1B parameters, are left to follow-up work.

Acknowledgments

We thank the INVITE Institute at the University of Illinois Urbana-Champaign and the ACCESS program, through the National Center for Supercomputing Applications (NCSA), for their support with computing credits. This material is based upon work supported by the National Science Foundation and the Institute of Education Sciences under Grant #2229612. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of National Science Foundation or the U.S. Department of Education. This work used the Delta system at the National Center for Supercomputing Applications [award OAC 2005572] through allocations CIS251094 and CIS261897 from the Advanced Cyberinfrastructure Coordination Ecosystem: Services & Support (ACCESS) program ([6]), which is supported by U.S. National Science Foundation grants #2138259, #2138286, #2138307, #2137603, and #2138296.

Compute accounting

Forward MACs per token for the vanilla Transformer backbone are ∑l=1L(4D2+3DI)+VD\sum_{l=1}^{L}(4D^2 + 3DI) + VD plus attention over the context (2TD2TD per layer at sequence length TT), with DD the model width, II the MLP width and VV the vocabulary. In the project-then-mix order used in training, DAGFormer adds, at every routed layer l≥2l \ge2, the projection of l−1l-1 extra sources through the fused q,k,vq,k,v weights ((l−1)⋅3D2(l-1)\cdot3D^2), the per-head mixing sums ((l(3D+D))(l(3D + D))), the predictor (embedding lookup, 2 encoder layers of width 256, trunk and per-layer heads) and the local refinement networks (D⋅128+128⋅(3H+1)lD \cdot128 + 128 \cdot(3H+1)l per layer). Training FLOPs are 6× the forward MACs times tokens: the C≈6NC \approx6N per token estimate of Kaplan et al. (2020), a backward pass costs about twice the forward), applied to all the forward MACs above, so the unembedding, attention-context and routing terms that 6N6N leaves out are included. The ratios are 1.18 (75M), 1.33 (150M), 1.65 (300M) and 2.13 (1B); the predictor itself is under 2% of the total, the source projections dominate. Table 6 gives the measured training cost of every model of Table 1: forward and backward passes over 2 sequences of 1024 tokens with bf16 weights, as in pretraining, on one A100-40GB, every model compiled with torch.compile (median of 20 iterations after warm-up, no optimizer step). Every cell, here and in Table 1, is the fastest of two runs; the runs agree within 1% in every cell but one, the 75M vanilla Transformer, timed first in its job (6%). The baselines are measured at random initialization, since the weights do not change the speed. DAGFormer trains at 1.44 to 1.77×\times the vanilla Transformer’s time in the faster of its two orders; under 300M mHC is the slowest to train. Replacing the predictor by a constant table changes DAGFormer’s time by 1 to 3%. At inference DAGFormer keeps every layer’s output for the later layers to mix, so its peak memory for 8 sequences of 1024 tokens is 1.9 vs 1.8 GB (75M) to 9.1 vs 4.2 GB (1B), close to MUDDFormer, which also keeps them (8.7 GB at 1B). Without compilation every routed model is slower, the baselines most (hyper-connections 2.3 to 2.8×\times, mHC 2.3 to 3.2×\times at inference; experiments/scaling/inference_cost.json).

sizevanilla (tok/s)DenseFormerhyper-conn.mHCMUDDFormerDAGFormervanilla (tok/s)
75M108.8K1.021.361.631.171.44851K
150M79.7K1.031.501.661.211.57474K
300M49.1K1.031.591.681.281.77245K
1B18.3K1.031.561.511.191.6576K

Table 6. Measured training cost: time per token of a forward and backward pass relative to the vanilla Transformer of the same size (every model compiled, bf16 weights, 2 sequences of 1024 tokens, one A100-40GB, median of 20 iterations, fastest of two runs; DAGFormer in the faster of its two computation orders), with the vanilla Transformer’s throughput in tokens per second for training and prefill. Prefill ratios are in Table 1.

Two exact computation orders

The qq, kk, vv projections have no bias, so for each head hh the projection of a mixture equals the mixture of projections, Whq∑j<lαq,h,j(l)Xj=∑j<lαq,h,j(l)WhqXjW_h^q \sum_{j<l} \alpha_{q,h,j}^{(l)} X_j = \sum_{j<l} \alpha_{q,h,j}^{(l)} W_h^q X_j (likewise for kk and vv), and DAGFormer can compute a layer’s inputs in either order. Project-then-mix, used in training, runs one fused qq, kk, vv GEMM over the ll stacked sources: (l−1)⋅3D2(l-1) \cdot3D^2 extra MACs at layer ll, at full GEMM efficiency. Mix-then-project first forms one mixture of the ll sources per head for each of qq, kk, vv (3HlD3H l D MACs) and then applies each head’s slice of the projection, so the whole model needs only 1.02 to 1.04×\times the vanilla Transformer’s FLOPs; in exchange it writes and reads 3H3H vectors of width DD per token and layer and runs HH narrow GEMMs instead of one wide one, so it is bound by memory traffic. Per token and layer, the first order spends about D/HD/H extra MACs, the head width, for every value the second order moves: 64 up to 300M and 128 at 1B. Consistent with this, projecting first is faster at inference up to 300M (1.49 vs 1.68×\times the vanilla Transformer at 75M, 1.61 vs 1.77 at 150M, 1.89 vs 1.93 at 300M) and mixing first at 1B (1.81 vs 2.38×\times); in training the two are within 3% up to 300M and mixing first is faster at 1B (1.65 vs 2.17×\times). Both orders give the same logits up to 10−410^{-4} in fp32 at every size (scripts/check_mix_order.py). Table 1 and Table 6 report the faster order per size and measure. The modular variant projects 2l−12l-1 sources per layer and costs 1.33 to 2.30×\times.

Held-out sets

The 21B-token tokenization’s held-out tail is the last windows of its last shard, and the eight tokenization workers each took a contiguous block of Dolma’s source-sorted file list, so that tail is templated instruction and Wikipedia text only; 21B-corpus runs score about 2.2 nats on it while scoring about 3.5 on WikiText-2. The tail is used only to compare runs within that corpus (the 300M three-way and the 1B pairs, where all models see the same training mix). The 1.7B-token slice used by the locality ablation has a similar single-source tail. All cross-corpus numbers in the paper are on WikiText-2, MathInstruct and GSM8K.

Additional tables

This appendix gives the complete results that the body summarizes: every stage of the downstream and chat evaluations, the post-hoc baselines and learning rates, the training hyperparameters, every held-out set for the matched pairs, the routing-source ablation and the static substitution, the earlier pruning study, and the chat evaluation by category.

Downstream and chat per stage

Table 8 gives the per-task accuracies of Table 2, Table 7 every stage of it and Table 10 every chat comparison, including the second instruction-finetuning seed of the 300M pair. Repeating the 300M instruction finetuning with a second seed moves the 12-task mean by at most 0.001 and the routed-minus-vanilla gaps by at most 0.003. Alpaca finetuning leaves the multiple-choice mean within 0.002, SmolTalk lowers it by 0.7 to 1.4 points for every model, and GSM8K bits per byte improve by 0.13 to 0.25 after SmolTalk. Absolute judge scores are about 2 of 10 for every model; judging both orders cancels the judge’s position bias (answer A wins 28 to 42% of verdicts) at the cost of many ties.

modelstageMC acc. ↑bits per byte ↓ GSM8KWikiText
300M, 21B corpus
vanillabase0.3691.4581.128
DAGFormerbase0.3911.3441.057
vanilla+Alpaca0.3711.4521.184
DAGFormer+Alpaca0.3901.2951.108
vanilla+SmolTalk0.3641.2691.309
DAGFormer+SmolTalk0.3771.0971.207
1B, 21B corpus
vanilla 5Bbase0.3851.3751.058
vanilla 10Bbase0.3951.3231.022
DAGFormer 5Bbase0.4111.2420.990
DAGFormer 10Bbase0.4211.2390.963
vanilla 5B+Alpaca0.3851.3481.090
vanilla 10B+Alpaca0.3941.2901.052
DAGFormer 5B+Alpaca0.4101.2001.021
DAGFormer 10B+Alpaca0.4211.1820.993
vanilla 5B+SmolTalk0.3771.2021.150
vanilla 10B+SmolTalk0.3881.1531.106
DAGFormer 5B+SmolTalk0.4021.0381.067
DAGFormer 10B+SmolTalk0.4071.0201.036

Table 7. Downstream evaluation before (base) and after each instruction-finetuning recipe, summarized (Table 9 gives per-task accuracy). MC acc.: mean accuracy over the twelve tasks (eleven multiple-choice and LAMBADA); GSM8K and WikiText: bits per byte on the gold GSM8K solutions and on WikiText (lower is better). One pretraining run per model. Repeating the 300M instruction finetuning with a second seed moves the 12-task mean by at most 0.001 and WikiText bpb by less than 0.001 (BoolQ alone by up to 0.02), and the routed-minus-vanilla gaps reproduce within 0.003, so the instruction-finetuning stage adds little noise; pretraining-seed variance is not measured. Shared-slice 75M and 150M pairs show the same pattern (Appendix § 13).

sizestagemodelARC-eARC-cHSwagPIQAWinoGOBQASciQBoolQLAMBCSQASIQAMathQAGSM8KMean
300Mbasevanilla38.120.627.461.252.224.662.556.719.520.537.722.41.034.2
DenseFormer37.821.227.360.851.122.464.560.820.719.735.922.92.534.4
MUDDFormer38.322.628.560.852.225.068.458.723.019.737.322.01.035.2
DAGFormer38.822.128.261.752.324.473.760.426.519.637.823.12.536.2
+Alpacavanilla37.121.827.760.653.725.659.359.120.820.037.422.62.534.5
DenseFormer38.523.627.460.952.125.660.262.021.920.636.922.10.534.8
MUDDFormer39.623.628.660.151.726.467.159.324.620.138.121.70.535.5
DAGFormer38.023.428.761.952.427.265.661.828.719.538.722.62.036.2
+SmolTalkvanilla36.122.327.658.351.027.657.161.914.219.637.223.52.033.7
DenseFormer37.021.327.859.951.125.259.659.315.520.135.623.60.533.6
MUDDFormer37.122.528.858.848.926.863.660.517.119.837.324.91.534.4
DAGFormer37.523.129.059.852.627.668.252.422.319.737.523.20.534.9
1Bbasevanilla39.722.229.261.651.526.067.560.124.120.537.422.22.035.7
DenseFormer40.621.629.462.850.227.668.260.625.420.937.522.30.536.0
mHC41.423.831.064.551.227.875.659.927.720.138.422.52.537.4
MUDDFormer42.923.230.263.050.927.476.349.327.220.539.023.41.036.5
DAGFormer42.124.032.163.751.026.679.358.930.522.939.322.82.038.1
(5B)+Alpacavanilla40.224.129.461.950.727.063.161.825.518.538.121.91.535.7
DenseFormer40.423.229.761.950.128.064.859.327.519.238.222.72.035.9
mHC41.723.731.263.850.227.668.060.728.920.638.421.72.036.8
MUDDFormer41.725.030.763.950.928.672.159.629.519.639.124.21.537.4
DAGFormer42.024.132.263.350.629.476.456.033.822.440.022.41.538.0
+SmolTalkvanilla38.222.529.362.150.426.660.462.118.820.837.823.71.034.9
DenseFormer38.422.229.661.750.227.264.861.220.118.837.123.31.535.1
mHC40.724.530.762.850.726.466.061.523.520.237.823.92.036.2
MUDDFormer41.724.629.962.652.127.870.256.123.419.138.623.01.536.2
DAGFormer41.122.832.063.450.627.875.261.127.120.638.023.01.537.2
1Bbasevanilla41.523.530.563.850.626.472.659.526.419.038.422.01.036.6
DAGFormer43.424.233.765.151.927.881.060.633.321.539.623.12.539.1
(10B)+Alpacavanilla40.623.930.562.851.0……………………
DAGFormer43.425.534.165.651.328.675.360.337.422.238.822.51.038.9
+SmolTalkvanilla40.022.430.662.550.027.667.059.621.421.538.523.93.536.0
DAGFormer41.823.333.064.351.128.075.461.129.917.939.023.31.537.7

Table 9. The evaluation tasks of Table 2 at every stage: the base models and the same models after each instruction-finetuning recipe. The 13-task mean falls after SmolTalk for every model, vanilla and routed alike, while the same models fit the instruction data better (Table 3) and their bits per byte on the gold GSM8K solutions improve (1.344 to 1.097 for the 300M DAGFormer, 1.242 to 1.038 at 1B): instruction finetuning moves the output distribution away from zero-shot multiple choice, and the loss concentrates in LAMBADA, SciQ and BoolQ. This is why the body compares instruction-finetuned models on instruction following instead. Bold: best per stage.

sizemodelARC-eARC-cHSwagPIQAWinoGOBQASciQBoolQLAMBCSQASIQAMathQAGSM8KMean
300Mvanilla38.120.627.461.252.224.662.556.719.520.537.722.41.034.2
DenseFormer37.821.227.360.851.122.464.560.820.719.735.922.92.534.4
hyper-conn.39.622.527.860.848.625.865.955.021.619.735.821.63.034.4
mHC38.722.927.661.250.026.267.461.322.219.038.023.32.535.4
MUDDFormer38.322.628.560.852.225.068.458.723.019.737.322.01.035.2
DAGFormer38.822.128.261.752.324.473.760.426.519.637.823.12.536.2
1B (5B)vanilla39.722.229.261.651.526.067.560.124.120.537.422.22.035.7
DenseFormer40.621.629.462.850.227.668.260.625.420.937.522.30.536.0
hyper-conn.42.122.729.964.751.525.072.857.226.119.537.822.02.036.4
mHC41.423.831.064.551.227.875.659.927.720.138.422.52.537.4
MUDDFormer42.923.230.263.050.927.476.349.327.220.539.023.41.036.5
DAGFormer42.124.032.163.751.026.679.358.930.522.939.322.82.038.1
1B (10B)vanilla41.523.530.563.850.626.472.659.526.419.038.422.01.036.6
DAGFormer43.424.233.765.151.927.881.060.633.321.539.623.12.539.1

Table 8. Per-task accuracy (%) of the base models in Table 2, normalized for ARC, HellaSwag, PIQA, OpenBookQA and MathQA, GSM8K 3-shot exact match with flexible numeric extraction on the first 200 test problems; Mean: over the 13 tasks. Between the vanilla Transformer and DAGFormer: the baselines of Table 1. Bold: best per block. 1B (5B), 1B (10B): the 1B models pretrained on 5B and 10B tokens.

Post-hoc baselines and learning rates

The hyper-connection baselines use one connection module per attention and MLP sub-layer, as in their papers. Hyper-connections have no official code release (the paper gives PyTorch-style pseudocode), so we use a widely used open implementation2 with the paper’s LayerNorm and initialization; mHC uses DeepSeek’s official PyTorch reference operations3 with the paper’s settings (4 streams, gating factors initialized to 0.01, 20 Sinkhorn-Knopp iterations). Alpaca is used in its cleaned release4.

Training hyperparameters

Table 15 lists the architecture, token budget and optimization of every pretraining run and the instruction-tuning recipe. The routed baselines use the settings of the pair of their size (§ 3.2).

Matched pairs on all held-out sets

Table 16 gives every matched pair on the four held-out sets of § 3.1, including the 75M and 150M pairs on both tokenizations of the 12B-token slice and the 300M pair repeated with a second pretraining seed. DAGFormer has the lower loss in every cell. The second seed changes a model’s loss by up to 0.08 nats (the vanilla Transformer on GSM8K) and by at most 0.03 on WikiText-2.

Gap along training

The vanilla-minus-DAGFormer gap on each run’s own held-out cache at matched steps (nats): 75M (12B’): +0.096 @ 0.26B, +0.178 @ 0.53B, +0.175 @ 0.79B, +0.141 @ 1.32B; 150M (12B’): +0.160 @ 0.53B, +0.114 @ 1.32B, +0.107 @ 2.11B, +0.103 @ 2.91B; 300M (21B): +0.343 @ 1.31B, +0.207 @ 2.88B, +0.167 @ 4.46B, +0.161 @ 6.03B; 1B (21B): +0.197 @ 2.10B, +0.133 @ 4.72B, +0.116 @ 7.34B, +0.110 @ 9.96B. The gap opens within the first quarter of each run, peaks, and narrows slowly; the 1B entry is the 5B-token run.

Router-locality ablation on all metrics

Table 17 extends the routing-source ablation of § 4.2 to every held-out set and to the multiple-choice mean before and after instruction tuning. The four-stream arms keep the same order on every set: the shared predictor with the local refinement (DAGFormer), the shared predictor alone, per-layer predictors, the static table and the vanilla Transformer. At 75M the multiple-choice means of all arms lie within 0.02 of each other.

Shared-slice 75M, 150M and 300M pairs downstream

Table 18 evaluates the pairs of the earlier pruning study (Table 24) on the evaluation tasks before and after instruction tuning. At every size and stage DAGFormer has the higher multiple-choice mean and the lower bits per byte on GSM8K solutions and WikiText.

sizemodel0%30%50%70%at 50%at 70%NLL at 50%
75Mvanilla2.3882.4782.5902.8298.418.5–
DAGFormer2.2232.2982.3912.6147.517.62.388
150Mvanilla1.8831.9572.0712.27810.021.0–
DAGFormer1.7431.8071.8992.0918.920.01.899
300Mvanilla1.6081.6651.7621.9679.622.3–
DAGFormer1.4881.5411.6201.7908.920.3–
150M*vanilla2.0752.1572.2732.5079.520.8–
MUDDFormer1.9352.0372.1532.36611.322.32.150
DAGFormer1.9241.9902.0872.2688.517.92.078

Table 24. The earlier pruning study on the original 12B-slice pairs (75M to 300M) and a 150M comparison with MUDDFormer on a common corpus (150M*): held-out NLL, the performance damage relative to the same model’s unpruned finetune, and the NLL at 50% with the predictor (DAGFormer) or every router (MUDDFormer) frozen. Bold: best per block and column.

Pruning: absolute losses, controls and immediate damage

Table 19 gives the absolute losses behind the earlier pruning study (Table 24, Figure 3), together with two controls, random instead of Taylor importance and whole-block pruning, and the highest loss right after a pruning update, before recovery.

Figure 3. Pruning during domain finetuning on MathInstruct. (a) Held-out NLL relative to the same model’s unpruned finetune with 30/50/70% of heads and MLP channels removed, the original 12B-slice pairs at three sizes: DAGFormer loses less at every budget, more so at higher sparsity. (b) 150M, common corpus: DAGFormer against MUDDFormer and the vanilla Transformer, equal unpruned; DAGFormer ahead by 0.05/0.07/0.10 nats at 30/50/70%; frozen routers (crosses) change neither.

Static substitution on all held-out sets

Table 20 gives the substitutions of Appendix § 14 for every model and held-out set. Replacing the predictor’s output by its per-position mean raises the loss by at most 0.005 nats anywhere, whereas replacing the refinement’s output by its mean costs 0.27 to 0.75 nats.

Judged chat evaluation: categories and scores

Tables 21 and 22 break down the MT-Bench comparison of Table 10 (80 first turns, the same judge): the win rate per category and each model’s single-answer score.

The predictor learns a static graph

What the predictor contributes is one graph per position, not per-token re-routing. Because it is a separate module, we can replace its per-token output by its mean over held-out windows (Table 20). At 300M and 1B the per-position mean costs at most 0.005 nats on WikiText-2 (3.544 vs 3.547; 3.219 vs 3.221 for the 1B at 10B tokens) and a single global mean 0.04 to 0.06, while the same replacement of the refinement’s output costs 0.4 to 0.7 nats, more than the whole gap over the vanilla Transformer. Swapping the predictor’s output between windows (activation patching; Vig et al., 2020; Meng et al., 2022; Zhang and Nanda, 2024) changes the loss by at most 0.007 nats from 75M to 300M (the refinement: 0.56 to 1.29).

modelsetintactpredictor → position meanpredictor → global meanlocal → meanboth → mean
75M (locality arm, both)wikitext26.1646.1616.1626.5826.595
75M (locality arm, both)mathinstruct4.9334.9284.9345.2675.272
75M (locality arm, both)gsm8k5.0805.0755.0765.3535.353
75M (locality arm, both)own4.0094.0124.0384.4654.502
300Mwikitext23.5443.5473.6044.2514.297
300Mmathinstruct2.5652.5562.6003.0653.065
300Mgsm8k2.9372.9032.9613.5503.527
300Mdolma21b2.2222.2232.2612.9202.962
1B, 5B tokwikitext23.3073.3103.3643.9964.027
1B, 5B tokmathinstruct2.4032.4052.4462.9402.959
1B, 5B tokgsm8k2.7552.7602.8113.3883.419
1B, 5B tokdolma21b2.0762.0772.1172.7822.812
1B, 10B tokwikitext23.2193.2213.2813.9163.950
1B, 10B tokmathinstruct2.3212.3222.3662.8492.868
1B, 10B tokgsm8k2.6442.6492.7043.2643.295
1B, 10B tokdolma21b2.0052.0052.0492.7582.791

Table 20. Held-out NLL when one routing channel is replaced by its mean over 128 held-out windows of the model’s own corpus (‘own’ / ‘dolma21b’ is that corpus’s cache). The predictor’s per-token output is replaceable at every size and on every set; the local refinement channel’s is not.

The token input is needed to learn the graph, not to apply it. In the predictor-only arm the per-token output carries 0.03 to 0.08 nats, yet replacing it by its position mean costs only 0.01 to 0.02, so the model routes per-token variation through the refinement when it has one. A table of the same weights trained from scratch with no input recovers only 17 to 23% of the predictor-only arm’s gain over the vanilla Transformer (0.04 of 0.18 nats on the own cache, 0.06 of 0.39 on WikiText-2; Table 14), and DenseFormer’s learned static weights recover as little from 75M to 1B (at most 24%; Table 1). The predictor is thus a parameterization that finds a good static graph, which Appendix § 15 analyses.

The averages and swaps above are interventions on a computation before its output exists, which ties the design to a broader aim. Post-hoc interpretability explains a computation only after it has produced its output, whereas generative interpretability asks that a model’s inference pass expose checkpoints that humans can understand and that can be causally intervened on before the output is committed (Yang, 2026). A predicted topology meets the second requirement by construction, since the backbone depends on it and replacing it is a well-defined intervention; whether it can also be made understandable to humans is a question this design opens.

Topology analysis

Over 128 held-out windows of each model’s own corpus we record the predictor’s and the refinement’s outputs. Averaged over tokens, most mixing mass sits on skip sources rather than the previous layer: the previous layer carries 17 to 61% of the ∣α∣|\alpha| mass for queries, 12 to 45% for keys, only 2 to 24% for values, and 4 to 68% for the residual (300M and 1B), and 2 to 5 sources per head exceed 5% of the head’s largest weight. Per-token spread relative to the mean is 0.05 to 0.19 for the predictor and 0.5 to 1.4 for the refinements. The graph is used densely: zeroing at inference the quarter of hyperconnection entries with the smallest mean ∣α∣|\alpha| (both channels, per-token routing otherwise intact) costs 0.27 nats at 300M and 0.15 to 0.22 at 1B on WikiText-2, half of them costs about 1.8 nats, and removing every skip so that each layer reads only its predecessor raises the loss to 9 to 10 nats; sparsifying the topology for inference would need retraining rather than post-hoc masking.

Pruning: all runs

Table 23 lists every matched-corpus pruning run behind Table 5, and Table 24 the earlier study on the original 12B-slice pairs, which Figure 3 plots.

Why reading many layers may soften pruning

Figure 3 plots the results of Table 24. A head that reads several earlier layers has several routes to the information it needs, so removing one unit removes one route rather than the only one. The frozen-router result is consistent with this reading: the gain needs no re-routing, only the connections that training put in place. The random-pruning control shows its limit, since the advantage shrinks when the removed units are not the least important ones. We have not tested the redundancy hypothesis directly, for instance by counting alternative paths around removed heads.

The modular variant

Figure 4 places the modular variant in the scaling plots of Figure 2. In FourWay routing the sources are layer outputs, so the attention-to-MLP edge inside a layer, the block-to-everything-downstream edges and the final read-out are fixed. A modular variant makes the sources the module outputs (embedding, then each layer’s attention and MLP outputs) and adds a routed MLP input and a routed final read-out, so every intermodular edge is predicted; its routing is 2l−12l-1 sources per layer and costs 1.33× (75M) to 2.30× (300M) the vanilla Transformer’s FLOPs. At 300M on the 21B corpus, FourWay beats modular on every held-out set (WikiText-2 3.544 vs 3.628, Dolma tail 2.221 vs 2.268, MathInstruct 2.565 vs 2.616, GSM8K 2.937 vs 3.093), and the modular compute multiplier is 1.15 at 75M and 0.81 to 0.93 at 150M to 300M (its extra FLOPs are not repaid). Modular routing is better in one setting: whole-block pruning scored by the mass of a module’s routing column, where it beats FourWay’s Taylor-pruned blocks at 150M (2.015 vs 2.044 nats at a third of the blocks removed, 2.130 vs 2.229 at half). We therefore ship FourWay and leave modular routing as an ablation.

Figure 4. The modular variant against DAGFormer (FourWay routing) and the vanilla OLMo-2 Transformer, as in Figure 2a and Figure 2b: (a) final WikiText-2 loss against backbone parameters, (b) against training FLOPs with the routing cost included. On the same corpus, modular routing is 0.03 nats behind FourWay at 75M and 150M and 0.08 behind at 300M, and per FLOP it does not repay its extra cost above 75M.

Artifacts, licenses and compute

Artifacts. Every model uses the OLMo-2 architecture as implemented in Hugging Face Transformers and the OLMo-2 tokenizer ((Walsh et al., 2025)) (Apache 2.0), trained from random initialization; no pretrained weights are used. Pretraining uses Dolma v1.7 (ODC-By; (Soldaini et al., 2024)). Instruction finetuning uses the cleaned Alpaca release (CC BY 4.0 on its dataset card; the original Alpaca data are CC BY-NC 4.0; (Taori et al., 2023)), Dolly (CC BY-SA 3.0; (Conover et al., 2023)) and smol-talk (Apache 2.0; [1]). The held-out sets are WikiText-2 (CC BY-SA 3.0; (Merity et al., 2017)), MathInstruct (MIT; (Yue et al., 2024)), GSM8K (MIT; (Cobbe et al., 2021)) and unused Dolma files, and the evaluation tasks are those of the lm-evaluation-harness ((Gao et al., 2024)), each under its own license. We use every artifact for non-commercial research, which all of these terms allow; all are English text. We collect no new data and rely on Dolma’s own content filtering and deduplication for personal and offensive content.

Risks. The models have at most 1.3B parameters and are research artifacts. Like any language model pretrained on web text, they can generate false, biased or offensive text, and they are not meant for deployment. DAGFormer changes how the layers of a Transformer are connected, not what it is trained on or for, and we see no risk specific to the architecture.

Compute and software. The experiments reported here took about 3,700 GPU-hours, estimated from job records and training logs: about 2,250 on NVIDIA A100 (40GB), 510 on A40, 470 on RTX A5000, 350 on RTX A6000 and 80 on H100 GPUs. Pretraining the matched pairs and the modular variant took about 1,850 of them; the routed baselines, parameter-matched controls, learning-rate sweep and routing-source ablation about 1,200; instruction finetuning about 400; pruning about 110; and evaluation and cost benchmarks about 90. Exploratory runs not reported in the paper are not counted. We used Python 3.10, PyTorch 2.9.0, Transformers 4.57.1, Datasets 3.6.0 and lm-evaluation-harness 0.4.13 with the settings of § 3.2; the MT-Bench judge ran with vLLM 0.30.0, and the AlpacaEval judge through its API.

sizerouted model+Alpaca win rate+Alpaca W/T/L+SmolTalk win rate+SmolTalk W/T/L
300MDAGFormer0.65† [0.60, 0.70]124/69/550.70† [0.65, 0.75]138/69/41
MUDDFormer0.63† [0.58, 0.68]117/78/530.64† [0.59, 0.69]120/73/55
DenseFormer0.55† [0.50, 0.61]91/84/730.57† [0.52, 0.63]101/81/66
hyper-conn.0.59† [0.54, 0.64]109/80/600.58† [0.53, 0.64]106/76/66
mHC0.58† [0.53, 0.63]100/89/600.62† [0.57, 0.67]118/73/57
1B (5B)DAGFormer0.63† [0.58, 0.68]120/71/560.66† [0.61, 0.71]129/66/53
MUDDFormer0.57† [0.52, 0.63]101/79/680.56† [0.50, 0.61]104/71/73
DenseFormer0.46 [0.41, 0.52]75/81/910.50 [0.45, 0.56]86/80/82
mHC0.55 [0.49, 0.60]94/77/760.61† [0.56, 0.66]120/65/64
hyper-conn.0.51 [0.46, 0.57]85/82/800.56† [0.51, 0.61]97/79/72
1B (10B)DAGFormer0.66† [0.61, 0.71]122/79/470.70† [0.65, 0.75]143/57/48
equal computeDAGFormer 5B vs vanilla 10B0.60† [0.55, 0.65]107/75/660.58† [0.53, 0.63]114/61/73

Table 11. Every judged AlpacaEval comparison, with the intervals and counts behind the win rates of Table 3: AlpacaEval (Li et al., 2023) win rate of each routed model against the vanilla Transformer of the same size and recipe, on a stratified 249-prompt subset of the 805 (sampling seed 1234). Every pair is judged in both answer orders by gpt-5.6-sol (2026-10-09); the win rate counts wins plus half the ties, averaged over the two orders and then over prompts, with a 95% bootstrap interval. W/T/L counts a prompt as a win or a loss only when both orders agree, so disagreements become ties. †: the interval excludes 0.5. Last row: DAGFormer trained on 5B tokens against the vanilla Transformer trained on 10B, at about equal compute.

runsizeWikiText-2MathInstructGSM8Kbalanced
vanilla75M4.9974.2714.2425.167
vanilla, hidden 65675M4.7694.0574.0524.961
vanilla, 13 layers75M4.8714.2154.1745.094
DenseFormer75M5.0274.3034.2495.196
hyper-connections (static)75M5.0424.3014.2465.191
hyper-connections (DHC×4)75M4.9644.2024.1575.114
mHC75M4.9134.1964.1435.106
MUDDFormer75M4.9744.2694.1305.166
DAGFormer75M4.7113.9843.9734.937
vanilla150M4.2683.5993.6084.471
vanilla, hidden 864150M4.1993.5373.5994.409
DenseFormer150M4.2463.5813.5794.460
hyper-connections (static)150M4.2473.5953.5874.471
hyper-connections (DHC×4)150M4.2203.5463.6204.426
mHC150M4.2093.5353.5684.421
MUDDFormer150M4.0413.3773.3574.269
DAGFormer150M4.0853.3833.4024.305
vanilla300M3.8082.7423.2323.832
DenseFormer300M3.7452.7143.2493.782
hyper-connections (DHC×4)300M3.6922.6763.1573.734
mHC300M3.6522.6393.1373.706
MUDDFormer300M3.6492.6483.0323.703
DAGFormer300M3.5442.5652.9373.606
vanilla1B, 5B tok.3.5692.5863.0583.617
DenseFormer1B, 5B tok.3.5132.5633.0063.587
hyper-connections (DHC×4)1B, 5B tok.3.4922.5443.0313.551
mHC1B, 5B tok.3.4382.5082.9473.506
MUDDFormer1B, 5B tok.3.4232.4992.8973.501
DAGFormer1B, 5B tok.3.3072.4032.7553.404

Table 12. Post-hoc baselines of Table 1 on every common held-out set (NLL, nats per token). The parameter-matched vanilla Transformers carry DAGFormer’s routing parameters as extra width (hidden 656 and 864; 107M and 182M parameters) or, at 75M, as extra depth (13 layers, 106M); hyper-connections are the static 4-stream variant. All runs of a size share recipe, data, tokens and seed; the 75M and 150M runs use the 12B corpus and the 300M and 1B runs the 21B corpus.

sizecorpusWikiText-2 vanillaWikiText-2 DAGFormerMathInstruct vanillaMathInstruct DAGFormerGSM8K vanillaGSM8K DAGFormerbalanced Dolma vanillabalanced Dolma DAGFormer
75M12B4.9804.7754.2674.0534.2163.9985.1754.992
75M12B′4.9974.7114.2713.9844.2423.9735.1674.937
150M12B4.2974.1003.6303.4243.6263.4654.5144.334
150M12B′4.2684.0853.5993.3833.6083.4024.4714.305
300M21B3.8083.5442.7422.5653.2322.9373.8323.606
300M, seed 221B3.8353.5302.7742.5623.3082.8973.8553.608
1B, 5B tok21B3.5693.3072.5862.4033.0582.7553.6173.404
1B, 10B tok21B3.4463.2192.4832.3212.9002.6443.5013.314

Table 16. Held-out NLL (nats per token) of every matched pair on the four cross-corpus sets (final checkpoints): WikiText-2, MathInstruct, GSM8K and a source-balanced Dolma set (64 windows from each of 14 Dolma sources, drawn from files that no training corpus consumed; books, Wikipedia and open-web-math could not be represented). DAGFormer is lower in every cell; “seed 2” is the 300M pair repeated with a second pretraining seed.

routing sourceown cacheWikiText-2MathInstructGSM8KMC w/o BoolQ base / Alpaca / SmolTalk
none (vanilla)4.2136.5935.3735.4040.269 / 0.278 / 0.293
static learned table (no token input)4.1766.5295.2435.279-
per-layer predictors (unshared)4.0586.2565.0255.1480.271 / 0.290 / 0.304
shared predictor only4.0316.2074.9815.1160.274 / 0.289 / 0.301
shared + local (DAGFormer)4.0146.1634.9325.0800.276 / 0.290 / 0.302
modular variant3.9266.0684.8614.9890.281 / 0.295 / 0.300
modular + sparsity penalty4.0916.2745.1395.2290.273 / 0.286 / 0.300

Table 17. The 75M router-locality arms (1.57B tokens of a 1.7B-token Dolma slice, 4 GPUs each) on every held-out set, and the 11-task multiple-choice mean (without BoolQ, whose majority-class flips move the 12-task mean by up to 20 points at this size) before and after instruction tuning. The modular variant, which also routes the intra-layer edge, is best on loss at 75M; its routing cost is 1.33× the vanilla Transformer here and it is not better than FourWay routing at 150M or 300M (Appendix § 18).

sizemodelstageMC acc. (12)GSM8K acc.GSM8K bpbWikiText bpb
75Mvanillabase0.3040.0101.8401.393
75Mvanilla+Alpaca0.3090.0101.8011.459
75Mvanilla+SmolTalk0.3090.0151.6131.595
75MDAGFormerbase0.3160.0251.7591.347
75MDAGFormer+Alpaca0.3190.0151.7331.417
75MDAGFormer+SmolTalk0.3360.0101.5021.550
150Mvanillabase0.3360.0101.5931.196
150Mvanilla+Alpaca0.3370.0151.5601.260
150Mvanilla+SmolTalk0.3400.0201.3371.399
150MDAGFormerbase0.3610.0051.5191.152
150MDAGFormer+Alpaca0.3660.0051.4911.211
150MDAGFormer+SmolTalk0.3610.0101.2191.333
300Mvanillabase0.3790.0251.4021.065
300Mvanilla+Alpaca0.3670.0251.4031.117
300Mvanilla+SmolTalk0.3680.0151.1451.232
300MDAGFormerbase0.3970.0151.3311.022
300MDAGFormer+Alpaca0.3950.0151.3241.072
300MDAGFormer+SmolTalk0.3930.0101.0551.165

Table 18. The original 12B-slice pairs before and after instruction tuning (the 300M DAGFormer of this slice stopped at 9000 of 12000 steps, so its margin is a lower bound). MC acc.: mean accuracy over the 12 multiple-choice tasks; GSM8K acc.: 3-shot exact match on the first 200 test problems; bpb: bits per byte of the GSM8K solutions and of WikiText.

sizesettingvanillaDAGFormerpeak post-prune vanillapeak post-prune DAGFormer
75Munpruned finetune2.3882.223--
75M30% heads+channels2.4782.2982.7492.578
75M50% heads+channels2.5902.3912.8412.604
75M70% heads+channels2.8292.6143.1992.913
75M50%, random importance3.0292.9354.5134.729
75M33% whole blocks2.6102.5474.7604.377
75M50% whole blocks2.8323.4526.2327.981
150Munpruned finetune1.8831.743--
150M30% heads+channels1.9571.8072.1992.050
150M50% heads+channels2.0711.8992.2862.068
150M70% heads+channels2.2782.0912.5472.317
150M50%, random importance2.2802.1283.2403.590
150M33% whole blocks2.2002.1703.9453.726
150M50% whole blocks2.3802.2455.7077.929
300Munpruned finetune1.6081.488--
300M30% heads+channels1.6651.5411.8881.762
300M50% heads+channels1.7621.6201.9041.772
300M70% heads+channels1.9671.7902.0872.176

Table 19. Final held-out MathInstruct NLL after 2000 finetuning steps for every pruning run of the shared-slice pairs, and the highest NLL observed immediately after a pruning update (before recovery). Whole-block pruning removes entire attention or MLP blocks; the 75M DAGFormer at half the blocks is the one setting where it loses (§ 5). With random unit selection both families lose far more than with Taylor importance and the DAGFormer edge shrinks at 75M.

SFTcomparisonwritingroleplayreasoningmathcodingextractionstemhumanities
Alpaca300M vs. 300M0.720.570.470.400.600.550.750.47
Alpaca300M mod. vs. 300M0.800.530.420.500.500.720.550.68
Alpaca1B@5B vs. 1B@5B0.550.600.420.450.420.620.750.85
Alpaca1B@5B vs. 1B@10B0.420.820.500.280.530.650.530.75
Alpaca1B@10B vs. 1B@10B0.400.750.420.330.650.650.530.75
SmolTalk300M vs. 300M0.820.820.530.800.650.570.600.72
SmolTalk300M mod. vs. 300M0.680.620.350.500.550.570.700.62
SmolTalk1B@5B vs. 1B@5B0.780.620.550.530.420.570.700.53
SmolTalk1B@5B vs. 1B@10B0.820.620.500.380.600.680.650.53
SmolTalk1B@10B vs. 1B@10B0.800.600.780.550.500.650.570.70
Alpaca300M s2 vs. 300M s20.550.470.680.600.600.600.720.62
Alpaca300M mod. s2 vs. 300M s20.900.570.570.530.420.650.700.47
SmolTalk300M s2 vs. 300M s20.780.680.500.680.650.470.500.88
SmolTalk300M mod. s2 vs. 300M s20.530.600.500.780.620.570.500.50

Table 21. Per-category win rate of DAGFormer (10 prompts per category, so ±0.15\pm0.15 is noise). “300M mod.” is the modular variant.

modelmean score (1–10)answer tokensended on end-of-turn
300M vanilla / Alpaca1.911090.74
300M DAGFormer / Alpaca2.151090.72
300M modular / Alpaca1.951140.71
1B vanilla 5B / Alpaca2.061030.74
1B DAGFormer 5B / Alpaca2.141220.75
1B vanilla 10B / Alpaca2.191110.71
1B DAGFormer 10B / Alpaca2.331220.70
300M vanilla / SmolTalk2.122100.34
300M DAGFormer / SmolTalk2.522100.35
300M modular / SmolTalk2.342080.38
1B vanilla 5B / SmolTalk2.062100.34
1B DAGFormer 5B / SmolTalk2.352000.40
1B vanilla 10B / SmolTalk2.122040.38
1B DAGFormer 10B / SmolTalk2.522100.38
300M vanilla seed 2 / Alpaca1.991170.66
300M DAGFormer seed 2 / Alpaca2.141120.71
300M modular seed 2 / Alpaca2.011070.74
300M vanilla seed 2 / SmolTalk2.162110.31
300M DAGFormer seed 2 / SmolTalk2.451990.41
300M modular seed 2 / SmolTalk2.402060.38

Table 22. Single-answer judge scores (MT-Bench single-answer prompt, same judge), mean answer length and the fraction of answers that stopped on the end-of-turn token rather than the 256-token cap. Scores sit near 2 of 10 for every model at this scale; the pairwise win rate is the informative number.

References

  1. [1]Loubna Ben Allal, Anton Lozhkov, Elie Bakouch, Gabriel Martín Blázquez, Guilherme Penedo, Lewis Tunstall, Andrés Marafioti, Agustín Piqueres Lajarín, Hynek Kydlíček, Vaibhav Srivastav, Joshua Lochner, Caleb Fahlgren, Xuan-Shun Nguyen, Ben Burtenshaw, Clémentine Fourrier, Haojun Zhao, Hugo Larcher, Mathieu Morlon, Cyril Zakka, and 3 others. 2025. SmoLM2: When smol goes big — data-centric training of a fully open small language model. In Second Conference on Language Modeling (COLM). ArXiv:2502.02737.arxiv.org/abs/2502.02737
  2. [2]Aida Amini, Saadia Gabriel, Shanchuan Lin, Rik Koncel-Kedziorski, Yejin Choi, and Hannaneh Hajishirzi. 2019. MathQA: Towards interpretable math word problem solving with operation-based formalisms. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (NAACL), pages 2357–2367. ArXiv:1905.13319.arxiv.org/abs/1905.13319
  3. [3]Ankur Bapna, Mia Xu Chen, Orhan Firat, Yuan Cao, and Yonghui Wu. 2018. Training deeper neural machine translation models with transparent attention. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP). ArXiv:1808.07561.arxiv.org/abs/1808.07561
  4. [4]Yoshua Bengio, Nicholas Léonard, and Aaron C. Courville. 2013. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432.arxiv.org/abs/1308.3432
  5. [5]Yonatan Bisk, Rowan Zellers, Ronan Le Bras, Jianfeng Gao, and Yejin Choi. 2020. PIQA: Reasoning about physical commonsense in natural language. In Proceedings of the AAAI Conference on Artificial Intelligence. ArXiv:1911.11641.arxiv.org/abs/1911.11641
  6. [6]Timothy J. Boerner, Stephen Deems, Thomas R. Furlani, Shelley L. Knuth, and John Towns. 2023. ACCESS: Advancing innovation: NSF’s advanced cyberinfrastructure coordination ecosystem: Services & support. In Practice and Experience in Advanced Research Computing (PEARC ’23), pages 173–176. ACM.
  7. [7]Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. 2019. BoolQ: Exploring the surprising difficulty of natural yes/no questions. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (NAACL). ArXiv:1905.10044.arxiv.org/abs/1905.10044

Paper details

vlnc:W_7cdtrh5k
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 7

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents