NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Faster, Cheaper, Better: Multi-Objective Hyperparameter Optimization for LLM and RAG Systems

Matthew Barker, Andrew Bell, Evan Thomas, James Carr, Thomas Andrews, Umang Bhatt

TL;DR

This paper introduces the first method for optimizing multiple objectives (cost, latency, safety, and alignment) simultaneously for Retrieval Augmented Generation (RAG) systems. Their Bayesian optimization approach significantly outperforms baselines, finding better trade-offs and highlighting that optimal RAG configurations are task- and objective-dependent.

What Problem Does This Paper Address?

Retrieval Augmented Generation (RAG) systems combine Large Language Models (LLMs) with external knowledge retrieval to improve performance. However, building an effective RAG system involves a complex web of choices: which LLM to use, which embedding model for retrieval, how to chunk documents, and numerous other hyperparameters. Optimizing all these parameters together, especially when aiming for multiple, often conflicting, goals (like low cost and high accuracy), is a significant challenge. The search space is enormous, evaluating each configuration is expensive and time-consuming, and the results can be noisy due to the probabilistic nature of LLMs. Existing work has largely focused on optimizing single objectives or a limited set of parameters, leaving the multi-objective optimization of entire RAG pipelines underexplored.

Methods

The authors propose a multi-objective Bayesian Optimization (BO) framework to tackle this challenge. Their approach involves:

  • Defining a Solution Space: This includes choices for LLMs, embedding models, and various hyperparameters like chunk size, number of chunks, and temperature.
  • Defining Objectives: They focus on four key objectives:
  • Safety: Measured by a "faithfulness" metric, indicating how well the RAG response is supported by the retrieved context (higher is better).
  • Alignment: Measured by a "helpfulness" metric, assessing how useful and unambiguous the response is (higher is better).
  • Cost: Calculated based on token usage for embedding, reranking, and LLM inference (lower is better).
  • Latency: The end-to-end time for a query to receive a response (lower is better).
  • Train-Test Paradigm: To ensure generalization, they use a train-test split for evaluating RAG pipeline performance.
  • Bayesian Optimization with qLogNEHVI: They leverage a sophisticated BO acquisition function called qLogNEHVI, which is designed to handle noisy objective evaluations and efficiently explore multi-objective spaces. This is initialized with Sobol sampling.
  • Hypervolume Indicator (HV): Used to quantitatively measure the quality of the Pareto front (the set of optimal trade-offs between objectives).

Datasets

The paper introduces two new RAG benchmark tasks:

  • FinancialQA: Based on a large accounting document from a global firm, requiring context retrieval from over 1000 pages. They synthetically generated 50 questions using GPT-4o.
  • MedicalQA: Adapted from the existing FACTS benchmark, focusing on a medical Q&A subset. They combined context chunks into a single document and manually filtered questions.

Both datasets use a train-test split (30/20 for FinancialQA, 43/43 for MedicalQA) to evaluate RAG system performance.

Key Insights and Ideas

  • BO is Crucial for Multi-Objective RAG: Bayesian optimization, particularly with advanced acquisition functions like qLogNEHVI, is significantly more effective than random sampling or simpler BO variants for navigating the complex, multi-objective landscape of RAG systems.
  • Trade-offs are Inevitable: Optimizing one objective often comes at the expense of another. For instance, configurations that maximize safety and alignment tend to increase cost and latency.
  • Task Dependence is Real: An optimal RAG configuration for one task (e.g., financial Q&A) does not necessarily generalize to another task (e.g., medical Q&A), even for the same objectives.
  • Objective Dependence Matters: The relationship between configurations and objective outcomes can vary. Some objectives show clear trends (e.g., latency decreases with smaller chunk sizes), while others might be less predictable or show different trends across tasks.
  • New Benchmarks are Needed: Existing Q&A datasets often provide context directly. The paper's new benchmarks, which require runtime context retrieval, better reflect real-world industry RAG use cases.

Key Results

  • Superior Performance: The proposed qLogNEHVI Bayesian optimization approach significantly outperformed baseline methods (uniform sampling, Sobol sampling, and qLogEHVI BO) in terms of hypervolume improvement on both FinancialQA and MedicalQA datasets.
  • Pareto Front Quality: qLogNEHVI BO generated a superior Pareto front, indicating better trade-offs across the four objectives, and showed a wider spread of solutions compared to qLogEHVI BO.
  • Configuration Insights:
    • Safety and alignment are generally positively correlated, as are cost and latency.
  • Configurations optimized for safety and alignment often use larger embedding models and larger chunk sizes to ensure sufficient context.
  • Configurations optimized for latency tend to use smaller embedding models and smaller chunk sizes to reduce processing.
  • Cost/Latency vs. Safety/Alignment: Significant reductions in cost and latency were achievable with only minimal compromises in safety and alignment.

Limitations and Future Work

  • Computational Cost: While BO is more efficient than exhaustive search, evaluating RAG pipelines remains expensive. The authors suggest exploring "decoupled evaluation" where not all objectives are assessed at every iteration, especially for costly ones like safety.
  • Prompt Engineering: The current framework does not explicitly optimize prompt engineering, which is known to significantly impact response quality.
  • Metric Scope: The safety and alignment metrics used are limited and could be extended to include aspects like toxicity and data leakage.
  • Configuration Selection: Selecting the "best" configuration from the Pareto frontier remains a non-trivial task for practitioners, as multiple Pareto-optimal solutions exist.
  • Generalization: The paper highlights that optimal configurations are task- and objective-dependent, suggesting that practitioners need to carefully consider their specific use case.

Summary updated

BibTeX
@inproceedings{barker2025faster,
  author = {Matthew Barker and Andrew Bell and Evan Thomas and James Carr and Thomas Andrews and Umang Bhatt},
  title = {{Faster, Cheaper, Better: Multi-Objective Hyperparameter Optimization for LLM and RAG Systems}},
  booktitle = {FM-Wild @ ICLR},
  year = {2025},
  url = {https://openreview.net/forum?id=6cGFmr6Wgc},
}
Figure