This repository contains code for experiments to analyze the Generator-Validator gap and methods to fix from our paper RankAlign: A Ranking View of the Generator-Validator Gap in Large Language Models
Citation:
@article{rodriguez2025rankalign,
title={RankAlign: A Ranking View of the Generator-Validator Gap in Large Language Models},
author={Rodriguez, Juan Diego and Ding, Wenxuan and Erk, Katrin and Durrett, Greg},
journal={arXiv preprint arXiv:2504.11381},
year={2025}
}
Language models can be inconsistent when prompted with generator and validator forms of the same question. For example, to probe knowledge of hypernymy, we can prompt:
-
(Generator) "A bee is a kind of" [look at next token predictions]
-
(Discriminator) "Do you think a bee is a kind of furniture? Answer:" [Yes/No]
We can look at the degree of model confidence/certainty of the answer by looking at log-odds, for both generator and discriminator, and quantify the Generator-Validator gap through the correlation of these log-odds. This repo contains code to evaluate the Generator-Validator gap, and to run our method, RankAlign, and other baselines from our paper.
data/contains the hypernymy dataset from Rodriguez et al., 2025, and versions of the SWORDS lexical substitution dataset, LAMBADA, and TriviaQA.scripts/:- RankAlign is contained in
ranking_loss_ref.py - Other baselines:
- Use
fine_tune_lora.pyto SFT models with LoRA on variations of our prompts. - Use
dpo.pyto run the DPO baselines. - Use
consistency_ft.pyto run the consistency fine-tuning baseline.
- Use
- RankAlign is contained in
models/andoutputs/is where model checkpoint and eval results are saved, respectively.