Scaling LLM Inference with Optimized Sample Compute Allocation

Kexun Zhang, Shang Zhou, Danqing Wang, William Yang Wang, Lei Li
10/29/2024
cs.CLcs.AI

Official code: LeiLiLab/OSCA (8 stars, last commit 2024-11-13).

Abstract

Sampling is a basic operation in many inference-time algorithms of large language models (LLMs). To scale up inference efficiently with a limited compute, it is crucial to find an optimal allocation for sample compute budgets: Which sampling configurations (model, temperature, language, etc.) do we use? How many samples do we generate in each configuration? We formulate these choices as a learning problem and propose OSCA, an algorithm that Optimizes Sample Compute Allocation by finding an optimal mix of different inference configurations. Our experiments show that with our learned mixed allocation, we can achieve accuracy better than the best single configuration with 128x less compute on code generation and 25x less compute on 4 reasoning tasks. OSCA is also shown to be effective in agentic workflows beyond single-turn tasks, achieving a better accuracy on SWE-Bench with 3x less compute than the default configuration. Our code and generations are released at https://github.com/LeiLiLab/OSCA.

View on arXivView PDF

Code Implementations(1)

LeiLiLab/OSCAOfficial100%
80Python, Jupyter NotebookOct 29, 20241 years ago

Similar Papers

Cite this paper

@article{zhang2024scaling,
  title  = {Scaling LLM Inference with Optimized Sample Compute Allocation},
  author = {Kexun Zhang and Shang Zhou and Danqing Wang and William Yang Wang and Lei Li},
  year   = {2024},
  eprint = {2410.22480},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.22480v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.22480.svg)](https://codeofpaper.com/paper/2410.22480)

Discussion