Compound AI Systems

Tune one part of a model pipeline by its own score, and the whole pipeline can get worse. In this session's paper, DSPy cut one pipeline's accuracy by 14.3%. Optimas gives each part a learned reward that ranks outputs the way the whole system does, and it improved all five test pipelines.

Pick how to tune the reranker, then press Play. Watch the reranker's own score and the system's score, round by round. Then we build, piece by piece, the system as a graph, the alignment rule, the reward that learns it and the loop that uses it.

You need a little Python and what a probability is. We build the rest from zero.

Session 11 of Georgia Tech CS 8803, LLM seminar. It rests on one paper: Wu, Sarthi, Zhao, Lee, Shandilya, Mladenic Grobelnik, Choudhary, Huang, Subbian, Zhang, Yang, Zou and Leskovec, Optimas: Optimizing Compound AI Systems with Globally Aligned Local Rewards (ICLR 2026). Every idea is re-taught here in our own words and devices.

Tune one part, watch the whole

12

Toy, run live: one reranker knob, a made-up keyword score and a made-up system score. The paper's real case (Table 2): DSPy took the Amazon pipeline from 21.21% to 18.18% accuracy, and Optimas took it to 24.24%.

Chapter 0

One Change, Worse Answers

See how one part can improve by its own score while the system it serves gets worse

You run a support assistant built from four parts. A retriever pulls candidate documents from a knowledge base. A reranker puts the best ones first. A generator, an LLM, writes the answer. A verifier checks the answer against the documents.

A system built from several such parts is a compound AI system. Each part can be an LLM, a tool or a classic machine learning model. One part's output is the next part's input.

Say the reranker looks weak. You tune it against a score it can compute alone: how many words each document shares with the question. That score climbs every week, and the answers get worse. The hero shows this on a toy.

Why does one part matter so much? An early error passes to every later part. The paper's example: an LLM misreads the query, so it retrieves the wrong documents, so every later tool works on wrong inputs.

Chain parts that each look good

Each box is one part, clean on a share of questions. The bar is the share of questions that pass every part without an error. Add parts or lower their quality.

95%
4

Toy: it assumes each part fails on its own, apart from the others. Real failures are often linked, which this simple product does not capture.

With made-up numbers: four parts that are each clean on 95% of questions give 0.95 × 0.95 × 0.95 × 0.95 = 0.81. The chain is clean on 81% of questions. A fifth such part brings it to 77%.

Failure. A part's own score rises while the system's score falls. Measure: score the whole system on held-out questions after every change, not the part alone. Fix: the rest of this session builds a part score that cannot drift away from the system score.

  1. A compound system, written down: a graph of parts, each with its own knob.
  2. The wall: why gradients and brute force both fail.
  3. Tuning each part alone: a sensible local score that picks wrong every time. The hero's first button.
  4. The alignment rule: when a part's own reward is safe to maximize.
  5. What one output is worth: averaging downstream runs.
  6. Training the reward: a pairwise loss and why its answer is aligned.
  7. The Optimas loop: pick a part, improve it, let the system decide. The hero's second button.
  8. Five pipelines, measured: the paper's tables, recomputed.
  9. Where it stops: a real sweep and the limits of the guarantee.
  10. Field guide: terms, numbers, code, links and the credit.
The reranker's own score rose for six weeks while the answers got worse. What went wrong?

Chapter 1

A Compound System, Written Down

Write the pipeline as a graph of parts, each with its own knob, and one score for the end result

The paper writes a compound system as a directed acyclic graph: boxes joined by one-way arrows, with no loops. Each box is a component Ck, for k from 1 to K. The user's input is a source box, C0. An arrow from Ci to Cj sends Ci's output into Cj.

Each component takes an input xk and gives an output yk. A configuration vk sets its behaviour: it is the knob you may turn. The arrows in use can change with the input. A verifier's rejection might send one question back to retrieval and not another.

Knob typeExampleIn the paper
Texta promptHotpotQA's four GPT-4o-mini modules
Discrete choicewhich LLM to call; how many passagesPubMedQA picks from 7 LLMs; HotpotQA's k in {1, 5, 10, 25}
Weightsa model's parametersAmazon's two Qwen 2.5 1.5B models, trained with PPO
Numbersweights that merge two scoresSTaRK's two weights, each in {0.1, 1.0}
Emptya fixed toolnothing to tune

