arXiv:2608.25034cs.LGAug 2026

Manuscript Offprint

arXiv:2608.25034

On the Representational Geometry of Dynamic Programs

Richard F. M. Lim, Ruriko Yoshida

Abstract

Standard neural architectures often fail to generalize to longer inputs for dynamic programming (DP) targets. We investigate what makes this hard geometrically. Every finite min-plus DP is a shortest path on a DAG, which is equivalently a tropical polynomial whose extended Newton polyhedron encodes the decision boundary of which path wins. We prove these three descriptions (graph, polynomial, polyhedron) form isomorphic semirings at two levels — formal polynomials and their computed functions — connected by operations that characterize all structural redundancies. We then address the length-generalization question geometrically: does the decision boundary at length T decide the boundary at T+1T + 1? We present two structural negatives. The semiring’s two native ways to reduce dimension (setting a variable to each identity) are neither injective nor always closed within the DP. Series and parallel composition fail to construct all DAG topologies from smaller sub-DAGs, and even all terminal-only operations do not capture all DP compositions.

1 Introduction

A dynamic program is defined by a recurrence that does not depend on the size of its input, so a model that has truly learned the recurrence would run at any length. Standard sequence architectures do not. Trained on combinatorial optimization targets, they fit the training lengths and then degrade sharply beyond them, a failure documented across recurrent and attention-based models and robust to scale [Delétang et al., 2023, Anil et al., 2022]. Tropical Attention [Hashemi et al., 2025] is a conspicuous exception; replacing addition and multiplication with max-plus (tropical) operations (max, +), it achieves strong length out-of-distribution (OOD) generalization on classic DP problems.

The premise is classical. After unrolling, every finite min-plus dynamic program is: (1) a single-pair shortest-path problem on a decision DAG with a single source ss and single sink zz, which we call two-terminal [Bellman, 1957, Gondran and Minoux, 1979]; and (2) a tropical polynomial [Joswig, 2021]. For alignment with the shortest-path formulation, we work throughout in the dual (min, +) semiring T=R∪{+∞}\mathbb{T} = \mathbb{R} \cup \{+\infty\}, equivalent to (max, +) under negation [Joswig, 2021]. We write a⊕b=min⁡(a,b)a \oplus b = \min(a, b) and a⊙b=a+ba \odot b = a + b when emphasizing the semiring structure.

Our work is focused on length generalization: a learner observes small graphs with at most T variables and must predict every graph after that. We therefore investigate whether this is possible via the questions: (1) What algebraic structure in DP allows algorithms to work on every length? (2) Does this structure allow us to infer larger instances from smaller ones?

Preprint.

Composing two-terminal DAGs in series adds their path lengths; composing them in parallel takes the minimum (Figure 3 in Appendix A). We first formalize the relationship between graphs, polynomials, and geometry via a triple semiring isomorphism (Section 2). Multiple formal polynomials may map to the same function — min⁡(0,x,2x)=min⁡(0,2x)\min(0, x, 2x) = \min(0, 2x) for all xx despite different supports — so we construct the formalism at both levels and relate them with congruence quotients. Graph structures are even richer than their polynomials, so we provide a canonical deshared normal form for every tropical polynomial and a list of invariant operations that traverse equivalence classes on DAGs (Section 3).

A natural way to relate larger instances to smaller ones is substitution at the semiring identities: setting a variable to +∞+ \infty removes it from a shortest-path or knapsack instance, while setting it to 0 removes it from a min-subarray or assignment instance. We employ the above framework to provide a characterization of length recovery under substitution in terms of graph, polynomial, polyhedron, and the decision boundary T(f)\mathcal{T}(f), known as the tropical hypersurface [Zhang et al., 2018]. We show in Section 4 that both substitutions are not always closed within the DP, and do not recover length even when they are: the T-th instance does not determine the (T+1)(T+1)-th. Finally, Section 5 identifies series and parallel composition as the two faces of Bellman's equation on decision DAGs, then exposes a two-layered topological insufficiency: together they do not generate all topologies of terminal-only operations, and terminal-only operations do not capture all DP compositions.

References (1)