BetterTogether: fine-tuning and prompt optimization work better together
arXiv ↗PDF ↗Paper ↗Website ↗Code ↗
Read first: DSPy: compiling declarative LM calls into self-improving pipelines
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.
Connections
Section titled “Connections”- 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.
- 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.
- 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.
- 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.