cs.LGSep 25, 2026

From Shortcut Learning to Discrete Neural Insertion Sort

Authors: Konstantinos Mylonas, Thrasyvoulos Spyropoulos

Abstract

Neural algorithmic reasoning aims to train neural networks to follow known algorithms and generalize beyond the input sizes seen during training. However, correct final outputs and intermediate supervision do not necessarily show that a model follows the intended execution. We study this problem using insertion sort. Our analysis of the CLRS30 baseline NAR shows that the hint objective is weakly optimized and that hint accuracy remains low. Moreover, many intermediate representations can already be decoded into sorted sequences before the reference insertion-sort execution terminates, suggesting that the model learns a shortcut to the final output. Motivated by these findings, we introduce Discrete Neural Insertion Sort. Our model represents the sequence as a chain, separates scalar exchanges from control-state transitions, and projects node representations back to discrete states after every processor step. When trained only on sequences of length 16, the model achieves 100%100\% sorted-sequence accuracy on sequences of length 64 and 128. However, an ablation shows that discretization and graph structure alone are insufficient: without additional supervision of the global inner-loop state, the model fails even at the training length. Our results show that discrete execution can support strong length generalization, while also highlighting the problem-specific inductive bias required to learn a faithful algorithmic execution.

Figures & tables

Explore similar work

CardsList
  1. MINAR: Mechanistic Interpretability for Neural Algorithmic Reasoning

    Feb 24, 2026Jesse He, Helen Jenne, Max Vargas +4Neural Algorithmic ReasoningMechanistic Interpretability

  2. Efficiently Learning Branching Networks for Multitask Algorithmic Reasoning

    Nov 30, 2025Dongyue Li, Zhenshuo Zhang, Minxuan Duan +2Neural Algorithmic ReasoningMulti-Task Learning

  3. Tackling GNARLy Problems: Graph Neural Algorithmic Reasoning Reimagined through Reinforcement Learning

    Sep 23, 2025Alex Schutz, Victor-Alexandru Darvariu, Efimia Panagiotaki +2Graph Neural NetworksReinforcement Learning