Intelligence Ladders: One Set of Weights, Every Depth a Model

Needle 3 runs on watches, Raspberry Pis and phones. Each device has a different memory budget, so each wants a different model size. Training one model per size means several training runs, several files and a separate fine-tune for each. Needle 3 is one set of weights. Every depth from 2 to 20 layers is a trained model, and all of them run on the same engine. We call this an intelligence ladder.

Blocks and the residual stream

A transformer is a stack of blocks. Needle 3 has twenty, f0,…,f19f_0, \dots, f_{19}. They share one running vector, the residual stream. Block ℓ\ell reads the stream, computes an update, and adds it:

xℓ+1=xℓ+fℓ(xℓ).x_{\ell+1} = x_\ell + f_\ell(x_\ell).

Because each block only adds to the stream, skipping a block means adding nothing, the same fact that stochastic depth and LayerDrop use during training. The stream passes through unchanged and the model is simply shallower. Two questions remain: which blocks to skip, and how to make the shallow models good.

Unroll the recursion and the stream at the top of the stack is a sum,

xL=x0+∑ℓ=0L−1fℓ(xℓ), x_L = x_0 + \sum_{\ell=0}^{L-1} f_\ell(x_\ell),

the embedding of the token plus one displacement per block. A token is a word or a piece of one, the unit the model reads and writes. Its embedding is the list of numbers the model looks up for it before any block has run, and a list of numbers can be pictured as a point, one coordinate per number. Each block nudges that point in Rd\mathbb{R}^{d}, the space of all such points with dd numbers, and the output layer reads wherever the point ends up.

Skipping block ℓ\ell sets its term to zero. The point still arrives at the output layer, in the same space and with the same shape, only with one nudge fewer, and every later block still receives a vector it knows how to read. Whether the later blocks can finish the job from that point is not guaranteed by the arithmetic. It is what the training in the next sections has to make true.

Stochastic depth and LayerDrop, the two methods named above, are training tricks that lean on this. Stochastic depth came from residual networks in vision. On each training step it drops each block with some probability and lets the stream pass through unchanged in its place, so the network learns not to depend on any one block being present. LayerDrop does the same for the layers of a transformer, and its authors found that a network trained this way can have layers removed at inference with limited loss.

The ladder keeps that mechanism, a skipped block passes the stream through unchanged, and changes two things. The blocks that are skipped are not random but chosen by a fixed rule, so depth dd is the same subnetwork at every training step and at inference. And the shallow models are trained as targets in their own right, not only as a way to make the full model robust.

Which blocks make a subnetwork

A subnetwork of depth dd is a set Sd⊆{0,…,19}S_d \subseteq \{0, \dots, 19\} of blocks, run in their original order. The sets must nest, S2⊂S3⊂⋯⊂S20S_2 \subset S_3 \subset \cdots \subset S_{20}, so that one set of weights serves all of them. The chosen blocks must also stay spread through the stack, so that a shallow model sees early and late computation rather than only the first few blocks.

Lay the twenty blocks out as twenty marks on a ruler, and call a subnetwork a choice of marks. Nesting means the choices form a chain. Going from depth dd to depth d+1d+1 adds one mark and never moves or removes one, so the whole ladder is a single ordering of the twenty blocks, and depth dd is its first dd entries.

Spread means the chosen marks should be about evenly spaced at every dd, so the longest unchosen stretch of the ruler should be as short as it can be. The two wants pull against each other. The evenly spaced set of five marks is not in general a subset of the evenly spaced set of seven, so a rule that picked the best set at each depth on its own would not nest.

The rule that satisfies both is to never reconsider a choice and to always put the next mark in the middle of the widest gap. After the two ends come the middle, then roughly the quarters, then roughly the eighths. Each level sits inside the next, the way halving an interval and then halving the halves does.

One rule gives both. Start from the two ends, then repeatedly split the widest gap between chosen blocks at its midpoint:

S2={0, L−1},Sd+1=Sd∪{⌊a+b2⌋},(a,b)=arg⁡max⁡a<b adjacent in Sd(b−a),S_2 = \{0,\ L-1\}, \qquad S_{d+1} = S_d \cup \Big\{\Big\lfloor \tfrac{a+b}{2} \Big\rfloor\Big\}, \quad (a, b) = \arg\max_{\substack{a<b \text{ adjacent in } S_d}} (b - a),