Follow one question through HotpotQA

Pick a step. The box shows what goes in, what comes out and which knob that module has. Look at how the data changes shape at each arrow.

The five modules and the k values are the paper's HotpotQA system (Appendix D, Table 5). We made up the question and every text shown.

To run the system, call the components in order. Each one reads its parents' outputs. Call the final output f(x; v): what the system gives for input x under the full set of knobs v = (v1, …, vK).

What should the knobs be? Call the set of example inputs D. Call the user's score for a final answer R(x, y), the global reward; for HotpotQA it is F1 against the true answer.

Say it aloud

v-star equals the arg max over v of the expected value, for x drawn from D, of R of x and f of x given v.

v★
v-star the best full set of knobs: one setting for every component.
argmaxv
the arg max over v the v that makes what follows largest.
Ex∼D
the expected value for x drawn from D the average over many example inputs.
R
R the global reward: the user's score for a final answer, from 0 to 1 for F1.
f(x; v)
f of x given v the system's final answer to input x with knobs v.
In plain words

Fix a full set of knobs v. Run the system on every input x in D. Score each answer with R and average the scores. The v with the highest average is v-star.

With numbers

With made-up numbers: setting a scores F1 0.3, 0.5 and 0.4 on three questions, an average of 0.40. Setting b scores 0.6, 0.2 and 0.7, an average of 0.50. So v-star is b, even though b loses on question 2.

Failure. You score each component on its own test data and never run the graph. Measure: R on the full system. Fix: keep R as the only final judge. Every local score must answer to it.

In the objective for v-star, what does R score?

Chapter 2

Why You Cannot Train It End to End

Meet the three obstacles that rule out gradient descent and brute force

A neural network trains end to end: one loss, and gradients flow back through every layer. The paper names three reasons this fails for a compound system.

ObstacleWhat it meansExample
No gradientmost knobs are not smooth numbersa prompt is text; k is one of four values
Mixed typesno single update moves every knoba prompt edit, a PPO step and a model swap share no unit
Costly runseach trial runs the whole pipelineone score needs every component on every input

Even trainable weights hit the first wall. Amazon's Qwen model writes text, and the next component reads that text. The model samples one sequence of tokens, and no gradient flows back through a sampled word.

So try brute force: list candidate settings for each knob and run every combination on the training questions.

Price a brute-force search

Choose how many candidate prompts to try for each of HotpotQA's four prompt modules. The bars use a log scale: each grid line is ten times the one before.

5

Our estimate, not the paper's: c prompts for each of 4 modules, all 4 values of k, on the 1,000 training questions (Appendix C). The 2,020 is Optimas's measured cost on HotpotQA (Table 3). It searches in another way, so this compares budgets, not methods.

5 × 5 × 4 × 5 × 5 = 2,500 settings  then  2,500 × 1,000 questions = 2,500,000 runs

With 5 prompts per module, the grid has 2,500 settings. Each needs the whole pipeline on all 1,000 questions: 2.5 million runs. Optimas spent about 2,020 equivalent runs on this system, about 1,240 times fewer. With 8 prompts per module, the grid needs 16.4 million runs.

Prior work goes around the walls by tuning one knob type at a time. DSPy and TextGrad tune prompts, LLMSelector picks models, and reinforcement learning tunes weights. Each judges a part on its own, without running the rest. That is cheap. Chapter 3 shows what it costs.

Failure. The budget covers a few settings, and the best one wins by noise. Measure: count full-system runs per setting tried. Fix: score candidates with something cheap that still tracks R.

Which of these is NOT one of the three obstacles?

Chapter 3

Tuning Each Part Alone

Watch a sensible local score pick the wrong passage on every question

The cheap fix gives each part its own score and tunes the part to raise it. The paper names the flaw: an upstream part cannot see which of its outputs help the parts downstream.

Here is the smallest case. A retriever hands one of two passages, A or B, to a fixed generator. Its local score is keyword overlap: the share of the question's words that a passage repeats. The global reward is the generator's F1.

Pick a passage, four times

Choose the score that picks. Press Next to answer one more question. Grey bars are overlap; purple bars are the F1 the generator gets from that passage.

Toy: four made-up questions. Passage A repeats the question's words. Passage B states the answer with different words.

