Skip to content

Four Papers, One Bill: Where LLM Inference Budgets Actually Leak

#llm-inference #hybrid-attention #speculative-decoding #mixture-of-experts #coding-agents

The bill arrives in four places ​

The number I keep coming back to is 8%. Under expert parallelism, even after you apply every load-balancing trick the MoE literature has produced, the least-loaded GPU in a prefill step still sits idle for 8% to 13% of the time waiting on the busiest one. That's not a scheduling bug. That's the router sending uneven token counts and the collective communication forcing everyone to wait for the slowest participant.

That idle window is one leak. There are three others covered in a recent batch of papers, and they all share a structure: something in the serving stack is being computed, loaded, or held in reserve that doesn't need to be.

  • Hybrid attention conversion picks which layers keep full attention using the wrong signal.
  • Looped transformers reload up to R times the KV cache per decode step to chase a speculative speedup.
  • Coding agents send hard problems and trivial problems to the same giant model.
  • MoE serving leaves prefill bubbles empty while fine-tuning jobs queue for the same hardware.

Four teams, four fixes. None of them require a new model architecture or a rewrite of your serving stack. I read all four back to back and the pattern that emerged was less about clever kernels and more about measuring the right thing.

FlashMorph2: stop grading layer choices with the wrong teacher ​

Hybrid attention models mix full attention layers with linear attention layers, and the whole appeal is that a linear layer costs a fraction of a full one. Converting a pretrained Transformer means deciding which layers keep full attention under a fixed budget. FlashMorph did that selection with two shortcuts, and both of them grade the wrong thing.

First shortcut: continuous branch interpolation plus teacher-forced hidden states. The selector scores a soft blend of full and linear branches and feeds it hidden states produced by the original full-attention model. But deployment runs a discrete choice, and once you swap in a linear layer, the hidden states that layer sees come from the layer below it, not from the teacher. The distribution drifts and the score stops predicting reality.

Second shortcut: the weights stay frozen during selection. Selection then assumes recovery fine-tuning won't change which layers matter. It will. A layer that looked redundant at step zero may carry a lot of the load after the model adapts.

FlashMorph2 fixes both by going on-policy. It samples discrete hybrid architectures, runs them end to end with their own hidden states, and jointly optimizes the layer-selection scores and the model weights under the recovery objective. Selection is scored against post-adaptation performance instead of the pre-adaptation approximation.

The gains are real but modest in absolute terms, which is what you'd expect from a selection-quality fix rather than a new architecture.

What changedFlashMorphFlashMorph2
Hidden states used for scoringTeacher-forced from full-attention modelThe sampled hybrid model's own
Layer choiceContinuous interpolation of branchesDiscrete sampled architectures
Weights during selectionFrozenJointly optimized under recovery objective
Selection costNot reported as a blocker0.72 to 3.57 GPU hours across 0.6B to 8B
RULER (avg)baseline+2.42 points
LongBench (avg)baseline+1.08 points
Recall-intensive tasksbaseline+0.76 points

Those deltas come from experiments across Qwen3 model scales and several linear-attention variants, so the +2.42 on RULER isn't a single lucky configuration.

The selection cost is the part I'd actually plan around. Under 4 GPU hours for anything up to 8B parameters means you can rerun the whole selection pipeline in an afternoon on a single node, not a cluster reservation. If you're converting a model family, that's a per-model cost you can eat repeatedly as your recovery recipe changes. No more picking a layer budget once and freezing it because the search was too expensive to revisit.

Quick Take: the cheap win in hybrid attention conversion is not a better linear kernel, it's evaluating the discrete model you'll actually ship instead of a smooth approximation of it.

LoopCache: speculative decoding gets harder when the model loops ​

Looped transformers get depth out of a compact model by applying one weight-shared block R times, with a separate KV cache per loop iteration. Sequential loop execution is slow, so WaveFront Decoding and LoopSpec overlap it: draft at one loop, verify at another, pipeline the whole thing in a single step.

Two things break at long context.

The drafting policy is fixed. WFD drafts only at specific loops and ignores the fact that intermediate loops keep changing their prediction. By the time verification runs, the draft came from a trajectory the model has already abandoned. That's wasted compute on stale guesses.

