mlsanityData to 13 Oct 2026

Model Cascading for Code: A Cascaded Black-Box Multi-Model Framework for Cost-Efficient Code Completion with Self-Testing

arXiv 2405.15842 ↗First posted 24 May 2024cs.SE cs.LGcited by 5

Not on the map. Why?

Abstract (arXiv)

The rapid advancement of large language models (LLMs) has significantly improved code completion tasks, yet the trade-off between accuracy and computational cost remains a critical challenge. While using larger models and incorporating inference-time self-testing algorithms can significantly improve output accuracy, they incur substantial computational expenses at the same time. Furthermore, servers in real-world scenarios usually have a dynamic preference on the cost-accuracy tradeoff, depending on the budget, bandwidth, the concurrent user volume, and users' sensitivity to wrong answers. In this work, we introduce a novel framework combining model cascading and inference-time self-feedback algorithms to find multiple near-optimal self-testing options on the cost-accuracy tradeoff in LLM-based code generation. Our approach leverages self-generated tests to both enhance accuracy and evaluate model cascading decisions. As a blackbox inference-time method, it requires no access to internal model parameters. We further propose a threshold-based algorithm to determine when to deploy larger models and a heuristic to optimize the number of solutions, test cases, and test lines generated per model, based on budget constraints. Experimental results show that our cascading approach reduces costs by an average of 26%, and up to 70% in the best case, across various model families and datasets, while maintaining or improving accuracy in natural language generation tasks compared to both random and optimal single-model self-testing schemes. To our knowledge, this is the first work to provide a series of choices for optimizing the cost-accuracy trade-off in LLM code generation with self-testing.

Key facts. Cited by 5 papers in the map (data through 13 Oct 2026). Builds on 17 of its 32 references that are in the map. First posted on arXiv 24 May 2024.

Builds on

17 of 32 references.

References · 17

  1. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,979
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,205
  3. 2019DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lightercited by 4,281
  4. 2021Program Synthesis with Large Language Modelscited by 3,573
  5. 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,367
  6. 2023Code Llama: Open Foundation Models for Codecited by 2,130
  7. 2022Fast Inference from Transformers via Speculative Decodingcited by 1,625
  8. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,173
  9. 2021Measuring Coding Challenge Competence With APPScited by 891
  10. 2023FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performancecited by 815
  11. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 731
  12. 2022CodeT: Code Generation with Generated Testscited by 377
5 more
  1. 2023A Survey on Model Compression for Large Language Modelscited by 268
  2. 2023From Words to Watts: Benchmarking the Energy Costs of Large Language Model Inferencecited by 168
  3. 2023Large Language Model Cascades with Mixture of Thoughts Representations for Cost-efficient Reasoningcited by 142
  4. 2023The Program Testing Ability of Large Language Models for Codecited by 11
  5. 2024BASS: Batched Attention-optimized Speculative Samplingcited by 11

Built on by

Cited by year (2026 to 13 Oct)

Citing papers per year: 2025: 1; 2026: 4.

5 papers.