Overlap picks A every time: (0.20 + 0.30 + 0.45 + 0.10) / 4 = 0.26 average F1. Picking by downstream F1 takes B every time: (0.90 + 0.85 + 0.70 + 0.95) / 4 = 0.85. The generator and the questions did not change. Only the score that chose changed.

This is Goodhart's law: when a measure becomes a target, it stops being a good measure. An optimizer pushes hard on whatever score you give it.

The paper's baselines show it on real pipelines. Relative change is (new − old) / old: for DSPy on Amazon, (18.18 − 21.21) / 21.21 = −14.3%.

MethodPipelineUnoptimized → afterChange
DSPyAmazon, accuracy %21.21 → 18.18−14.3%
DSPyHotpotQA, F133.80 → 44.90+32.8%
TextGradHotpotQA, F133.80 → 24.86−26.4%
HBCHotpotQA, F133.80 → 21.16−37.4%

The same DSPy helps one pipeline and hurts another. In the paper's runs it tunes only each module's instruction text. HBC (hierarchical behaviour cloning) scores an output by how close its embedding is to a known good output. Nobody checks either score against R.

Failure. A strong optimizer leaves the system worse than no tuning. Measure: compare against the unoptimized pipeline on held-out data. Fix: check that the local score ranks outputs the way R does before you optimize it.

DSPy improved HotpotQA and hurt Amazon. What does that pair of results show?

Chapter 4

The Alignment Rule

State exactly when a part's own reward is safe to maximize

Optimas gives every tunable component a local reward function (LRF): a function that scores the component's output given its input. The paper trains it; nobody picks it by hand.

All LRFs share one model. A shared LLM φ (the backbone) reads the input and output as one text, [xk, yk], and turns it into an embedding. A small linear layer hk (the head), one per component, turns that embedding into one number rk.

Say it aloud

r-k of x-k and y-k equals h-k of phi of the text x-k joined with y-k.

rk(xk, yk)
r-k of x-k and y-k the local reward of component k: one number for one output.
hk
h-k the head of component k: one weight per embedding number, plus a bias.
φ
phi the shared backbone; in the paper, Llama 3 8B Instruct with a LoRA adapter (Table 6).
[xk, yk]
x-k joined with y-k the component's input and output, written as one text.
In plain words

Join the input x-k and the output y-k into one text. Pass it through phi to get an embedding. Multiply by the weights of h-k and add its bias. The result is r-k.

With numbers

With made-up numbers: phi gives the embedding (0.2, −0.1, 0.5, 0.3). The head h-k has weights (1, 0, 2, −1) and bias 0.1. So r-k = 0.2 + 0 + 1.0 − 0.3 + 0.1 = 1.0.

What must rk get right? Not R's value, only its order. Take two candidate outputs of component k for the same input, y+ and y−. A candidate's true worth is the global reward you expect after the later components run on it, averaged over their randomness.

Say it aloud

If r-k of y-plus is at least r-k of y-minus, then the downstream expected R given y-plus is at least the downstream expected R given y-minus.

rk(·, y+) ≥ rk(·, y−)
r-k of y-plus is at least r-k of y-minus the local reward ranks y-plus first, or ties.
⇒
then whenever the left side holds, the right side must hold too.
Edown[R | y]
the downstream expected R given y run the later components on y many times, with everything else fixed, and average R.
In plain words

Take any two candidates. If r-k ranks y-plus at least as high as y-minus, then y-plus must also lead to at least as much expected global reward. An LRF that passes this for every pair is aligned.

With numbers

With made-up numbers: r-k gives 1.4 to y-plus and 0.6 to y-minus. Their downstream expected F1 is 0.7 and 0.3. The order agrees, so the pair passes. If the F1s were 0.3 and 0.7, the pair would fail.

Train a reward toward alignment

Eight candidate outputs. Across: each one's true downstream reward. Up: what the LRF gives it. Slide training up and count the pairs it ranks the right way.

15%

Synthetic points. Measured agreement on real held-out pairs: 77.96% for Optimas's LRFs and 49.52% for a GPT-4o judge (Table 4).

Why is order enough? The paper's Theorem 4.1 answers it. Take an aligned rk. The vk that maximizes rk also maximizes the system's expected R. So you can tune one component with a cheap score.

