Explore the research collection
5 entries · Follow this search
- Paper
TokenGate: Adapting LLMs for Fast and Memory-Efficient Prefill with Learned Token Pruning
Problem: a transformer processes every input token through every layer, so long-context prefill (quadratic attention, linear MLP + KV growth) dominates serving cost. Prior work splits into training-free token-pruning heuristics (attention-score based; limited speedup before accuracy degrades) and architectural conditional compute (needs pretraining from scratch). TokenGate instead retrofits a trained model. Mechanism: a gate module sits inside one layer L (L=1 in the main experiments; multiple gates generalize). A small scoring MLP reads each prunable token's normalized post-attention residual at layer L and emits a scalar, RMS-normalized across the sequence into an importance score b_j; a top-K selector forwards S = top-K prunable tokens ∪ the non-prunable set (instructions, the question, answer/decoded tokens — in the code API, everything outside a marked {state} document span). Pruned tokens' residual streams stop at L: layers above L never process them and never generate KV entries for them, so the method is both prefill-compute skipping and upper-layer KV-cache reduction (layers ≤ L keep full KV by default; pruning those too is optional). The trainability trick is token-gated attention: in layers above the gate, each kept key's attention logit gets an additive bias softplus(γ^{ℓh})·b_j (head-wise learnable gains), under a temperature τ scaled by log(kept rank)/log(original position) (SSMax-inspired) that recalibrates softmax sharpness after pruning and generalizes across budgets — this gives gradients through the non-differentiable top-K, the same way MoE routers learn. Implemented as a FlashAttention-based kernel (custom FA2 key-bias kernel in the repo; FlexAttention fallback). Training: NOT from scratch and no sparsity/auxiliary loss — LoRA co-adaptation (r=16, α=32 on Q/V projections; backbone otherwise frozen; Muon for the gate matrices) plus gate parameters, plain next-token CE. Each step averages a full-context loss (K = all prunable tokens; anchors full-context accuracy and gives pruned tokens gradient) with a pruned loss at K ~ LogUniform(1, |𝒫|/2), so one trained gate serves every budget K at inference; the scoring MLP is zero-initialized. Training contexts 2k–16k tokens; a step costs 1.3× standard SFT but converges in fewer steps on 4 of 5 tasks, so total training time is comparable to or below LoRA SFT (mean 0.8× A100-hours at 1.7B). Results (Qwen3-1.7B, five tasks — NIAH 16k, RepoBench-P mean 11k/max 39k, 2WikiMultihopQA mean 7.5k, MultiNews, BioDEX): Pareto-dominant on all five; TTFT 1.4–11.3× faster and peak prefill memory 1.5–3.4× lower at no accuracy degradation vs the LoRA-fine-tuned full-context model, and up to 6.4× faster / ~2× lower memory than the best prior pruning baseline at matched accuracy (baselines: FastKV, SlimInfer, DASH, GemFilter; sparse-attention FlexPrefill, MInference). Launch-figure numbers at matched accuracy: NIAH TTFT 425→37 ms (11.3×; best prior 235 ms), peak memory 2.4→0.7 GB (3.4×); RepoBench TTFT 286→72 ms (3.9×; best prior 201 ms), memory 1.6→0.6 GB (2.8×). A more typical operating point: 2WikiMultihopQA at 95% of full-context accuracy = 3.0× faster, 2.7× less memory. Extrapolation: a gate trained at 16k holds accuracy at 32k/64k/128k with TTFT speedup rising to ~13× (memory reduction flat ~3.43×, since peak memory is dominated by the below-gate full forward). Ablations: the learned selector beats random-K and FastKV's attention-score selector at the same layer by wide margins; co-adaptation independently helps (random-K on the TokenGate-trained model beats random-K on the plain fine-tuned model — training redistributes information into kept tokens); learned keep-patterns are task-dependent (answer keywords for QA, phrase-final stopwords for summarization). Repo's held-out test table (batch 1, one H100): NIAH-16k @K=2000 accuracy 1.000 vs raw base 0.993 at 6.3× TTFT, still 1.000 at K=100 (8.1×); a 32k haystack demo answers the needle with 144 of 32,191 tokens retained above the gate. Hybrid architectures: on Qwen3.5-2B (24 layers; full attention at layers 3,7,11,…,23, Gated DeltaNet elsewhere) TokenGate can sit inside DeltaNet layers 1–2 — where attention-heuristic pruners cannot operate at all (FastKV can only prune at full-attention layers) — reaching up to 7.8× faster prefill within 6% of standard accuracy; at layer 3 it gives 3.8× lower TTFT at no accuracy loss, 2.1× better than the best FastKV run; token-gated attention applies only in full-attention layers above the gate, and DeltaNet layers above run on kept tokens only, their recurrent state built from kept tokens. Decoding (appendix): generated tokens attend to kept + generated tokens in layers above the gate, full context at/below it, with the gate bias precomputed once at prefill as a constant per-key bias — all headline claims are prefill/TTFT claims, no decode-speed claim. NOT GateSkip: the OpenReview/ICLR-2026 GateSkip paper ("What Layers When," Laitenberger et al., HU Berlin/UvA/UT Nuremberg, arXiv 2510.13876) is a different work by different authors — residual gates for token-wise layer skipping (15–50% FLOP savings), uncited here.
- Paper
Scaling Discovery Requires Forgetting
LLM-agent discovery plateaus because agents accumulate history: each agent becomes anchored to its own past attempts, making fewer and smaller edits, so more budget buys little. The paper's fix is forgetting: periodically discard every agent's session (messages, tool calls, errors) and the entire candidate history, keep only the highest-scoring artifact, and restart all agents from it with empty context. On a team of four agents with result-sharing (3 forgets → 4 budget-equal rounds), this Periodic Amnesia Search yields up to 15% over independent parallel agents and 39% over a single agent at matched token cost. Measured mechanism: edit distance between successive code artifacts decays exponentially as context grows and diff token entropy collapses — the model mimics recent turns instead of sampling its prior; before the first reset median edits shrink ~150→30 lines and thinking tokens ~28k→7k, and after forgetting agents resume larger edits and more reasoning tokens per proposal. Evaluated on four discovery tasks (AHC014 heuristic programming, a Frontier-CS optimization problem, Anthropic's kernel challenge on a simulated VLIW SIMD machine, a five-minute nanochat LM training run), all with the Pi agent + DeepSeek V4.1 Flash ($20 budget/replicate), 3 replicates each; Frontier-CS Q171 breaks the plateau pattern (parallel agents keep improving) yet the forgetting team still finishes 15% higher; on AHC014 the forgetting team reached mean best score 1,103K vs 964K parallel vs 795K single (best-replicate trajectories 1,144,695 / 1,007,073 / 961,136 — not the means). Stalled runs that forgot gained 4.5–9.2% over the next 30 proposals vs <2% for continuing runs at up to 2× cost (equal-proposal comparison, not equal-dollar/equal-time; AHC014 team-of-4 panel: 9.2% ± 6.9% at $15.32 vs 1.4% ± 1.3% at $24.67). Caveats: the anchoring explanation isn't isolated (session + candidate history cleared together), "when and what to forget" is left for future work, and generality beyond the four tasks isn't established.
- Paper
Reasoning Models Can Be Effective Without Thinking
NoThinking prefills an empty thinking block on DeepSeek-R1-Distill-Qwen-32B so the model writes the solution directly. At matched budget it often beats Thinking, especially low-budget (AMC 2023 51.3 vs 28.9 at ~700 tokens) and as pass@k grows. Parallel NoThinking + best-of-N (verifier or self-certainty) matches sequential Thinking at up to 7–9× lower latency and, with verifiers, ~4× fewer tokens (MiniF2F/ProofNet). LiveCodeBench is the main exception. No official code on abs.
- Paper
FreeToken: Efficient Edge-Native MoE Serving with Bandwidth-Adaptive Execution
An edge-native mixture-of-experts serving system that treats a personal machine as a unified, elastic inference platform rather than a small GPU. FreeToken co-designs model layout and loading, expert residency, CPU-GPU execution, agentic state reuse, and runtime memory management around the realities of local AI: agentic workloads with shifting execution patterns and heterogeneous per-machine hardware. Instead of a fixed offloading strategy, it continuously maps computation and model state onto available resources.
- Paper
GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning
GEPA (Genetic-Pareto; ICLR 2026 Oral). For a compound LLM system, sample traces, reflect with an LM on textual feedback (compiler errors, missed gold docs, constraint fails), mutate one module’s prompt, keep the candidate if the minibatch improves, and parent-sample from the instance-wise Pareto front instead of always mutating the global best. On Qwen3 8B across HotpotQA/IFBench/HoVer/PUPA/AIME-2025/LiveBench-Math: +9.62 pp vs baseline vs GRPO +3.68 pp at 24k rollouts, using ~4–35× fewer rollouts (aggregate ~3936). Also beats MIPROv2; GPT-4.1 Mini aggregate +12.19 pp. Code MIT gepa-ai/gepa; first-class dspy.GEPA. Discord post is Akshay Pachaar’s April 2026 X article “How to Beat GRPO Without Touching Model Weights” (DSPy cookbook; claims Berkeley beat GRPO by 10 points with 35× fewer rollouts).