Optimal Skill Selection for LLM Agents with Provable Bicriteria Guarantees
A method that picks which 'skill documents' to feed an AI coding agent, with mathematically guaranteed near-optimal results
Coding agents like Codex or Claude Code load reusable 'skill documents' into their limited context window to gain task-specific abilities, but current systems just score each skill independently and pack in the top matches, letting redundant skills waste tokens or even hurt performance. The researchers modeled skill selection as an optimization problem that balances covering needed capabilities against context cost under a token budget, and built a polynomial-time algorithm called Best Prefix Selection (BPS) with the first proven performance guarantee for this task. On a contamination-controlled coding benchmark, BPS reached 0.73 measured task success, beating existing skill routers, text retrievers, and the agent's own selection (0.20-0.52), while using 28% fewer tokens than the strongest existing router.
What they did
- Coding agents choose skill documents from a library to load into an LLM's limited context window, but current methods score skills independently and use top-k or greedy packing with no guarantee of quality or cost control
- The researchers built a structured objective: each skill supplies latent 'capabilities,' each query demands certain capabilities, overlapping supply of the same capability gives diminishing returns, while covering different capabilities complements each other -- and this benefit is offset by a token-length penalty
- They designed BPS, an algorithm that enumerates small seed sets, greedily grows each into a chain by adding the item with best benefit-per-token, records every intermediate combination along the way, and picks the best one overall
- They proved a bicriteria approximation guarantee in polynomial time: the algorithm captures at least (1-1/e) of the achievable benefit while paying no more than the full token penalty (a coefficient of 1) -- the best possible benefit ratio achievable in polynomial time
- Trained only on pass/fail execution outcomes, the fitted model correctly recovered the hidden skill-capability mapping (99.6% accuracy), and on a contamination-controlled BigCodeBench variant, BPS achieved 0.73 success versus 0.20-0.52 for existing baselines

| tj | ∈argmaxi∈T∖{t1,⋯,tj−1}G^(i∣{t1,⋯,tj−1}), | (13) | ||
|---|---|---|---|---|
| mj | :=G^(tj∣{t1,⋯,tj−1}),∀j∈[|T|]. |

Why it matters
As skill/tool libraries for AI agents keep growing, choosing which items to load into limited context has become a first-order bottleneck for both accuracy and cost, and this work is the first to explain why naive top-k relevance scoring fails and to offer a selection algorithm with a provable guarantee. Anyone building agent frameworks can use this principle to cut wasted context while boosting task success.
Terms in this paper
- skill document · a reusable instruction file that teaches an LLM agent how to perform a specific task
- context window · the maximum amount of text (tokens) an LLM can process at once
- submodular function · a function where adding a new item gives diminishing extra benefit as more similar items are already selected
- bicriteria approximation · a guarantee that bounds two different objectives (here, benefit and cost) with separate approximation ratios
- knapsack constraint · a limit requiring choices to fit within a fixed budget, like packing a bag with a weight limit
Original abstract (English)
Loading reusable skill documents into a bounded context window is now the primary way large language model (LLM) agents acquire task-specific capabilities, which makes skill selection a first-order determinant of task performance and token cost. Yet current agents score skills independently by semantic relevance and assemble the set by top-$k$ or greedy packing, with no quality guarantee or cost awareness on the selected set. As a result, redundant or poorly chosen skills waste scarce context tokens and can even degrade performance. We give the first model of how the selected skill set shapes execution outcomes and cast skill selection as an optimization problem: choose a skill set under a hard token budget to maximize a monotone submodular benefit minus context penalty. For this problem, we develop Best Prefix Selection (BPS), a polynomial-time algorithm, and prove, to our knowledge, the first performance guarantee for skill selection: a bicriteria $(1-1/e,1)$ approximation whose benefit coefficient is optimal in polynomial time. On a contamination-controlled BigCodeBench variant, BPS outperforms all the baselines, reaching $0.73$ measured task success versus $0.20$--$0.52$ for released skill routers, text retrievers, and the executor's own selection, on $28\%$ fewer tokens than the strongest released router.
Read on arXivLatest papers
- LoRA-GA$^2$: Low Rank Adaptation with Multi-step Gradient Adaptive AlignmentPeeking at a few early training gradients before fine-tuning starts to set up LoRA smarter
- Remember, Verify, or Ask? Cross-Family Evaluation of Memory Commitment in LLM AgentsAI assistants would rather double-check facts than ask you a question, even when asking is the right call
- Robust Incomplete Multimodal Sentiment Analysis via Iterative Proxy CorrectionWhen text input is missing or broken, this AI doesn't guess once and move on—it revises its guess step by step to read emotions more reliably
- Generating Diverse Personas for User Simulators to Test Interview Dialogue SystemsTo test interview-style chatbots you need many different fake users, so this work has an LLM automatically generate those fake user personalities
- Rethinking Patch Based Multivariate Time Series Forecasting with Semantic Structured PartitioningA new way to slice time series into meaningful chunks instead of arbitrary equal-length pieces
- Reliable Financial Named Entity Recognition under Domain ShiftAn AI's confidence trained on formal filings turns unreliable once it reads tweets
- Bringing analytic rigor to agentic AI for science: The Brain Researcher platform for neuroimaging data analysisA system that makes AI show its work when analyzing brain-imaging data, not just deliver an answer
- GenMatch: An End-to-End Generative Matching Framework for Micro-View Order-Dispatching in Ride-HailingDiDi replaced its multi-step ride-hailing dispatch pipeline with one generative model and saw real-world gains
Latest from METAL LAB
- Google Discover adds chatbot that adjusts your feed based on spoken preferences
- OpenAI Closes In on Anthropic Again in Enterprise Spending Share
- Meta Unveils First 10 Tasks in WildArtifactBench, a Benchmark for AI Agents
- Musk: "Optimus + Grok will one day handle healthcare for all humanity"
- 35% of Web Pages Published Since ChatGPT Show Signs of AI Authorship
Figures: Yu Chen et al., arXiv:2608.19993, cc-by-nc-sa-4.0