Failure. An LRF ranks pairs at chance, so tuning against it is a coin flip. Measure: pairwise ranking accuracy, the share of held-out pairs ranked the right way. Fix: train it on downstream labels (Chapters 5 and 6).

What does it mean for a local reward to be aligned with the global reward?

Chapter 5

What Is One Output Worth?

Estimate a candidate's downstream reward by running the rest of the system several times

The alignment rule needs the downstream expected reward of each candidate. Nobody hands you that number. The paper estimates it by Monte Carlo sampling: run the later components on the candidate several times and average the scores.

Fix the input x and every upstream output. Feed candidate y to the downstream components and run them n times. Run j gives a final answer with score Rj. Call the estimate Ĝ(y).

Say it aloud

G-hat of y equals one over n times the sum, over j from 1 to n, of R-j of x and y.

Ĝ(y)
G-hat of y the estimated downstream reward of candidate y.
1/n
one over n divide by the number of downstream runs, n.
Σj=1…n
the sum over j from 1 to n add one score for each run.
Rj(x, y)
R-j of x and y the global reward of run j, which starts from candidate y.
In plain words

Run the rest of the system n times from candidate y. Score each final answer with R. Add the scores and divide by n. That is G-hat.

With numbers

With made-up numbers: four runs from passage B score F1 0.9, 0.8, 1.0 and 0.7. G-hat = 3.4 / 4 = 0.85.

Roll out two candidates

Each dot is one downstream run: filled if the final answer was right. The bar is the running average, the dashed line the true value. Run a few, then many.

Toy: each run is right or wrong. From A the answer is right 60% of the time, from B 45%. We compute the chance of a right label exactly. The paper does not report its number of runs.

Comparing two estimates gives a preference pair. The paper builds pairs for component k in three steps:

  1. Run the system up to Ck and record the path so far.
  2. Sample two candidate outputs for Ck, for example with a higher temperature.
  3. Estimate each one's downstream reward. Label the higher one y+ and the other y−.

With the toy's numbers, one run each gives the right label 57.5% of the time. Ten runs each give about 75%. Close candidates need many runs before the label is reliable.

Failure. Too few runs, so close pairs get the wrong label and the LRF learns noise. Measure: re-estimate a sample of pairs with more runs and count the labels that flip. Fix: more runs for close pairs, or drop pairs whose gap is inside the noise.

Why does the paper average several downstream runs for each candidate?

Chapter 6

Training the Reward

Fit the local reward to preference pairs with a pairwise loss, and see why its answer is aligned

Each pair says only which output was better. The paper trains rk with a pairwise log-sigmoid loss, the same form as reward models in RLHF. The sigmoid σ(u) = 1/(1 + e−u) squashes any number into the range 0 to 1.

Call the preference data for component k Dk: triples of an input, a better output y+ and a worse output y−. Call d the gap: the reward of y+ minus the reward of y−.

Say it aloud

L-k equals minus the expected value, over triples drawn from D-k, of log sigma of r-k of y-plus minus r-k of y-minus.

Lk
L-k the loss for component k. Lower is better.
−
minus flips the sign, so the loss is a positive number.
E…∼Dk
the expected value over triples from D-k the average over all preference pairs.
log σ
log sigma the log of the sigmoid: near 0 for a large positive gap, far below 0 for a large negative one.
rk(x, y+) − rk(x, y−)
the gap d how far the better output scores above the worse one.
In plain words

For each pair, take the gap d. Squash it with sigma and take the log. Average over all pairs and flip the sign. A right order with a wide gap costs little; a wrong order costs a lot.

With numbers

With made-up numbers: r-k gives 2.1 to y-plus and 0.4 to y-minus, so d = 1.7. Sigma of 1.7 is 0.846, and the loss is −log 0.846 = 0.17. Swap the two scores: d = −1.7, sigma is 0.154, and the loss is 1.87, eleven times more.

Feel the pairwise loss

Slide the gap d between the better and the worse output. The dot shows that pair's loss. The yellow bar is how hard one training step pushes the gap up.

1.7

Exact curve of −log σ(d) and its push σ(−d). We made up the gap values.

Why does this loss give an aligned reward? Say each label comes from the true downstream rewards through a sigmoid with a sharpness α > 0. A bigger gap in expected R makes the right label likelier. The paper's Lemma B.1 shows the loss is lowest when rk equals α times the expected downstream R. Multiplying by a positive number never flips an order, so that rk is aligned.

