Saved in:
Bibliographic Details
Main Authors: Alon, Yoav, David, Cristina
Format: Preprint
Published: 2026
Subjects:
Online Access:https://arxiv.org/abs/2604.00039
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910091012210688
author Alon, Yoav
David, Cristina
author_facet Alon, Yoav
David, Cristina
contents Determining whether a program terminates is a core challenge in program analysis with direct implications for correctness, verification, and security. We investigate whether transformer architectures can recognise termination patterns directly from source code and how their strengths can be amplified through ensembles. To overcome the extreme scarcity of non-terminating examples, we design an ensemble framework of compact transformer encoders, systematically trained with a suite of imbalance-aware loss functions and class-aware sampling techniques. By combining models trained with distinct loss functions, our ensembles achieve substantially stronger performance than any single transformer, outperforming both powerful off-the-shelf LLMs and graph-based methods. Finally, we introduce an attribution pipeline that produces syntax-aware explanations for the termination estimation.
format Preprint
id arxiv_https___arxiv_org_abs_2604_00039
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Transformers for Program Termination
Alon, Yoav
David, Cristina
Programming Languages
Machine Learning
Determining whether a program terminates is a core challenge in program analysis with direct implications for correctness, verification, and security. We investigate whether transformer architectures can recognise termination patterns directly from source code and how their strengths can be amplified through ensembles. To overcome the extreme scarcity of non-terminating examples, we design an ensemble framework of compact transformer encoders, systematically trained with a suite of imbalance-aware loss functions and class-aware sampling techniques. By combining models trained with distinct loss functions, our ensembles achieve substantially stronger performance than any single transformer, outperforming both powerful off-the-shelf LLMs and graph-based methods. Finally, we introduce an attribution pipeline that produces syntax-aware explanations for the termination estimation.
title Transformers for Program Termination
topic Programming Languages
Machine Learning
url https://arxiv.org/abs/2604.00039