Skip to content

BetterTogether: fine-tuning and prompt optimization work better together

optionalextendedfundamentalpaperrubric 8/122024 · EMNLP 2024 · ~20 min

Dilara Soylu, Christopher Potts, Omar Khattab

Read first: DSPy: compiling declarative LM calls into self-improving pipelines

Status

TL;DR. In a pipeline like multi-hop RAG, should you tune the prompts (Π) or the weights (Θ)? Alternate them. Optimize prompts so the program produces good traces, fine-tune (LoRA) each module’s LM on its own successful traces, then re-optimize the prompts.

Optimizing an LM program: modules with tunable parameters, and an optimizer loop Top: a multi-hop question-answering program made of modules (generate search query, retrieve, generate a second query, retrieve, answer). Each LM module has three tunable parameters: its instruction, its few-shot demonstrations and the model weights. Bottom: an optimizer runs the program on training inputs, scores the final output with a metric, and proposes new parameters. Labels show what each optimizer changes: bootstrapping changes demonstrations, MIPROv2 searches instructions and demonstrations with a Bayesian surrogate, BetterTogether alternates prompt optimization and fine-tuning, and GEPA reflects on traces in natural language and keeps a Pareto set of candidates. An LM program (multi-hop QA), written as modules with signatures question query₁ ←question retrieve query₂ ←question, notes retrieve answer ←question, passages output each LM module (shaded) has three knobs: instruction demos weights The optimizer loop (no module-level labels, no gradients through the pipeline) run program ontraining inputs score final outputwith a metric propose newknob settings repeat within a budget of program runs What each one turns Bootstrap (DSPy) demos from passing traces MIPROv2 instructions + demos, Bayesian surrogate BetterTogether alternate prompts ⇄ weights GEPA reflect on traces in text, keep a Pareto set Assertions add constraints: on failure, retry the module with the error in its prompt. The program is the model; prompts and weights are its parameters.
BetterTogether alternates between the prompt knobs and the weight knob.
  • Before: DSPy (BootstrapFinetune, BootstrapFewShot with Random Search), MIPROv2 (a different prompt optimizer, for comparison), STaR.
  • After: GEPA (prompt evolution vs. GRPO), RL-trained search agents.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Mechanism

    BetterTogether's Π→Θ→Π strategy optimizes prompts, fine-tunes the weights on traces from the prompt-optimized program, then optimizes prompts again. Explain what each step buys, why the fine-tuning pairs use vanilla prompts rather than the optimized ones, and why Θ-first strategies are impossible for llama-2 on Iris.

    What a strong answer covers
    • First Π raises the success rate on training inputs, so more of them yield correct traces to fine-tune on (the paper's first hypothesis).
    • Θ (BFT) keeps correct traces, swaps the optimized prompts for vanilla ones in the prompt–completion pairs, and trains one shared LM on all modules. The model internalizes what the demos taught and no longer needs the long prompt to behave that way.
    • Second Π re-fits demos and instructions to the new weights, because what worked as a prompt for the old model may not suit the fine-tuned one (the second hypothesis).
    • Vanilla llama-2 scores 0.0 on Iris, so it produces no correct traces to fine-tune on; Π first lifts it to 56.7, which makes Θ possible.
    • Teacher and student are the same model throughout, so this is self-improvement rather than distillation from a stronger model.
  2. Derive / compute

    Assume BFT keeps one prompt–completion pair per module from each correct trace, with 1,000 HotPotQA training questions and a 3-module program. Using mistral's test accuracy as a rough proxy for training success (17.2% vanilla, 33.8% after Π), estimate the fine-tuning set size for Θ alone and for Π→Θ. How many optimizer steps does each take for 5 epochs at effective batch size 8?

    What a strong answer covers
    • Θ alone: 1,000 × 0.172 = 172 traces × 3 = 516 pairs; 516 × 5 / 8 ≈ 323 steps.
    • Π→Θ: 1,000 × 0.338 = 338 traces × 3 = 1,014 pairs; about 634 steps, roughly twice the data.
    • Test outcome for mistral on HotPotQA: Θ 22.9 against Π→Θ 36.3. This is consistent with data quantity mattering, but Π-generated traces may also be better quality, so the two effects are confounded.
    • Caveats: test accuracy is only a proxy for training success, and correct traces skew toward easier questions, so the fine-tuning set under-represents the hard cases.
  3. Critique

    BetterTogether reports that the combined strategies are best in 7 of 9 model–task pairs. Yet on HotPotQA llama-3 with Π alone (46.9) matches Π→Θ→Π (46.7), and mistral's Π→Θ falls to 30.7 on Iris against 57.3 for Π. Critique the claim that prompts and weights are better together, and design an experiment that would explain when fine-tuning helps.

    What a strong answer covers
    • No single combined strategy wins across tasks, and the authors say they do not yet understand why both are important. Choosing the best strategy per task after the fact flatters the method.
    • With 3 seeds, several gaps are within noise; differences of a point or less should not carry conclusions.
    • The Iris collapse suggests fine-tuning on a small number of correct traces can overfit or break the output format. The LoRA settings (rank 32, 5 epochs, learning rate 1e-5) were fixed rather than tuned per task.
    • Experiment: vary the number and diversity of fine-tuning traces and plot the gap between Π and Π→Θ→Π against data size, while tracking train-trace accuracy against test accuracy to detect overfitting.
    • Control for the second Π: compare with an equal-budget extra Π before fine-tuning (Π→Π→Θ), so that re-adapting to the new weights is separated from simply spending more search budget.

Done with this page?

Status