expected R 0.3 and 0.7, α = 2: σ(2 × 0.4) = σ(0.8) = 0.69 and r = 0.6 and 1.4: σ(1.4 − 0.6) = 0.69

The learned rewards 0.6 and 1.4 predict the same label chance, 0.69, as the true rewards. The data cannot tell them apart, and their order is the same.

How much data does it take? On HotpotQA, 12.5% of the preference data gives 65.46% pairwise accuracy, 92.7% of the full-data score; 25% gives 95.1% (Figure 7). Backbones of 1B, 3B and 8B parameters score 72.58%, 70.04% and 71.20%. A bigger backbone did not help.

Failure. The LRF fits its training pairs but ranks new outputs at chance. Measure: pairwise accuracy on held-out pairs. Fix: more varied candidates and early stopping; the paper stops when the held-out loss stalls for 512 steps.

The loss is lowest when r-k equals alpha times the expected downstream R. Why is that enough for alignment?

Chapter 7

The Optimas Loop

Pick one component, improve it against its reward, and keep the change only if the system agrees

The paper's Algorithm 1 starts from the first knobs and from LRFs trained once on offline pairs. Then it repeats:

  1. Pick one component at random, each with equal chance.
  2. Improve only that component against its LRF, with a method that fits its knob type.
  3. Form the candidate knobs: the current knobs with that one slot replaced.
  4. Run the full system with the candidate on a small validation set.
  5. Keep the candidate only if its total R is higher. Then refresh the LRFs on a few new pairs.
KnobLocal methodRole of the LRF
PromptOPRO-style search over candidate promptsthe score that ranks them
WeightsPPO, a reinforcement learning methodthe critic
Discrete choicesample one candidate by its scoresets the chances

For a discrete knob, such as which LLM to call, score each candidate c with the LRF to get rc. Turn the scores into chances pc, then sample one.

Say it aloud

p-c equals e to the r-c, divided by the sum over j of e to the r-j.

pc
p-c the chance of picking candidate c.
exp(rc)
e to the r-c makes every score positive and keeps their order. r-c is candidate c's LRF score.
Σj exp(rj)
the sum over j of e to the r-j the same for every candidate, added up, so the chances sum to 1.
In plain words

Raise e to each candidate's score r-c. Divide each by the total. Sample one candidate with those chances p-c. A higher score is likelier, not certain.

With numbers

With made-up numbers: three LLMs score 0.62, 0.58 and 0.51. e to those gives 1.859, 1.786 and 1.665, a total of 5.310. The chances are 35.0%, 33.6% and 31.4%.

Step 5 is the validation gate. Call the validation inputs Dv, the current knobs vt and the candidate knobs ṽ.

Say it aloud

The sum over x in D-v of R of x and f of x given v-tilde is greater than the same sum given v-t.

Σx∈Dv
the sum over x in D-v add the global reward over the validation inputs; the paper uses 20 (Table 7).
ṽ
v-tilde the candidate knobs, with one component changed.
>
is greater than strictly; a tie is rejected.
vt
v-t the current knobs at round t.
In plain words

Run the system with v-tilde and with v-t on every validation input. Add each set of scores. Keep v-tilde only if its total is strictly higher. Otherwise keep v-t and skip the LRF refresh.

With numbers

With made-up numbers: on 20 inputs, v-tilde totals 14.3 and v-t totals 14.1, so the gate keeps v-tilde. A total of 14.1 against 14.1 is a tie, and the gate rejects it.

Step the loop

Each step picks one component (pink), proposes a change that its LRF likes, then runs the gate. Green dots are kept changes, red crosses are rejected ones.

Toy run, scripted. A real kept step: on STaRK, a new Text Scorer prompt at iteration 9 raised the validation reward from 0.49 to 0.56 (Section 5.1).

Why refresh the LRFs? A kept change makes them stale in two ways. A changed component alters what its upstream parts' outputs are worth. And its downstream parts now get inputs their LRFs never saw. So after each kept change, the paper samples 20 fresh inputs, builds a few new pairs and takes a few loss steps. It mixes in a buffer of older pairs, so the LRF does not forget.

Failure. A stale LRF approves a change that hurts. Measure: count rejections at the gate. Fix: the gate stops the change, and the refresh after each kept change keeps the LRFs current.

What does the validation gate add that the alignment rule alone does not?

