From Task Affinities to Optimal Allocations: Probabilistic Graphical Modelling for Supervised Finetuning

Prateek Chanda, Saral Sureka, Krishnateja Killamsetty, Ganesh RamakrishnanarXiv 2026

TL;DR

TaskMixPGM is a new framework that uses Probabilistic Graphical Modeling to automatically find the best mixture of datasets for supervised fine-tuning (SFT). By treating tasks as nodes in a Markov Random Field and measuring their "behavioral similarity," it creates a balanced training recipe that maximizes model utility while minimizing redundancy, consistently outperforming standard heuristics and state-of-the-art selection methods.

What Problem Does This Paper Address?

Supervised fine-tuning (SFT) is the stage where a base language model is trained on instruction-following datasets to hone its reasoning and problem-solving skills. However, practitioners often have hundreds of potential datasets but a limited computational budget.

The standard approach is to use simple heuristics: either sample tasks uniformly or proportional to their size. These methods are sub-optimal because they ignore task interactions. Some tasks are redundant (wasting budget), while others are complementary (boosting performance). Existing automated selection methods often require expensive repeated training runs or rely on "semantic similarity" (like cosine similarity of embeddings), which often fails to capture how a model actually behaves when trained on that data.

Methods

The authors introduce TaskMixPGM (Task Mixtures via Probabilistic Graphical Modelling). The core idea is to model the entire task pool as a dense Markov Random Field (MRF).

  1. Nodes and Edges: Each task is a node. Edges represent the affinity between tasks.
  2. Behavioral Affinity (PMI): Instead of looking at text embeddings, they measure affinity by comparing the predictive distributions of models fine-tuned on single tasks. They use a symmetric Pointwise Mutual Information (PMI) score to determine how much one task "informs" another.
  3. Energy-Based Objective: They define an energy function where:
  4. Unary Potentials reward "representative" tasks (those with high total affinity to the pool).
  5. Pairwise Potentials penalize redundant tasks (those that are too similar to each other).
  6. Spectrum Shifting: The raw affinity matrix is often non-convex, which makes optimization unstable. The authors apply a "spectrum shift" ($\tau$)—essentially adding a value to the diagonal of the matrix—to restore convexity. They identify a "critical shift" ($\tau_c$) that ensures a unique, broad mixture rather than collapsing to a single task.
Figure 1: Illustrative example. Left: a six-task MRF whose edges are labelled with similarities Sij (thicker edges for high Sij, dashed for low). Right: the optimal mixture p∗from Eq. (3) for these similarities; darker shading marks larger weight in both panels. The most connected task T6 receives the most mass, while the strongly redundant pairs (T1, T2 and T4, T5, both with Sij = 0.8) split theirs.

Datasets

The study utilizes a massive pool of 309 instruction-tuning tasks compiled from:

  • Flan 2021: ~17.5M examples across various NLP tasks.
  • T0: Multitask prompted training data.
  • Chain-of-Thought (CoT): Reasoning-focused datasets.
  • Tulu V3: A diverse collection of high-quality instructions.
  • GLUE/SuperGLUE: Standard language understanding benchmarks.

For evaluation, they use the Open LLM Leaderboard benchmarks, including BBH (reasoning), GPQA (science), IFEval (instruction following), MATH, MMLU-Pro, and MuSR.

Key Insights and Ideas

  • Behavioral > Semantic: The authors show that semantic similarity (cosine similarity of task vectors) carries very little information about actual task structure. Behavioral similarity (PMI) reveals much clearer clusters and redundancies.
  • The "Attractor" Phenomenon: The optimization uncovers "attractor" tasks—broadly transferable datasets (like certain QA prompts from T0) that act as anchors for the mixture.
  • Convexity is Key: Without the spectrum shift, the optimization problem is non-convex and tends to collapse, selecting only a single task. The shift $\tau$ acts as a "knob" to control the breadth and diversity of the mixture.
Figure 2: Effect of the spectrum shift τ in S + τI on the optimal mixture (n = 309, ρ = 0.02424). Shaded: τ ≤τc, where the objective is not convex on ∆n. Dashed lines show the local minimum reached from p∗(τ0). At τ = 0 the solution is a single task. Per-collection mass is in Figure 9; discussion in Section C.3.
  • Transferability: A mixture computed once using a specific model (e.g., Qwen-2-7B) transfers remarkably well to other model families (Llama-2) and different training budgets.

Key Results

  • Dominant Performance: Across 36 different model-budget-benchmark settings, TaskMixPGM achieved the highest score in 32 of them.
  • Reasoning Gains: The margins were largest in reasoning tasks. For Llama-2-7B, BBH scores jumped from ~35.9 to ~40.9 at a 25K sample budget compared to the best heuristic.
  • Data Efficiency: A TaskMixPGM mixture with a 25K budget often matched or beat the best heuristic using a 50K budget.
  • Compute Efficiency: While it requires training single-task LoRA adapters once, this cost is amortized. Computing the affinity matrix took ~16 GPU-hours, whereas competing methods like LESS required ~320 GPU-hours for the same setup.

Limitations and Future Work

  • One-Time Cost: The method requires an initial investment to train single-task checkpoints for the entire pool to estimate affinities.
  • Pool Dependency: The framework optimizes the given pool; it cannot generate new data or add capabilities (like safety or multilinguality) if they aren't already present in the source tasks.
  • Specialized Task Bias: By favoring representative tasks, the method might naturally down-weight highly specialized or small datasets (like safety-specific data) unless they are explicitly protected or weighted.
  • Future Directions: The authors suggest extending the framework to larger model sizes, longer contexts, and more diverse task types like safety and multilinguality.

Summary updated

Abstract

Supervised fine-tuning over a large pool of heterogeneous tasks is often computationally expensive, leading practitioners to train language models on a fixed training budget of carefully chosen SFT tasks. Thus, achieving strong downstream performance hinges on selecting an effective subset of tasks, or equivalently, identifying an optimal task mixture under a fixed budget constraint. In practice, supervised finetuning mixtures are often determined using simple heuristics (e.g., uniform or size-proportional sampling) that ignore task interactions, which can hurt transfer and waste budget on redundant task sources. We introduce TASKMIXPGM, a framework for learning continuous task mixtures through energy-based modelling over SFT tasks. Each task forms a node in a Markov random field, with unary potentials capturing task utility and pairwise potentials modelling inter-task relationships via behavioral divergences between predictive distributions of single-task fine-tuned models. Optimizing this objective yields task mixtures that balance utility, coverage, and redundancy. We further show that the induced set function defined over the set of such tasks is weakly submodular under budget constraints, enabling approximation guarantees for discrete task selection. Empirically, we provide a fixed, benchmark-independent mixture that improves over heuristic mixing across multiple model families and different training budgets. TASKMIXPGM also uncovers interpretable structure in task interactions, revealing complementarities and redundancies that inform effective SFT mixtures.
BibTeX
@misc{chanda2026from,
  author = {Prateek Chanda and Saral Sureka and Krishnateja Killamsetty and Ganesh Ramakrishnan},
  title = {{From Task Affinities to Optimal Allocations: Probabilistic Graphical Modelling for Supervised Finetuning}},
  year = {2026},
  eprint = {2611.10389},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.10389},
}
Figure