AdaptiveLLM: A Framework for Selecting Optimal Cost-Efficient LLM for Code-Generation Based on CoT Length
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
While Large Language Models (LLMs) have significantly advanced code generation efficiency, they face inherent challenges in balancing performance and inference costs across diverse programming tasks. Dynamically selecting the optimal LLM based on task difficulty and resource constraints offers a promising approach to achieve an optimal balance between efficiency and performance. However, existing model selection methods are resource-intensive and often neglect cost efficiency. Moreover, these approaches rely on human-annotated difficulty labels that are frequently inaccessible in real-world settings and may not align with the LLM's own assessment of task difficulty. In this paper, we introduce AdaptiveLLM, a framework that dynamically selects optimal LLMs for a given coding task by automatically assessing task difficulty. Our framework first estimates task difficulty using Chain-of-Thought lengths generated by reasoning model, clusters these into three difficulty levels via k-means, and fine-tunes CodeBERT to embed difficulty-aware features. A trained XGBoost classifier then selects the best model for each problem, optimizing the performance-cost trade-off. Experimental results show that AdaptiveLLM achieves a 7.86% improvement in pass@1 score while reducing resource consumption by 88.9% compared to baseline method ComplexityNet. When compared to a single model, AdaptiveLLM demonstrates an approximately 15% accuracy improvement, while maintaining the same level of cost consumption. Apart from that, the difficulty assessment using CoT provides more reliable selection criteria than human evaluation. Our replication package is available at https://github.com/cjhCoder7/AdaptiveLLM.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 6 of its 40 references that are in the map. First posted on arXiv 12 Jun 2025.
Builds on
6 of 40 references.
Closest ancestors · 2
Same direction, newest first
Other references · 4
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2023WizardMath: Empowering Mathematical Reasoning for Large Language Models via Reinforced Evol-Instructcited by 625
- 2023Large Language Model Cascades with Mixture of Thoughts Representations for Cost-efficient Reasoningcited by 143
Built on by
Citing papers per year: 2025: 1; 2026: 2.
3 papers.
- 2025A Comprehensive Survey on Benchmarks and Solutions in Software Engineering of LLM-Empowered Agentic Systemcited by 15
- 2026Data Difficulty and the Generalization--Extrapolation Tradeoff in LLM Fine-Tuningcited by 0
- 2026When Does LLM Orchestration Pay Off? A Controlled Evaluation of Accuracy, Cost, and Task Difficultycited by 0
- 2026When Does LLM Orchestration Pay Off? A Controlled Evaluation of Accuracy, Cost, and Task Difficulty1 Aug 2026
- 2026Data Difficulty and the Generalization--Extrapolation Tradeoff in LLM Fine-Tuning13 May 2026
- 2025A Comprehensive Survey on Benchmarks and Solutions in Software Engineering of LLM-Empowered Agentic System10 Oct 2025
Similar, not cited
Close in wording, no citation either way
- 2024CodeLutra: Boosting LLM Code Generation via Preference-Guided Refinement
- 2026Narrowing the Complexity Gap in the Evaluation of Large Language Models ↗
- 2024Enhancing Code Generation Performance of Smaller Models by Distilling the Reasoning Ability of LLMs
- 2025Increasing LLM Coding Capabilities through Diverse Synthetic Coding Tasks
- 2025LeetCodeDataset: A Temporal Dataset for Robust Evaluation and Efficient Training of Code LLMs
- 2024CodeACT: Code Adaptive Compute-efficient Tuning Framework for Code LLMs
- 2026CodeEval: A pedagogical approach for targeted evaluation of code-trained Large Language Models
- 2023Chain-of-Thought in Neural Code Generation: From and For Lightweight Language Models