Chapter 8

Five Pipelines, Measured

Read the paper's tables for accuracy, cost and how well the rewards rank

The paper tests five pipelines, each with a different mix of knobs (Appendices C and D).

PipelineTask and metricComponents and knobsTrain / val / test
Amazonnext product a user picks; accuracytwo Qwen 2.5 1.5B models (weights, PPO), then a GPT-4o-mini decider (prompt)335 / 60 / 99
PubMedQAyes, no or maybe on medical abstracts; accuracytwo model selectors (7 LLMs), an analyst and a solver (prompts)475 / 25 / 500
STaRK-Primebiomedical retrieval; MRRtwo Claude 3 Haiku scorers (prompts), an aggregator (two weights)495 / 51 / 96
HotpotQAtwo-step questions; F1four GPT-4o-mini modules (prompts) and a retriever (k)1,000 / 250 / 100
BigCodeBenchcode that passes tests; pass ratethree Claude 3 Haiku modules (prompts)500 / 25 / 70

Read Table 2 by method

Pick a method. Each bar is its relative change against the unoptimized pipeline. Bars right of the line are gains; bars left of it are losses.

All scores from Table 2; the change is against its Unoptimized row. Each method had a similar budget of system runs (Table 3).

Optimas is the only method that beats Unoptimized on all five. It also used the fewest system runs on average: 0.71 thousand, against 0.79 for DSPy and 0.80 for TextGrad (Table 3).

One correction to the headline. The paper reports an 11.92% average gain over the best baseline: the mean of Table 2's last row. Two entries use another comparison. Amazon's 14.3% is against Unoptimized; against REINFORCE (21.89) it is 10.7%. BigCodeBench's 9.0% is against TextGrad; against Unoptimized (36.67) it is 6.1%. Against the best baseline in every column, the average is 10.6%.

Did the LRFs learn the alignment rule? Count. Take held-out pairs where one output has the higher downstream reward. Call the set of pairs P and the reward being tested r.

Say it aloud

acc equals one over the size of P, times the sum over pairs in P of one if r of y-plus is greater than r of y-minus.

acc
acc pairwise ranking accuracy, from 0 to 1. Chance is 0.5.
1/|P|
one over the size of P divide by the number of held-out pairs.
Σ(y+, y−)∈P
the sum over pairs in P one term per pair; y-plus is the output with the higher downstream reward.
1[ ]
one if 1 when the condition inside holds, 0 when it does not.
r(y+) > r(y−)
r of y-plus is greater than r of y-minus the reward ranks the pair the right way.
In plain words

For each pair in P, check whether r puts the truly better output y-plus on top. Count the hits. Divide by the number of pairs. That is acc.

With numbers

Table 4: Optimas's LRFs score 84.93, 65.28, 76.64, 72.40 and 90.57% on the five pipelines, an average acc of 77.96%. A GPT-4o judge given 20 examples averages 49.52%: chance.

Better ranking bought a better system in a controlled test (Figure 5). On HotpotQA, the LRF prefers short answers, and the tuned prompt asks for no more than 10 words (Figure 6). Local reward rose from 0.17 to 0.22 and global reward from 0.32 to 0.36. Short answers suit F1, which counts extra words against you.

Failure. An average hides a pipeline that got worse. Measure: report every pipeline against Unoptimized. Fix: ship a change only if it beats no tuning on each system you care about.

Why does Table 4 matter apart from Table 2's final scores?

Chapter 9

Where It Stops

Check the guarantee against a real sweep, and list what the paper does not promise

Theorem 4.1 holds at the loss's minimum. Real LRFs are trained on a finite set of pairs. The paper checks how close they get: it sweeps HotpotQA's retriever k and records both rewards at each value (Table 8).

Sweep the retriever's k

Teal is the LRF of the retriever. Purple is the system's global reward. Slide through the seven values of k and compare where each one ranks.

5

Real numbers from Table 8 (Appendix G.1). The two rewards are on different scales, so each line has its own axis.

The local reward peaks at k = 5 and the global reward at k = 10. The top three, {5, 10, 15}, match as a set; only the top two swap. The local gap between 5 and 10 is 0.0007, the global gap 0.0047. Alignment holds roughly, not exactly.