The memory behavior is worse. Batching tokens from different loops into one step means loading up to R times the KV cache per step. At 128K context on a looped model, KV traffic is already the bottleneck, and multiplying it by R kills the win.

LoopCache goes after both. It ties prediction switches to output confidence, which gives it a cheap signal for when a draft is about to go stale, and refreshes drafts in flight across all intermediate loops instead of only at fixed checkpoints.

For the memory problem it uses a cyclic loop KV cache. Instead of holding every loop's cache live in a step, it rotates through them, restricting per-step KV traffic to a single loop, then batches tokens at the nearest matching cycle so verification stays lossless. It also keeps independent KV caches for a handful of loop-sensitive shallow layers, which raises acceptance rates for almost no extra bandwidth.

The reported numbers are 10.25x average speedup over WFD and 14.56x over LoopSpec. Those are large enough that I'd want to see them reproduced on my own long-context workload before planning around them, but the mechanism is sound: you can't get a speculative win if the speculation is loading R times more memory than the baseline it's trying to beat.

If your decode step was taking 30 seconds on a looped model at long context, 14.56x puts it under 2.1 seconds. That's the difference between a batch job and an interactive tool.

Timeout cascades: the expensive model is solving easy problems ​

The coding agent paper starts from an observation that should make anyone running agent infrastructure uncomfortable. The authors evaluated 36 open-weight models released since 2024 on a software engineering benchmark, and recent small models are closing the accuracy gap on everything except the hard tail. On easy and medium tasks, small models are already close.

The gap is concentrated, not uniform. That's the whole opening. If 80% of your agent traffic is easy and medium, you're paying large-model prices for work a small model handles.

The proposed fix is about as simple as it gets: try the small model first, escalate to the large one only when the attempt fails or runs out of time. That's the timeout cascade. It cuts total GPU-hour cost by up to 33%, and 16.4% across all tasks on SWE-bench Verified, with no accuracy loss.

The striking part is that this hand-rolled cascade nearly matches an oracle-style task router that knows the difficulty in advance. Learned routers, classifier heads, difficulty predictors, all of that machinery buys you roughly what a timeout buys you. The authors' framing is right: this is a deployment path that needs minimal engineering, not a research contribution.

What makes it work in an agent setting specifically is that "failed" is observable. A coding agent produces a patch, and the patch either passes its tests or it doesn't. You don't need a model to tell you the small model blew it. The verification signal is external to the model, which is why the escalation rule can be so dumb and still work.

BubbleTea: filling the idle window with work that reuses loaded weights ​

Back to that 8% to 13%. Colocation systems already try to fill serving idle time with fine-tuning, but existing schedulers make one decision per forward pass for all GPUs. In a MoE model, that decision is wrong at nearly every layer, because the router sends a different token count to each expert and therefore each GPU's bubble has a different size at each layer.

BubbleTea predicts each GPU's bubble at every layer from the router's actual token assignment, then fills it with short chunks of fine-tuning work. The critical constraint is that those chunks reuse the weights already loaded for serving, which is what makes the fill nearly free from a memory-bandwidth standpoint. Compiler passes derive the chunks automatically from the served model as-is, so you don't port each architecture to a separate training engine.

On three MoE models across four A100s, fine-tuning throughput runs 1.9x to 6.2x faster than LLMStation. The latency story matters more for production: p90 inference latency stays within 10% of serving alone in 50 of 63 workloads, against 44 for LLMStation. On bursty traces the gap widens to 3.3x faster than LLMStation and 14x faster than a stock trainer colocated under CUDA MPS, with p90 within 7% of serving alone.

Key numbers

  • 8-13% of prefill time sits in expert-parallel bubbles after load balancing
  • 50 of 63 workloads keep p90 inference latency within 10% of serving alone
  • 6.2x peak fine-tuning throughput over LLMStation
  • 4 A100s, three MoE models, no architecture ports required

The 14x against a CUDA MPS trainer is the number that reframes how I think about colocation. MPS gives you sharing but no awareness of where the holes are. If you're co-scheduling training on serving hardware today with MPS, you are leaving most of the available window empty and eating latency spikes for the privilege.

