ScoreFlow: Mastering LLM Agent Workflows via Score-based Preference Optimization

Yinjie Wang, Ling Yang, Guohao Li, Mengdi Wang, Bryon AragamarXiv 2025 · DOI

Abstract

ScoreFlow is a novel framework designed to automate the creation of multi-agent Large Language Model (LLM) workflows. By framing workflow design as a code generation task, ScoreFlow utilizes a specialized training objective called Score-DPO. This method extends standard Direct Preference Optimization by incorporating continuous evaluation scores, allowing a compact generator model to produce highly adaptive, task-specific workflows. Experimental results across six benchmarks show an 8.2% performance gain over state-of-the-art automated baselines and significant reductions in inference costs.

Introduction

Multi-agent LLM systems, which coordinate specialized agents (e.g., programmers, reviewers, or ensembles), have demonstrated significant potential for solving complex reasoning tasks. However, the manual design of these workflows is often rigid and labor-intensive. Existing automated search methods, such as AFlow or ADAS, typically rely on discrete optimization techniques like Monte Carlo Tree Search. These approaches suffer from poor scalability due to expensive API calls, premature convergence on suboptimal structures, and a lack of adaptivity—often applying a single static workflow to an entire dataset regardless of individual problem complexity.

The ScoreFlow Framework

ScoreFlow addresses these limitations by decoupling the system into two primary components: a Generator and an Executor. The Generator is an open-source LLM (e.g., Llama-3.1-8B) tasked with writing Python code that represents a specific workflow. The Executor then runs this code to solve the given problem.

Score-DPO: Continuous Preference Optimization

To optimize the Generator, the authors introduce Score-DPO, an advancement over standard Direct Preference Optimization (DPO). While standard DPO relies on binary preference pairs, Score-DPO leverages quantitative feedback (such as F1 scores or pass rates) from the Executor. This is achieved through two key modifications:

  1. Enhanced Sampling: Preference pairs with larger differences in evaluation scores are up-weighted during sampling.
  2. Score-guided Objective: The Bradley-Terry ranking objective is modified to scale the implicit reward by the deterministic evaluation score, ensuring that clearer signals have a stronger impact on the model's learning.

Adaptive Workflow Generation

A core strength of ScoreFlow is its ability to generate unique workflows tailored to the difficulty of each task. For instance, a simple arithmetic problem might receive a direct "Chain-of-Thought" workflow, whereas a complex level-5 math problem might trigger a multi-step "Programmer -> Reviewer -> Ensemble" pipeline.

This adaptivity prevents "overthinking" on simple tasks—saving compute—and ensures sufficient reasoning depth for difficult ones, thereby reducing calculation errors inherent in overly complex or overly simple static pipelines.

Experimental Evaluation

The framework was evaluated on six benchmarks across three domains:

  • Mathematical Reasoning: GSM8K and level-5 MATH problems.
  • Question Answering: DROP and HotpotQA.
  • Coding: HumanEval and MBPP.

Key Results

  • Superior Performance: ScoreFlow achieved an average solve rate of 85.3%, outperforming baselines like CoT, Self-Refine, and AFlow by an average of 8.2%.
  • Efficiency: By fine-tuning a smaller 8B model via gradient descent, ScoreFlow surpassed the performance of discrete prompt-based search methods that utilize much larger models like GPT-4o.
  • Cost-Effectiveness: ScoreFlow enabled smaller executor models (e.g., GPT-4o-mini) to outperform the standard performance of GPT-4o at a fraction of the cost.

Conclusion and Future Work

ScoreFlow demonstrates that gradient-based optimization of workflow generators is a more scalable and effective alternative to discrete search. While the current implementation relies on an external judge for training feedback and requires a secure sandbox for code execution, the underlying Score-DPO method is highly generalizable. Future research could apply Score-DPO to broader LLM alignment tasks where quantitative feedback is available, moving beyond simple binary human preferences.

Summary updated

BibTeX
@misc{wang2025scoreflow,
  author = {Yinjie Wang and Ling Yang and Guohao Li and Mengdi Wang and Bryon Aragam},
  title = {{ScoreFlow: Mastering LLM Agent Workflows via Score-based Preference Optimization}},
  year = {2025},
  eprint = {2502.04306},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.04306},
}
Figure