Optimas: Optimizing Compound AI Systems with Globally Aligned Local Rewards

Shirley Wu, Parth Sarthi, Shiyu Zhao, Aaron Lee, Herumb Shandilya, Adrian Mladenic Grobelnik, Nurendra Choudhary, Edward W Huang, Karthik Subbian, Linjun Zhang, Diyi Yang, James Zou, Jure Leskovec

Building an AI application today rarely involves just a single model. Instead, developers are increasingly deploying Compound AI Systems—complex pipelines where a Large Language Model (LLM) might call a retriever, feed data into a specialized tool, and pass the results to another LLM for final synthesis.

While these compound systems can solve incredibly complex real-world tasks, optimizing them is notoriously difficult. To address this, researchers have introduced OPTIMAS, a unified framework designed to optimize these intricate pipelines by ensuring that local component improvements consistently translate to global system success.

The Challenge of Compound Systems

Optimizing a multi-component AI pipeline is a logistical nightmare for three primary reasons:

  1. Non-Differentiability: You cannot use standard calculus (like backpropagation) to optimize a text prompt or a discrete tool call.
  2. Heterogeneity: Different parts of the system require entirely different types of tuning. One component might need prompt engineering, another requires hyperparameter search, and a third needs model weight fine-tuning via reinforcement learning.
  3. The Credit Assignment Problem: If the final output of a five-step pipeline is incorrect, which specific component failed? Running the entire system thousands of times to test every small, isolated change is prohibitively expensive and slow.
Overview of Compound AI Systems and the OPTIMAS framework.

The Core Mechanism: Locally Aligned Reward Functions

The central innovation of OPTIMAS is the concept of the Local Reward Function (LRF). Rather than relying solely on a single, expensive global reward at the end of the pipeline, OPTIMAS maintains one LRF for every individual component.

  • Local-Global Alignment: This is the critical property that makes OPTIMAS work. The LRFs are trained using preference data so that a higher local reward score mathematically correlates with a higher global system score. If a component maximizes its local reward, the overall system improves.
  • Adaptive Iteration: As the system evolves (e.g., if you swap out the retriever), the "downstream" environment for the upstream components changes. OPTIMAS uses a lightweight adaptation mechanism, sampling small mini-batches of data to keep the LRFs aligned with the current state of the system.
  • Decentralized Optimization: Because each component has its own aligned reward, developers can use the best optimization tool for each specific job. You can use OPRO for prompts, PPO for model weights, and Bayesian search for hyperparameters—all running independently but moving toward the same global goal.
The iterative process of local-global alignment and local reward maximization in OPTIMAS.

Evaluated Datasets and Tasks

The authors rigorously evaluated OPTIMAS across five diverse, real-world compound systems, proving its versatility:

  • Amazon: Behavior-driven product recommendation (optimizing model parameters).
  • PubMedQA: Medical analysis and classification (optimizing model selection).
  • STaRK-Prime: Retrieval over semi-structured biomedical knowledge bases (optimizing weights and prompts).
  • HotpotQA: Multi-hop question answering and RAG (optimizing prompts and retrieval depth).
  • BigCodeBench: Self-verified code generation (optimizing code generation prompts).

Key Insights and Results

OPTIMAS demonstrates significant advantages over existing optimization methods:

  • Superior Performance: OPTIMAS outperformed strong baselines (such as DSPy and TextGrad) by an average of 11.92% across all evaluated tasks.
  • Unmatched Consistency: It was the only method tested that improved performance across all five diverse benchmarks. Baselines like DSPy occasionally degraded performance on specific tasks, such as product recommendation.
  • Data Efficiency: By optimizing components locally using LRFs, the system avoids expensive, repeated runs of the entire compound AI system. It only runs the full pipeline to validate a change or collect alignment data. On the Amazon recommendation task, OPTIMAS achieved 24.24% accuracy using roughly the same computational budget where other methods stalled at 18-20%.
  • Interpretability: The LRFs learn the "vibe" of the global metric. For example, in the HotpotQA task (which uses an F1 score for evaluation), the LRF organically learned to penalize long-winded answers because the global metric rewards conciseness.
  • Theoretical Backing: The paper provides a mathematical proof showing that under mild conditions, maximizing these local aligned rewards is equivalent to performing coordinate ascent on the global objective, guaranteeing convergence to a component-wise maximum.

Limitations and Future Work

While highly effective, OPTIMAS does have a few limitations. The framework requires an initial "offline" phase to collect preference data and train the first version of the LRFs, representing an upfront setup cost. Additionally, while the system converges to a component-wise maximum, it doesn't strictly guarantee a global optimum in highly non-convex landscapes—a common hurdle in complex system optimization. Finally, future work will need to explore how well LRF alignment holds up in massive "agentic" systems with dozens of moving parts, as current experiments focused on pipelines with 3–5 main components.

Ultimately, OPTIMAS represents a major step forward in moving beyond manual heuristics, offering a principled, efficient, and unified way to build the next generation of Compound AI Systems.

Summary updated

BibTeX
@inproceedings{wu2026optimas,
  author = {Shirley Wu and Parth Sarthi and Shiyu Zhao and Aaron Lee and Herumb Shandilya and Adrian Mladenic Grobelnik and Nurendra Choudhary and Edward W Huang and Karthik Subbian and Linjun Zhang and Diyi Yang and James Zou and Jure Leskovec},
  title = {{Optimas: Optimizing Compound AI Systems with Globally Aligned Local Rewards}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=A3VDbR9arh},
}
Figure