with ties going to the leftmost gap. Each step only adds a block, so the sets nest. Each step halves the largest hole, so the coverage stays balanced.

depth 2the widest gap is between blocks 0 and 19, so its midpoint, block 9, joins next012345678910111213141516171819chosen in order 0 19depth 3the widest gap is between blocks 9 and 19, so its midpoint, block 14, joins next012345678910111213141516171819chosen in order 0 19 9depth 4the widest gap is between blocks 0 and 9, so its midpoint, block 4, joins next012345678910111213141516171819chosen in order 0 19 9 14depth 5the widest gap is between blocks 4 and 9, so its midpoint, block 6, joins next012345678910111213141516171819chosen in order 0 19 9 14 4depth 6the widest gap is between blocks 9 and 14, so its midpoint, block 11, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6depth 7the widest gap is between blocks 14 and 19, so its midpoint, block 16, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11depth 8the widest gap is between blocks 0 and 4, so its midpoint, block 2, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16depth 9the widest gap is between blocks 6 and 9, so its midpoint, block 7, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16 2depth 10the widest gap is between blocks 11 and 14, so its midpoint, block 12, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16 2 7depth 11the widest gap is between blocks 16 and 19, so its midpoint, block 17, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16 2 7 12depth 12the widest gap is between blocks 0 and 2, so its midpoint, block 1, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16 2 7 12 17depth 13the widest gap is between blocks 2 and 4, so its midpoint, block 3, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16 2 7 12 17 1depth 14the widest gap is between blocks 4 and 6, so its midpoint, block 5, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16 2 7 12 17 1 3depth 15the widest gap is between blocks 7 and 9, so its midpoint, block 8, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16 2 7 12 17 1 3 5depth 16the widest gap is between blocks 9 and 11, so its midpoint, block 10, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16 2 7 12 17 1 3 5 8depth 17the widest gap is between blocks 12 and 14, so its midpoint, block 13, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16 2 7 12 17 1 3 5 8 10depth 18the widest gap is between blocks 14 and 16, so its midpoint, block 15, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16 2 7 12 17 1 3 5 8 10 13depth 19the widest gap is between blocks 17 and 19, so its midpoint, block 18, joins next012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16 2 7 12 17 1 3 5 8 10 13 15depth 20every block is chosen, so this is the full 20-layer model012345678910111213141516171819chosen in order 0 19 9 14 4 6 11 16 2 7 12 17 1 3 5 8 10 13 15 18when two gaps are equally wide the leftmost one is splitthe order never changes, so each depth is the depth below it plus one block
How the order is built. Start with the two endpoints, then repeatedly split the widest remaining gap at its midpoint. Twenty blocks give one fixed sequence, and the first d entries of it are subnetwork d.

Twenty blocks give one fixed sequence, 0,19,9,14,4,6,11,16,2,7,12,17,1,3,5,8,10,13,15,180, 19, 9, 14, 4, 6, 11, 16, 2, 7, 12, 17, 1, 3, 5, 8, 10, 13, 15, 18. The subnetwork of depth dd is its first dd entries.

2L · 25M · the two endpoints4L · 29M8L · 52M16L · 98M20L · 121M · the full model
8 of 20 blocks runskipped blocks pass the residual stream through unchanged0111329314455156671081693101711712111318144151916817121820192selection order· engram sites (kept when their block is kept)S8 = {0, 4, 6, 9, 11, 14, 16, 19}
Every subnetwork keeps block 0 and block 19 and fills in the interior by bisection, so each depth is a superset of the one below it. The number above each block is its rank in that order.

Running a subnetwork

With 1[ℓ∈Sd]\mathbb{1}[\ell \in S_d] equal to 1 when block ℓ\ell is in the set and 0 otherwise, the forward pass at depth dd is

xℓ+1=xℓ+1[ℓ∈Sd] fℓ(xℓ),ℓ=0,…,L−1,x_{\ell+1} = x_\ell + \mathbb{1}[\ell \in S_d]\, f_\ell(x_\ell), \qquad \ell = 0, \dots, L-1,

followed by the same final normalisation and the same output layer as the full model.

