Aligning Transformers with Continuous Feedback via Energy Rank Alignment

Shriram Chennakesavalu, Frank Hu, Sebastian Ibarraran, Grant M. Rotskoff

Introduction

Generative AI models are highly capable of producing text, code, and even chemical structures. However, steering these models to generate outputs with specific, desired properties requires a process known as "alignment." In the realm of Large Language Models (LLMs), alignment is typically achieved via Reinforcement Learning from Human Feedback (RLHF) or Direct Preference Optimization (DPO), which rely on pairwise human preference rankings.

In fields like chemistry and biology, alignment looks different. Instead of human vibes, researchers rely on exact, continuous scores from computational "oracles" (e.g., a molecule's predicted solubility or binding affinity). Existing methods struggle in this domain: DPO is designed for pairwise rankings and can suffer from mode collapse when preference data is sparse, while RL-based methods like Proximal Policy Optimization (PPO) are notoriously unstable and difficult to tune. To address this, researchers have introduced Energy Rank Alignment (ERA), a stable, scalable algorithm designed to align chemical and protein transformers using continuous reward signals.

Energy Rank Alignment (ERA)

Instead of using an implicit reward model like DPO or a complex actor-critic RL setup like PPO, ERA employs an explicit, gradient-based objective.

ERA borrows a core concept from statistical physics by treating the negative reward as an "energy" function. The algorithm optimizes the model's policy so that it converges to an ideal "Gibbs-Boltzmann distribution." This framework introduces two highly interpretable control knobs:

  1. $\beta$ (Inverse Temperature): Controls the entropy. A high $\beta$ forces the model to aggressively seek the maximum reward, while a low $\beta$ encourages fluctuations and diverse samples.
  2. $\gamma$ (Regularization): Controls how closely the aligned model must stick to the original, pre-trained reference model, ensuring it still generates valid chemistry or biology.
Effect of the regularization parameter on the aligned distribution, interpolating between the reference policy and the target Boltzmann distribution.

By decoupling these two parameters, ERA can push a model toward high-reward regions of chemical space without destroying the model's foundational knowledge of chemical validity. Because ERA uses an explicit reward function, it prevents the mode collapse often seen in DPO, maintaining a healthy distribution of diverse outputs even with sparse data.

Experimental Setup and Key Results

The authors pretrained a base molecular transformer on the ChEMBL database (2.4 million small molecules) and evaluated ERA using standard computational oracles for properties like QED (drug-likeness), LogP (hydrophobicity), Ring Count, and Molar Refractivity. They also tested the method on complex protein-ligand docking tasks (GSK3$\beta$ and JNK3) and directed evolution for protein sequences using the ESM3-1.4B model.

Targeted Molecule Generation

ERA successfully shifted the distribution of generated molecules toward target properties while maintaining high chemical validity (around 85% without regularization, and even higher with it).

Distribution shifts of generated molecules for various target properties (Molar Refractivity, Ring Count, QED, LogP) after ERA alignment.

Superior Sample Efficiency

On complex docking tasks, ERA outperformed state-of-the-art methods, including PPO, PPOD, and REINVENT. It achieved near-perfect Top-10 AUC scores (0.985 and 0.989) while generating significantly more diverse molecules than competing methods.

Scaling to Large Protein Models

Demonstrating its scalability, the authors applied ERA to the massive ESM3-1.4B protein language model. In just a single round of alignment, ERA successfully steered the model to generate TrpB protein mutants with maximized evolutionary fitness scores.

Limitations and Future Directions

While ERA offers a robust alternative to PPO and DPO for continuous rewards, its success is entirely dependent on having a computable, accurate reward model. For highly complex biological tasks, evaluating the reward is expensive and noisy, which can act as a bottleneck.

Furthermore, the current models are aligned for chemical properties but not explicitly for synthetic accessibility. A model might design a "perfect" drug that is physically impossible or prohibitively expensive to synthesize in a lab. Future work will look to incorporate synthesizability oracles (like SCScore) into the reward functions and explore multi-round, "on-policy" ERA to guide actual wet-lab directed evolution campaigns.

Summary updated

BibTeX
@inproceedings{chennakesavalu2025aligning,
  author = {Shriram Chennakesavalu and Frank Hu and Sebastian Ibarraran and Grant M. Rotskoff},
  title = {{Aligning Transformers with Continuous Feedback via Energy Rank Alignment}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=SXxlb1miXS},
}
Figure