The pattern behind all four ​

Lay the four side by side and the shared structure is obvious. Each paper found a proxy metric that the field was optimizing instead of the real thing, and then replaced it.

TechniqueWhat's being wastedThe interventionReported gain
FlashMorph2Attention FLOPs on layers that could go linearOn-policy discrete selection with joint recovery+2.42 RULER, +1.08 LongBench, +0.76 recall
LoopCacheKV cache bandwidth across R loopsConfidence-guided drafts plus cyclic KV rotation10.25x vs WFD, 14.56x vs LoopSpec
Timeout cascadeLarge-model compute on easy agent tasksSmall model first, escalate on observable failureUp to 33% GPU-hours, 16.4% on all SWE-bench Verified
BubbleTea8-13% of prefill idle under expert parallelismPer-layer bubble prediction filled with fine-tuning chunks1.9-6.2x fine-tune throughput, p90 within 10%

The proxy for layer selection was a continuous relaxation. The proxy for speculative decoding was a fixed draft schedule. The proxy for model routing was "just use the biggest one." The proxy for colocation was a per-forward-pass scheduling decision. All four proxies were reasonable when they were adopted and all four became the bottleneck.

I don't think that's a coincidence. Inference optimization has spent two years making individual kernels faster, and the remaining wins are increasingly in deciding what work to do at all.

Common Pitfalls ​

These are the failure modes I'd expect teams to hit first, based on how the four systems are built.

Selecting layers with teacher-forced hidden states and assuming recovery will paper over it. This is exactly the mismatch FlashMorph2 was written to fix. If your conversion pipeline scores layers by feeding them a full-attention model's activations, your selection is grading a model you will never run. Either run sampled discrete architectures end to end or accept that your layer budget is a guess.

Batching tokens across loops without measuring KV traffic. The speculative speedup in looped transformers is real, but at long context, per-step KV loads scale with the number of loops you batch. A schedule that looks great at 4K context can lose to sequential execution at 128K. Measure bandwidth, not just tokens per second.

Setting cascade timeouts by wall clock only. A cascade that waits 90 seconds before escalating on a task the small model abandons in 5 has already lost the savings. Escalate on the first failed test, not on the first expired timer, and keep the timer short.

Colocating fine-tuning with one scheduling decision per forward pass. In a MoE model, the bubble size changes at every layer because the router's token distribution changes at every layer. A single per-forward-pass decision fills the average bubble and leaves the per-layer ones empty, which is how you end up with modest throughput and worse p90 latency.

Reusing a serving weight buffer for training chunks that need different precision or optimizer state. The whole reason BubbleTea works is that its chunks reuse loaded weights. The moment a chunk needs a separate copy, master weights, or a different mixed-precision format, you're buying back the memory you just saved and the latency regression comes with it.

One Thing to Remember ​

Every one of these four wins comes from measuring the deployed system instead of a stand-in for it: the discrete hybrid model rather than the interpolated one, the actual KV bytes moved rather than the nominal batch size, the observed test failure rather than a difficulty prediction, the per-layer bubble rather than the per-forward-pass average. If you take a single habit from these papers, make it this one: before you optimize, check that the thing you're measuring is the thing that runs.

The Bottom Line ​

If you're converting a pretrained model to hybrid attention and you've been using a continuous-relaxation selector, budget a few GPU hours for FlashMorph2-style on-policy selection. Under 4 hours for an 8B model is cheap, and the +2.42 RULER points are free quality you're currently leaving on the table.

If you're running a coding agent on a frontier-scale model for all traffic, build the timeout cascade before you build a learned router. A small-model-first policy with test-based escalation captures 16.4% of SWE-bench Verified cost and up to 33% overall, and the oracle comparison says a learned router won't meaningfully beat it.

If you're serving MoE models with any fine-tuning backlog, look at per-layer bubble prediction rather than per-forward-pass colocation. The 8-13% idle window is sitting there today, and the difference between filling it well and filling it badly is a 3x throughput gap at the same p90 latency.