Learning to Answer from Correct Demonstrations

Nirmit Joshi, Gene Li, Siddharth Bhandari, Shiva Kasiviswanathan, Cong Ma, Nathan Srebro

Supervised Fine-Tuning (SFT) is the standard paradigm for teaching Large Language Models (LLMs) to follow instructions. By providing a prompt and a "gold standard" answer, we train models to replicate expert behavior. However, for complex tasks like coding, mathematics, or creative writing, there are often millions of equally valid ways to arrive at a correct answer.

This paper shifts the focus of SFT from cloning the expert's specific style to learning what makes an answer fundamentally correct. By assuming the underlying reward function is simple—rather than assuming the expert's specific policy is simple—the authors develop a novel learning algorithm that achieves a faster "optimistic" sample complexity and avoids the generalization failures inherent in standard Maximum Likelihood Estimation (MLE).

The Challenge of Multiple Correct Answers

Traditional imitation learning, often referred to as Behavior Cloning, relies heavily on MLE to force the model's output distribution to match the expert's. This approach is effective if we assume the expert follows a very specific, easily modelable strategy (the "Demonstrator Class Assumption").

In reality, experts are diverse and their specific policies can be highly complex. If we instead assume only that the definition of a correct answer is simple (the "Reward Class Assumption"), standard MLE can fail catastrophically. If a model is flexible enough to perfectly clone the expert on training data, it might implicitly learn a "consistent" but entirely incorrect reward function, leading to poor generalization on unseen test cases.

A New Approach: Apprenticeship Learning in Contextual Bandits

To address the shortcomings of MLE, the authors formalize the problem as apprenticeship learning in contextual bandits. They abandon the Demonstrator Class Assumption in favor of the strictly weaker, more realistic Reward Class Assumption (modeling the underlying reward function, $r_\star$).

The proposed method introduces a "mistake-unaware" online weight-update learner. Unlike standard bandit settings where a learner receives direct reward feedback, this algorithm only observes the expert's demonstration after making its own prediction.

The algorithm maintains a distribution of weights over possible reward functions. If the expert's answer scores higher than the learner's prediction under a specific candidate reward function, that candidate's weight is increased. Instead of picking one single "best" model, the algorithm hedges its bets, ensuring strong performance across all reward functions in the class that remain consistent with the expert's demonstrations. An online-to-batch conversion mechanism is also provided to transform this one-pass online approach into a stable statistical predictor for offline datasets.

Theoretical Results and Insights

Because this is a theoretical foundation paper, the authors evaluate their claims using mathematical proofs and complexity analysis rather than standard LLM benchmarks.

Sample complexity bounds comparing MLE and the proposed learner under different assumptions.

The most striking insight is the mathematical proof that MLE can fundamentally fail to generalize when multiple correct answers exist, even if the reward class is incredibly small (e.g., only two possible functions).

Conversely, the proposed learner provides strong generalization guarantees:

  • Logarithmic Sample Complexity: The learner succeeds with a sample complexity that scales logarithmically with the size of the reward class ($\log |\mathcal{R}|$).
  • Optimistic Rates: For binary rewards and an optimal expert demonstrator, the algorithm achieves a sample complexity of $O(1/\epsilon)$. This is a significant improvement over the $O(1/\epsilon^2)$ rates established in landmark prior work (e.g., Syed & Schapire, 2007), while also being simpler to implement as a one-pass algorithm.
  • Pass@k Optimization: The authors extend their theory to the "Pass@k" metric, showing that sample complexity improves to $O(\log_{k+1} |\mathcal{R}|)$. This provides rigorous theoretical justification for why generating multiple samples is highly effective for complex reasoning tasks.
  • Robustness: The algorithm remains effective even if demonstrations are "arbitrarily adaptive," meaning the expert's choice of which correct answer to provide can change based on previous questions.

Limitations and Future Directions

While the sample complexity of this approach is highly efficient, its computational complexity remains a hurdle. A naive implementation requires tracking every possible reward function in the class, which scales exponentially with the number of parameters. Furthermore, the current theoretical analysis is constrained to finite reward classes. Extending these guarantees to the continuous, high-dimensional spaces typical of modern transformer-based reward models is a critical open question. Finally, exploring how these "reward-hedging" SFT techniques interact with downstream alignment phases, such as Reinforcement Learning from Human Feedback (RLHF), presents an exciting avenue for future research.

Summary updated

BibTeX
@inproceedings{joshi2026learning,
  author = {Nirmit Joshi and Gene Li and Siddharth Bhandari and Shiva Kasiviswanathan and Cong Ma and Nathan Srebro},
  title = {{Learning to Answer from Correct Demonstrations}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=69fIHgLjyH},
}
Figure