LimitWhat it means
Best one part at a timeTheorem 4.2: the loop is coordinate maximization. It reaches a point where no single component can improve. A change to two components together can still be better.
No global optimum promisedThe paper says that needs extra conditions on the shape of the objective (Polyak–Łojasiewicz or Kurdyka–Łojasiewicz).
Needs a score RNo preference labels without a reward you can compute. All five tests have automatic metrics.
Equal turnsThe scheduler picks components at random, even ones that are already at their best.
A small gate20 validation inputs. On Amazon, Table 2's run-to-run spread reaches ±3.78 points.
Extra computePPO on Amazon took about 6 GPU-hours (Appendix G.4).

Failure. The loop stops where each part is at its own best, but a joint change would score higher. Measure: try a few paired changes by hand at the end. Fix: none is built in; the authors name larger systems as future work.

The local reward peaks at k = 5 and the global reward at k = 10. Does this break Theorem 4.1?

Chapter 10

Field Guide

Keep the terms, the numbers, the code and the open questions in one place

A compound system cannot be trained end to end, and tuning each part by a convenient score can make it worse. Optimas trains one local reward per part on downstream preference pairs, so each reward ranks outputs the way the system does. It tunes one part at a time and keeps a change only if a validation run agrees.

TermMeaningNumber to remember
Compound AI systema graph of LLMs, tools and models5 test pipelines, 3 to 5 components each
Global reward Rthe user's score for the final answeraccuracy, MRR, F1 or pass rate
LRF rka learned score for one component's outputone Llama 3 8B backbone, one head per component
Alignmentrk ranks pairs as downstream R does77.96% pairwise accuracy, judge 49.52%
Pairwise loss−log σ of the gapgap 1.7: 0.17; gap −1.7: 1.87
Validation gatekeep a change only if total R rises20 validation inputs
Local searchsmall, conservative steps3 prompt candidates, 3 steps, 20 fresh inputs
Headlinemean of Table 2's last row11.92% reported; 10.6% against the best baseline
Costequivalent full-system runs0.71k average, against 0.79k (DSPy)

Checklist

  1. Write down R first, and score every change on the full system.
  2. Before you optimize a part's own score, measure how often it ranks pairs as R does.
  3. Build pairs from downstream runs; give close pairs more runs.
  4. Train one shared backbone with a head per component on the pairwise loss.
  5. Change one component at a time, in small steps, and keep a change only if validation R rises.
  6. Refresh the LRFs after each kept change, with a buffer of old pairs.
  7. Report every pipeline against no tuning, not only the average.
pythonimport math, random

def pair_loss(r_plus, r_minus):                  # -log sigma(gap)
    return math.log1p(math.exp(-(r_plus - r_minus)))

def optimas(comps, v, lrf, R, val_set, T):
    for t in range(T):
        k = random.choice(list(comps))            # uniform scheduler
        cand = local_optimize(comps[k], v[k], lrf[k]) # prompt search, PPO or sampling
        v_new = {**v, k: cand}                      # change ONE slot
        new = sum(R(x, run(comps, v_new, x)) for x in val_set)
        old = sum(R(x, run(comps, v, x)) for x in val_set)
        if new > old:                               # strict: a tie is rejected
            v = v_new
            lrf = refresh(lrf, new_pairs(comps, v, n_inputs=20))  # plus a buffer
    return v

print(round(pair_loss(2.1, 0.4), 2), round(pair_loss(0.4, 2.1), 2))   # 0.17 1.87

What the authors leave open

The convergence result reaches a point where no single component can improve, not a global best. The tests all use automatic metrics, so a learned or human-judged R is untested. The authors name larger systems, and the reward modelling they need, as future work.

Keep going

Credit: Session 11 of Georgia Tech CS 8803, LLM seminar. Paper: Optimas: Optimizing Compound AI Systems with Globally Aligned Local Rewards (Wu, Sarthi, Zhao et al., ICLR 2026, arXiv 2507.03041). The toy pipelines and all made-up numbers are ours.

The takeaway. A part is safe to tune by its own score only if that score ranks outputs the way the whole system does. Learn that score from downstream runs, keep it fresh, and let the system's own score have the last word.

Teach it back: open Present or Teach and explain the alignment rule and the validation gate to a friend. Then go back to the reranker and predict both curves before you press Play.

CS 8803 LLM Seminar, Session 11: Compound AI Systems
Optimas paper · Back to Gleams