depth 20 · 20 of 20 blocks run · 100% of the FLOPs, cache and bytesx ← x + f(x) at a kept block · x ← x at a skipped one0+f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14+f15+f16+f17+f18+f19+fnext x = x + (1 if kept, else 0) · f(x) · same blocks, same final norm, same output layera skipped block reads no weights and writes no KV cachedepth 12 · 12 of 20 blocks run · 60% of the FLOPs, cache and bytesx ← x + f(x) at a kept block · x ← x at a skipped one0+f12+f34+f56+f7+f89+f1011+f12+f1314+f1516+f17+f1819+fnext x = x + (1 if kept, else 0) · f(x) · same blocks, same final norm, same output layera skipped block reads no weights and writes no KV cachedepth 8 · 8 of 20 blocks run · 40% of the FLOPs, cache and bytesx ← x + f(x) at a kept block · x ← x at a skipped one0+f1234+f56+f789+f1011+f121314+f1516+f171819+fnext x = x + (1 if kept, else 0) · f(x) · same blocks, same final norm, same output layera skipped block reads no weights and writes no KV cachedepth 4 · 4 of 20 blocks run · 20% of the FLOPs, cache and bytesx ← x + f(x) at a kept block · x ← x at a skipped one0+f123456789+f1011121314+f1516171819+fnext x = x + (1 if kept, else 0) · f(x) · same blocks, same final norm, same output layera skipped block reads no weights and writes no KV cachedepth 2 · 2 of 20 blocks run · 10% of the FLOPs, cache and bytesx ← x + f(x) at a kept block · x ← x at a skipped one0+f12345678910111213141516171819+fnext x = x + (1 if kept, else 0) · f(x) · same blocks, same final norm, same output layera skipped block reads no weights and writes no KV cache
Running a subnetwork. Depth d keeps the first d blocks of the bisection order and skips the rest, and a skipped block is the identity on the residual stream. Depth 8 is exactly an 8-layer model in compute, cache and file size.

Three details make this hold in the real architecture:

The KV cache needs a word. When the model generates text, every block computes a key and a value for each earlier token so that later tokens can attend to them, and it stores those rather than recompute them at every step. That store is the KV cache. Each block keeps its own, so dropping a block drops its share.

Training every depth at once

Adding one loss term per depth to every training step would cost L−1L - 1 forward passes per step. Instead, each step samples one path. With probability 0.80.8 it is the full model and the step is an ordinary language-modelling step. Otherwise a depth dd is drawn uniformly from {2,…,L−1}\{2, \dots, L-1\}, only the blocks in SdS_d run, and the loss is scaled by the fraction of the model that took part:

