Every Sample Counts: Supervised Fine-Tuning of Language Models with Pointwise Constraints

Ignacio Hounie, Ignacio Boero, Alejandro RibeiroNeurIPS 2026

TL;DR

When we fine-tune language models to be safe or accurate, we usually enforce rules on average—meaning a model can ace easy prompts while failing catastrophically on rare, tricky ones. This paper introduces a framework that enforces rules on every single sample individually, automatically learning when to bend the rules slightly for true outliers. The result is a massive drop in worst-case failures across safety, tool-calling, and retrieval tasks without sacrificing the model's core capabilities.

What Problem Does This Paper Address?

Imagine a bridge that is safe on average, except on windy Tuesdays when it collapses. That is essentially how we currently align Language Models (LMs). When we want a model to follow rules—like refusing harmful requests, avoiding hallucinations, or keeping outputs concise—existing methods apply constrained optimization in expectation (on average across the training data).

Because LMs struggle with "tail" data (rare, underrepresented, or inherently difficult prompts), satisfying a constraint on average creates a dangerous loophole: the model over-performs on common, easy inputs to mathematically subsidize severe rule violations on hard inputs. In high-stakes domains, you don't care about the average prompt; you care that the model doesn't go off the rails on edge cases.

Methods

Instead of a single global penalty weight or a single average-constraint multiplier, the authors enforce pointwise constraints—assigning a distinct, learnable Lagrange multiplier to every individual training sample. If a specific prompt violates a rule, its personal penalty ramps up during training.

Table 1: Comparison of constraint enforcement and resulting multipliers. Pointwise constraints induce a distinct multiplier per sample in the dual, whereas the average-constraint dual uses a single scalar multiplier; the penalty uses a fixed weight.

Making this work on neural networks requires solving two big hurdles:

  1. Non-convexity via Augmented Lagrangians: Standard dual optimization breaks down in deep learning because transformers aren't convex (meaning there's a "duality gap" between the theoretical solution and what gradient descent actually finds). The authors adapt an Augmented Lagrangian method, adding a quadratic penalty term that corrects for adverse curvature and closes this gap, optimized via an alternating primal-dual gradient algorithm.
  2. Learned Relaxations ("Resilience"): Demanding 100% perfection on every data point can ruin a model if the dataset has noisy outliers or impossible edge cases. The authors introduce a sample-dependent relaxation variable penalized by a quadratic cost (controlled by a hyperparameter $\beta$). Crucially, they prove mathematically that you don't even have to optimize these extra relaxation variables directly—their effect folds neatly into a simple regularization and rescaling of the dual multipliers.

Datasets

The authors test their framework on small language models (<7B parameters) across three distinct tasks (no new datasets are introduced, though length-aware re-ranking is framed as a novel task):

  • Instruction Following & Safety: Alpacalong-1k and AlpacaEval (helpfulness); BeaverTails and PKU-SafeRLHF-30k (safety/harmfulness).
  • Tool Calling Preferences: When2call (derived from BFCL and APIGen), testing whether models know when to call a tool, ask follow-up questions, or refuse unanswerable queries.
  • Passage Re-ranking: MS MARCO v2.1 (50k training / 5k validation instances), training an encoder to favor shorter passages for RAG token efficiency without losing relevance.

Key Insights and Ideas

  • Cranking up global penalties doesn't fix the tail: You might think, "Why not just make the average constraint stricter or increase the fixed penalty weight?" The authors test this and show it fails. Tightening average constraints just forces the model to over-optimize on easy samples (pushing its primary loss up) while the worst-case "right tail" of severe violations barely budges.
  • Aggregate metrics hide skewed behavior: In tool-calling, baseline methods like SimPO look just as accurate overall as pointwise constraints. Under the hood, however, average-based methods cannibalize one skill (dropping F1 on asking follow-up questions) to boost another (refusing to answer). Pointwise constraints force uniform competence across all categories.
Figure 1: Empirical Cumulative Distribution Function (CDF) of sample-wise constraint values ℓ(πθ, x, y) in the test set for the reranking task. Positive values violate the constraint. We compare our method (purple line) with average constraints (left), penalty methods (center) and relaxed pointwise constraints (right). Our approach results in significantly fewer samples incurring large violations.

Key Results

Across all tasks, pointwise constraints slash worst-case violations—measured by Conditional Value at Risk (CVaR) above the 95th percentile—while keeping primary task performance intact:

  • Drastic Tail Reduction: In re-ranking, constraint CVaR plummets from 120 (average constraints) and 105 (fixed penalty) down to 2.4 with pointwise constraints, while simultaneously achieving a much better average objective loss (8.2 vs. 42 and 33).
  • Safety without Lobotomy: On Llama-7b, pointwise constraints achieve a 100% refusal rate on unsafe prompts with only a 5% drop in AlpacaEval win rate. Reaching that same refusal rate with average constraints or baselines like Safe-DPO causes a 9% drop, heavily degrading instruction-following.
  • Balanced Tool Calling: On Llama-3.2-1B-Instruct, pointwise and relaxed methods achieve ~0.80 length-normalized accuracy with near-zero hallucination rates, eliminating the erratic F1 disparities across categories seen in DPO, CPO, and average-constraint baselines.
Figure 2: Length normalised accuracy, Hallucination Rates and F1 scores for Llama-3.2-1B- Instruct [47] finetuned on the when2call [44] dataset for different methods. Height of bars denotes the mean and errorbars the standard deviation, computed across three seeds. A full table with results for other models is included in Table 10. Pointwise constraints achieve a more homogeneous distribution of errors across different categories.
  • Token-Efficient Re-ranking: Fine-tuning ModernBERT-base with pointwise relevance constraints cuts the length-weighted ranking metric (LenRank@10) from 203 (monoBERT) down to 170.8–183, while maintaining a virtually identical MRR@10 of 0.71–0.73 (vs. 0.74).

Limitations and Future Work

  • Theoretical Generalization Bounds: While each training sample gets its own multiplier, test samples obviously don't have pre-assigned multipliers. Empirically, the reduced tail violations generalize well out-of-sample, but the authors note that deriving formal finite-sample bounds on how the empirical dual problem converges to the true population distribution remains an open theoretical question for future work.
  • Model Scale: Experiments were deliberately scoped to small language models (<7B parameters) on a 45GB fractional GPU to ensure reproducibility and cost-efficiency; scaling behavior on frontier-sized models is not explored here.

Summary updated

Abstract

Finetuning Language Models often requires enforcing constraints on individual inputs without compromising performance. However, current alignment methods typically impose constraints only on average, which can induce undesirable disparities across inputs or users. We propose a finetuning framework that addresses this limitation by enforcing alignment requirements as per-sample constraints. To handle the optimization challenges inherent in this approach, we utilize an augmented Lagrangian formulation in the dual domain. Since pointwise constraints can be overly restrictive in low-probability regions or in the presence of outliers, we introduce a learned, sample-dependent relaxation that minimally relaxes constraints to optimize objective performance. We demonstrate the versatility of our framework across three small language model tasks: safety in instruction following, preference satisfaction in function calling, and length-aware re-ranking. Across these settings, our approach reduces tail constraint violations while largely preserving or improving downstream performance
BibTeX
@inproceedings{hounie2026every,
  author = {Ignacio Hounie and Ignacio Boero and Alejandro Ribeiro},
  title = {{Every Sample Counts: Supervised Fine-Tuning of Language Models with Pointwise Constraints}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=6BYu5yc6pZ},
}
Figure