Aligning to Constraints for Data-Efficient Language Model Customization

Fei Wang, Chao Shang, Shuai Wang, Sarthak Jain, Qiang Ning, Bonan Min, Vittorio Castelli, Yassine Benajiba, Dan Roth

Introduction

Large Language Models (LLMs) have demonstrated remarkable general-purpose capabilities, yet they often struggle with the "last mile" of specific domain applications. These failures frequently manifest as an inability to adhere to strict task-specific rules, such as maintaining logical consistency in temporal reasoning or following precise formatting constraints in entity extraction. Traditionally, the solution has been supervised fine-tuning (SFT), which requires thousands of human-annotated examples—a process that is both costly and slow.

This paper introduces ACT (Aligning to ConsTraints), a framework designed to customize LLMs without the need for expensive human labels. The core insight is that most task failures stem from a lack of constraint adherence rather than a lack of underlying knowledge. By utilizing automated "constraint verifiers" to rank model outputs, ACT provides a scalable surrogate for human supervision, achieving performance levels comparable to traditional fine-tuning.

The ACT Framework

The ACT framework automates the alignment process through a four-step pipeline that bridges the gap between general instructions and task-specific execution.

The ACT framework: From unlabeled data and instructions to constraint-based training.

1. Constraint Selection and Verifier Realization

Constraints are categorized into three primary types:

  • Response-based: Rules governing the output format (e.g., selecting from a predefined list of labels).
  • Prompt-Response: Rules defining the relationship between input and output (e.g., ensuring a summary is relevant to the source document).
  • Multi-instance: Logical rules across multiple outputs (e.g., ensuring temporal consistency across related questions).

Instead of human graders, ACT employs "Verifiers"—programmatic scripts, rule engines, or automated metrics like BERTScore—to calculate a Constraint Satisfaction Rate (CSR) for any given model output.

2. Response Sampling and Ranking-based Training

For each unlabeled prompt, the model generates multiple candidate responses using diverse search strategies. These candidates are then processed by the Verifiers. The model is fine-tuned using a ranking loss, learning to assign higher probabilities to responses that satisfy constraints and lower probabilities to those that violate them. This process effectively "bakes" constraint-following behavior directly into the model's weights, making it more robust than simple prompt-based instructions.

Experimental Evaluation

The researchers evaluated ACT across several challenging domains:

  • FIGER: Fine-grained entity typing involving 112 possible labels.
  • XSUM: Extreme abstractive summarization.
  • TORQUE: Temporal question answering focusing on event ordering.
  • Transfer Learning: Testing if constraint-following behavior (e.g., extractiveness) learned on one task transfers to others like event trigger extraction.

Results and Discussion

Empirical results demonstrate that ACT significantly narrows the gap between zero-shot prompting and full supervised fine-tuning. On the FIGER entity typing task, ACT achieved a 61.5 F1 score using zero human labels, nearly matching the 63.8 F1 of a model trained on a fully labeled dataset.

Comparison of Constraint Satisfaction Rate (CSR) across different methods.

As shown in the figure above, ACT consistently outperforms both the base model and simple constraint-augmented prompting. In complex scenarios involving both label options and hierarchical constraints, ACT's performance (61.3 CSR) is identical to that of full supervised fine-tuning, highlighting its efficiency in learning from automated feedback.

Furthermore, the study found that constraint-following behavior is transferable. A model trained to be extractive for entity typing automatically improved its performance in event extraction tasks without additional task-specific training. This suggests that ACT helps models learn generalizable "behaviors" rather than just memorizing task-specific patterns.

Conclusion and Future Work

ACT provides a powerful alternative to human-centric data labeling by leveraging programmatic constraints as a supervision signal. While the framework requires an initial "warm-up" for highly complex tasks to ensure the model can generate at least some valid responses, it offers a scalable path for LLM customization. Future research may explore "meta-verifiers," where LLMs are used to automatically generate the Python code for constraint verifiers based on natural language task descriptions, further reducing the human effort required for model alignment.

Summary updated

BibTeX
@inproceedings{wang2025aligning,
  author = {Fei Wang and Chao Shang and Shuai Wang and Sarthak Jain and Qiang Ning and Bonan Min and Vittorio Castelli and Yassine Benajiba and Dan Roth},
  title = {{Aligning to Constraints for Data-Efficient Language Model Customization}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.findings-naacl.294},
}
Figure