Lstep={CE(pL)with probability 0.8,d2L[CE(pd)+λ KL(sg⁡[pL] ∥ pd)],d∼U{2,…,L−1}with probability 0.2.\mathcal{L}_{\text{step}} = \begin{cases} \mathrm{CE}(p_L) & \text{with probability } 0.8,\\[4pt] \dfrac{d}{2L}\Big[\mathrm{CE}(p_d) + \lambda\, \mathrm{KL}\big(\operatorname{sg}[p_L]\,\|\,p_d\big)\Big], \quad d \sim \mathcal{U}\{2, \dots, L-1\} & \text{with probability } 0.2. \end{cases}

pdp_d is the next-token distribution at depth dd, CE\mathrm{CE} is cross-entropy against the true next token, and sg⁡\operatorname{sg} is a stop-gradient: the full model's prediction is a fixed target on that step, and no gradient flows into it.

The KL term does most of the work for the shallow depths. Cross-entropy asks a 3-layer subnetwork to predict the next token, which it can barely do, and its gradient is small. The KL term asks it to predict what the whole network predicts. The full model is the teacher, each subnetwork is a student, and because they share every weight, the teacher costs no extra forward pass. This is self-distillation, with λ=1\lambda = 1.

The KL term needs pinning down, because its gradient is what carries the signal just described. KL is the Kullback-Leibler divergence, a number that says how far one probability distribution is from another. Here both distributions are over the vocabulary, the list of every token the model can output. They are the teacher's pLp_L and the student's pdp_d, and the divergence is

KL(pL ∥ pd)=∑tpL(t)log⁡pL(t)pd(t), \mathrm{KL}(p_L \,\|\, p_d) = \sum_{t} p_L(t) \log \frac{p_L(t)}{p_d(t)},

the extra nats the student pays per token when the tokens are really drawn from the teacher's distribution but the student's probabilities are used to code them. A nat is a unit of surprise. A model that gives the true token probability pp is surprised by −log⁡p-\log p nats, so a probability of one costs nothing and a probability of 0.37 costs one nat. The divergence is zero only when the two distributions agree and positive otherwise.

Now the gradient, the one derivative I will make you sit through. The student's logits zz are the raw scores it gives every vocabulary entry before they are turned into probabilities. The softmax is the function that does the turning, pd=softmax(z)p_d = \mathrm{softmax}(z), raising ee to each score and dividing by the total so that the results sum to one. Differentiating the divergence with respect to the scores gives ∂ KL/∂z=pd−pL\partial\,\mathrm{KL} / \partial z = p_d - p_L, one number per vocabulary entry. It pushes the student's probability up wherever the teacher's is higher and down wherever it is lower.

Cross-entropy against the true token is minus the log of the probability the student gave that token, the surprise in nats from above. Its gradient is pd−1t∗p_d - \mathbf{1}_{t^\ast}, the same shape but with a target that is one at the single true token and zero at every other. The teacher's target is a whole spread of plausible next tokens, and a shallow student can move toward that spread even when it cannot reach the single true token. This is the knowledge-distillation argument in its original form, where a small model is trained to match the probabilities of a large one, with the full depth of the same network standing in for the separate large model.

One path per optimizer stepfull model with probability 0.8 · otherwise one depth drawn uniformly from 2..192L10L20L71331795steps →full model, plain losssubnetwork d
A typical stretch of training. A subnetwork step runs only the blocks in S_d, weights its loss by d/L, and, on the paired steps, is pulled toward the full model's predictions by a KL term. Nothing is ever trained twice: the subnetwork shares every weight with the full model.

Each step trains one depth. Averaged over many steps, this gives the same expected loss as training every depth on every step, and it costs one forward pass instead of eighteen.

Written out, the loss the ladder optimises on average is the expectation over the sampling, meaning the average of the per-step loss over which depth the coin picks,

E[Lstep]=0.8 CE(pL)+0.2L−2∑d=2L−1dL[CE(pd)+λ KL(sg[pL] ∥ pd)]. \mathbb{E}\big[\mathcal{L}_{\text{step}}\big] = 0.8\,\mathrm{CE}(p_L) + \frac{0.2}{L-2} \sum_{d=2}^{L-1} \frac{d}{L}\Big[\mathrm{CE}(p_d) + \lambda\,\mathrm{KL}\big(\mathrm{sg}[p_L] \,\|\, p_d\big)\Big].

This is one term per depth with fixed weights, and it is the sum the first paragraph said would cost L−1L-1 forward passes, one pass through the network per depth. Sampling one term per step gets the same gradient on average for the price of one pass.

The factor d/Ld/L inside the sum scales each sampled step by the fraction of the blocks that ran. A depth-3 step moves the shared weights with 3/203/20 of the force of a full step, so a step that trained only a sliver of the network changes it by only a sliver.

The ladder also improves the full model. We trained the same 18-layer architecture twice for 3,000 steps on the same data, once with the ladder and once without. With the ladder the full-depth validation loss was 1.958; without it, 2.037. The ladder model was ahead at every checkpoint, and its 16-layer exit alone matched the control's full 18 layers. Every prefix of the stack has to predict well on its own, so the early blocks cannot leave the work to the later ones, and no single block can become one the model depends on.

validation loss, 18 layers, 3,000 steps2.02.22.42.62.8500100015002000250030001.958 ladder2.037 controlbits per byte by depth, ladder run1.542L0.994L0.858L0.7712L0.6916L0.6618Lsame architecture, data, optimiser and steps; the only difference is the sampled-depth lossdashed line: the control's full 18 layers at 0.686 bits per byte
Left: validation loss during training for the same 18-layer network with and without the ladder. The ladder run is lower at every checkpoint and finishes 3.9% lower. Right: bits per byte of the ladder run at each depth. At 16 layers it scores 0.689, the same as the control at all 18 layers, 0.686.

Two of the words in the table need defining. Validation loss is the loss on text held back from training, in nats per token. A tokenizer is the rule that cuts text into tokens, and two models with different tokenizers have per-token losses that cannot be compared, so the loss is also given per byte of raw text.

The numbers behind the figure. Bits per byte is the validation text loss in a unit that does not depend on the tokenizer; lower is better.

run, 18 layers, 3,000 stepsvalidation loss (nats)bits per byte at 18Lat 16Lat 12Lat 8Lat 4Lat 2L
control, full depth only2.0370.686
ladder from step 01.9580.6600.6890.7690.8550.9911.538
ladder switched on late in training2.0590.6940.7360.8360.9080.9961.675

Two things follow. The ladder costs the full model nothing and gains it 0.079 nats, 3.9% of the loss. And the ladder has to be there from the start: switching it on late gives worse subnetworks at every depth and a slightly worse full model, 1.1% above the control, because the blocks have already specialised around a fixed depth.

What each depth of the ladder-trained model keeps and what it costs, against its own full depth. The parameters kept are the surviving blocks with the engram sites and the confidence rows that belong to them; the embeddings and the final layers are shared by every depth.

depth18L16L12L8L4L2L
parameters kept100%93%80%55%31%24%
bits per byte0.6600.6890.7690.8550.9911.538
loss change+4.4%+16.7%+29.6%+50.3%+133%

Down to 4 layers the loss grows more slowly than the parameters shrink. At 2 layers it more than doubles.

What each depth scores

Every depth from 2 to 20 layers ships in the one Needle 3 file, and needle build --layers picks any of them. We benchmarked four of them on two tool-calling suites, sliced from the same checkpoint and run through the same engine with the confidence gate on.

Tool calling means the model answers a request by writing out a function call, the name of a function and its arguments, which the app then runs. The two suites below are collections of such requests with the right call recorded for each, and a call is scored by exact match, so it counts only when it matches the recorded call exactly. Needle also has a confidence head, a small extra output that says how sure the model is that a call is wanted, and the gate withholds the call when it is not sure. The names in the figures, for readers who have not met them.

namewhat it is
DroidCall200 requests for phone actions, each answered by one or more calls, scored as the exact calls in the right order
Mobile Actions961 requests for a single phone action, scored as the exact call
DeepSeek V4 Flasha large hosted model from DeepSeek, run through its cloud API, used as the comparison line in the second figure
One set of weights, four models025507510011.721.04L29M · 30 MFLOPs/tok36.836.58L52M · 48 MFLOPs/tok80.740.016L98M · 83 MFLOPs/tok86.047.020L121M · 100 MFLOPs/tokMobile ActionsDroidCall
Exact-match accuracy of Needle 3 at the four depths we benchmarked, every one sliced from the same 20-layer weights and run through the same engine with the confidence gate on. Any depth from 2 to 20 can be built the same way. Mobile Actions has 961 rows, DroidCall 200.

The 2-layer subnetwork is absent because at 2 layers the base model's confidence head withholds almost every call, so its gated score is zero, and with calls forced it scores 20.5 on DroidCall. Two layers of a generalist is not a product. Two layers fine-tuned on one product's tools is, which is the next figure.

DroidCall · 200 rows · exact calls in orderMobile Actions · 961 rows · exact call
0255075100DroidCall accuracy (%)60.52L · 25M20.556.54L · 29M34.562.58L · 52M42.568.016L · 98M49.569.020L · 121M52.070.0Needle 3 basefine-tuned on DroidCallDeepSeek V4 Flash
Every subnetwork before and after fine-tuning on the suite, both scored with forced calls, against DeepSeek V4 Flash through its cloud API. Toggle between DroidCall and Mobile Actions.

Fine-tuning lifts every depth by 18 to 36 points on DroidCall, and from 4 layers up the tuned subnetwork passes DeepSeek V4 Flash. The 2-layer model goes from unusable to 56.5. A small network trained on one narrow task reaches frontier accuracy on that task, and the ladder is what lets you choose how small.

Fine-tune once, deploy any depth

Because the subnetworks share weights, one fine-tune is a fine-tune of all of them. The LoRA adapter is trained on the frozen base at the full 20 layers, merged into the weights, then sliced:

θd=slice(θ+BA, Sd),\theta_d = \mathrm{slice}\big(\theta + BA,\ S_d\big),

where BABA is the low-rank update and slice\mathrm{slice} keeps the blocks in SdS_d, the engram tables of their sites, and the rows of the confidence head that belong to them.

LoRA, for readers who have not met it, is a way of fine-tuning a weight matrix by training a small separate update instead of the matrix itself. A matrix is a grid of numbers, and fine-tuning means training an already trained model a little further on one narrow task. For a weight matrix W∈Rm×nW \in \mathbb{R}^{m \times n}, with mm rows and nn columns, the update is written as the product BABA, where B∈Rm×rB \in \mathbb{R}^{m \times r} and A∈Rr×nA \in \mathbb{R}^{r \times n} and rr is small. The product has rank at most rr, meaning it can only move WW along rr independent directions, and only r(m+n)r(m+n) numbers are trained instead of mnmn. That is the saving.

WW itself is frozen. BB starts at zero so the model is unchanged at the first step, and after training the product is added into WW, so the deployed weights are one matrix of the original shape and the adapter costs nothing at inference. In the equation above θ\theta is every weight of the base at all 20 layers, and BABA is the merged update to the matrices the adapter touched. Because the adapter was trained through the full stack on weights the subnetworks share, every subnetwork inherits it when it is sliced out.

A sliced model has its own block numbering, 0 to 15 for a 16-layer slice. Running the bisection rule on that numbering picks a different set of blocks from the parent's, blocks that were never trained together as a subnetwork. Of the 14 depths of a 16-layer slice, 13 differ between the two rules.

a 16-layer slice, cut again to depth 2with the parent's orderthe first 2 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksthe same set, by luck012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 3with the parent's orderthe first 3 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 4with the parent's orderthe first 4 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 5with the parent's orderthe first 5 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 6with the parent's orderthe first 6 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 7with the parent's orderthe first 7 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 8with the parent's orderthe first 8 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 9with the parent's orderthe first 9 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 10with the parent's orderthe first 10 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 11with the parent's orderthe first 11 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 12with the parent's orderthe first 12 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 13with the parent's orderthe first 13 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 14with the parent's orderthe first 14 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rulesa 16-layer slice, cut again to depth 15with the parent's orderthe first 15 of 0 19 9 14 4 6 11 16 …, the blocks that were trained together012345678910111213141516171819with a fresh order on the 16 blocksa different set: blocks that never trained as a unit012345678910111213141516171819faded blocks are not in the 16-layer slice · of its 14 depths, 13 differ between the two rules
The re-slicing trap. A slice has its own block numbering; run the bisection rule on that numbering and you pick blocks that were never trained as a subnetwork. Every slice therefore carries its parent's order, so slicing a slice equals slicing the original.

So every slice carries its parent's selection order, and slicing a slice equals slicing the original. In the Python package:

needle finetune data.jsonl --epochs 10 --out adapter.safetensors
needle build --lora adapter.safetensors --layers 8 --platform linux-arm64 --out ./pi

The same ladder exists along width, where each sampled subnetwork is a depth and a channel prefix of every matrix, as in Matryoshka representations and MatFormer. The shipped Needle 3 exposes depth.

What it costs

At training time, a sampled step is cheaper than a full step, so the ladder adds no wall-clock time per step. The price is that 20% of steps update only part of the model, which the self-distillation term recovers.

At inference time there is no cost. A subnetwork of depth dd is exactly a dd-layer model in operations, in cache and in file size. The blocks are the same bytes at every depth, so file size is a straight line in dd.

One file, and what each depth of it weighssize(d) ≈ 2.75 MB of embeddings and heads + 1.3 MB per block · 2-bit weights10 MB20 MB29 MB52L84L116L138L1610L1912L2114L2416L2618L2920Ldepth 8 is a subset of depth 20, so one file serves every depth
What a depth costs on disk. Every block is the same bytes at every depth, so the size of a subnetwork is a straight line in d: about 8 MB at 4 layers, 29 MB at 20.

A device can hold the full 29 MB file and choose a depth per request, a shallow pass for a simple command and the full stack for a hard one, with no second download. That part is not shipped yet.

The recipe is not specific to tool calling. Whistle, our speech model, is laddered the same way: its decoder trains every depth at once and picks one at load time with --audio-depth, on the same engine and out of the same file.

References

  1. He et al., Deep Residual Learning for Image Recognition, 2015.
  2. Huang et al., Deep Networks with Stochastic Depth, 2016.
  3. Fan et al., Reducing Transformer Depth on Demand with Structured Dropout, 2019.
  4. Hinton et al., Distilling the Knowledge in a Neural Network, 2015.
  5. Kusupati et al., Matryoshka Representation Learning, 2022.
  6. Devvrit et al., MatFormer: Nested Transformer for Elastic Inference, 2023.
  7. Cai et al., Once-for-All: Train One Network and Specialize it for Efficient Deployment, 2019.
  8. Hu et al., LoRA: Low-Rank Adaptation of Large Language Models, 2021.