Energy-Based Transformers are Scalable Learners and Thinkers

Alexi Gladstone, Ganesh Nanduru, Md Mofijul Islam, Peixuan Han, Hyeonjeong Ha +5 more
7/2/2025
cs.LGcs.AIcs.CL

No official code found. Best implementation: alexiglad/EBT (659 stars, Apache-2.0, last commit 2026-04-21). 1 more below.

Abstract

Inference-time computation techniques, analogous to human System 2 Thinking, have recently become popular for improving model performances. However, most existing approaches suffer from several limitations: they are modality-specific (e.g., working only in text), problem-specific (e.g., verifiable domains like math and coding), or require additional supervision/training on top of unsupervised pretraining (e.g., verifiers or verifiable rewards). In this paper, we ask the question "Is it possible to generalize these System 2 Thinking approaches, and develop models that learn to think solely from unsupervised learning?" Interestingly, we find the answer is yes, by learning to explicitly verify the compatibility between inputs and candidate-predictions, and then re-framing prediction problems as optimization with respect to this verifier. Specifically, we train Energy-Based Transformers (EBTs) -- a new class of Energy-Based Models (EBMs) -- to assign an energy value to every input and candidate-prediction pair, enabling predictions through gradient descent-based energy minimization until convergence. Across both discrete (text) and continuous (visual) modalities, we find EBTs scale faster than the dominant Transformer++ approach during training, achieving an up to 35% higher scaling rate with respect to data, batch size, parameters, FLOPs, and depth. During inference, EBTs improve performance with System 2 Thinking by 29% more than the Transformer++ on language tasks, and EBTs outperform Diffusion Transformers on image denoising while using fewer forward passes. Further, we find that EBTs achieve better results than existing models on most downstream tasks given the same or worse pretraining performance, suggesting that EBTs generalize better than existing approaches. Consequently, EBTs are a promising new paradigm for scaling both the learning and thinking capabilities of models.

View on arXivView PDF

Code Implementations(2)

alexiglad/EBTCommunity100%
Apache-2.0

PyTorch Code for Energy-Based Transformers paper -- generalizable reasoning and scalable learning

65989Shell, PythonJun 26, 20256 months agoApache-2.0
aideep-learninggenerative-aireasoningthinking
MIT

Simple replication of the article "Energy-Based Transformers are Scalable Learners and Thinkers" by Gladstone et al. (2025). WIP

10PythonAug 2, 20251 years agoMIT

Similar Papers

Cite this paper

@article{gladstone2025energybased,
  title  = {Energy-Based Transformers are Scalable Learners and Thinkers},
  author = {Alexi Gladstone and Ganesh Nanduru and Md Mofijul Islam and Peixuan Han and Hyeonjeong Ha and Aman Chadha and Yilun Du and Heng Ji and Jundong Li and Tariq Iqbal},
  year   = {2025},
  eprint = {2507.02092},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.02092v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.02092.svg)](https://codeofpaper.com/paper/2507.02092)

Discussion