Skip to content

Menu

WorksComputer Science

Tropical Reinforcement Learning

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_dk8e3q8t. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

Reinforcement learning for large language models typically maximizes expected return, adding up the probabilities of all successful trajectories. However, the classical sum formulation can only report how often the model policy succeeds, not which solution actually worked, and because probabilities sum to one, reinforcing one solution can make the model forget another that was never shown to be wrong. This makes expected return a poor fit for compositional reasoning, where a solution must be assembled from reasoning steps that the model produces in separate, often failed, attempts but rarely produces together. To address this, we propose Tropical Reinforcement Learning, which rests on a simple change of algebra: instead of adding the probabilities of alternative solutions, we take their maximum, which yields the tropical semiring. The value of a state then becomes the log-probability of its most likely verified solution, together with an explicit path that can be replayed and reused. This enables true composition, since the best prefix and the best suffix meeting at a shared state can be joined even when they come from different rollouts. To put this into practice, we introduce TROPIC, a training algorithm for deterministic, resettable environments with verifiable outcomes. On four agentic tasks (Sokoban, Countdown, FrozenLake, WebShop), TROPIC outperforms the strongest on-policy baselines by up to 16 percentage points. Changing the algebra of reinforcement learning, not just its estimators, can thus substantially improve compositional reasoning in language models

Introduction

The best solution a language model can produce is often one it has never produced. A model may know how to formalize a problem, derive an intermediate result, invoke the right theorem, and check an answer, and may have done each of these in earlier attempts, yet never have chained them in the order a new problem requires (Press et al., 2023; Lake & Baroni, 2018). Reinforcement learning with verifiable rewards (RLVR) is the standard post-training tool for closing this gap by sampling many attempts and reinforcing the ones a verifier accepts ([8] (Kimi Team et al. 2025; GLM-5-Team et al. 2026; Yuan et al. 2026; Wen et al. 2026)). However, the classical expected-return formulation learns only from what it samples, as a trajectory is credited only after the policy has generated it end-to-end. Recent works therefore focus on trajectory design, improving which rollouts are sampled and how they are credited ([9] (Wang et al. 2026; Li et al. 2026)). Yet these methods keep the expected-return objective, and with it the requirement that a solution be sampled in one piece. For composition, this requirement is the bottleneck: a solution that chains dd fragments, each found in a separate attempt, is sampled in one piece with probability exponentially small in dd, even though the model has already produced every part of it.

Beyond failing to reward composition, expected return can also actively suppress the fragments it requires. Suppose the model produces outcomes AA, BB, their composition A∘BA \circ B, and a failure 00, with probabilities (pA,pB,pAB,p0)(p_A,p_B,p_{AB},p_0). The first receives reward once, so JER=pA+pB+pABJ_{\mathrm{ER}} = p_A + p_B + p_{AB}, but the composition has not yet been sampled. Moving from (0.30,0.30,0,0.40)(0.30, 0.30, 0, 0.40) to (0.90,0.05,0.05,0.05)(0.90, 0.05, 0.05, 0.05) raises expected reward from 0.60 to 0.95. Yet the probability that a batch of twenty rollouts contains BB at least once drops from 1−0.7020≈0.9991 - 0.70^{20} \approx0.999 to 1−0.9520≈0.6421 - 0.95^{20} \approx0.642. The objective has improved, but one of the two fragments that A∘BA \circ B requires is now absent from about a third of all batches. In general, a high expected reward bounds the total probability of currently successful behavior, but places no lower bound on any individual fragment that a future composition requires. This is consistent with recent findings that loss of policy entropy and reasoning diversity limits what RL post-training can achieve [7] (Jin et al. 2026).

Both problems stem from the same choice: expected return adds up the probabilities of alternative trajectories. A sum does not record which trajectory succeeded, so fragments from different rollouts cannot be combined, and, because probabilities sum to one, raising one term lowers another. Tropical RL changes this algebra. It still adds log-probabilities along each trajectory, but combines alternative trajectories by their maximum, which yields the max-plus, or tropical, semiring. The value of a state becomes the log-probability of its most likely verified path, and, because addition distributes over the maximum, it splits at any shared state into a best prefix and a best suffix, possibly from different rollouts. Compositions can thus be assembled without ever being sampled in one piece, and since the maximum ignores all but the best path, the value never loses a verified path once found. RL thus shifts from learning what the policy samples to learning what can be assembled from it.

We develop this shift from first principles to a practical algorithm. Our contributions are: (i) a DIAGNOSIS: we show that expected return, by adding probabilities over alternative trajectories, loses track of which solution succeeded and lets verified solutions be forgotten (Section 3); (ii) a FORCING RESULT: we prove that the maximum is the only aggregation whose value always names a verified path and never decreases as new paths are found (Theorem 2); and (iii) TROPIC: an algorithm of Tropical RL for agentic environments that joins fragments across rollouts and outperforms all baselines (Fig. 4, Fig. 1) on every task and model we test, by up to 16 points over the strongest one.

Preliminaries

Notations. Let xx denote a reasoning problem and let a state s∈Ss \in S represent a computational interface, such as a token prefix. An action a∈A(s)a \in\mathcal{A}(s) is a token, reasoning step, tool call, or reusable computation that produces the next state s′=T(s,a)s' = T(s, a). Let πˉ(a∣s)\bar{\pi}(a|s) denote a frozen language model used as a decoding or search prior. For a trajectory τ=(s0,a0,s1,a1,…,sH)\tau= (s_0, a_0, s_1, a_1, \ldots, s_H), its probability under the frozen model is Pπˉ(τ∣s0)=∏t=0H−1πˉ(at∣st)P_{\bar{\pi}}(\tau\mid s_0) = \prod_{t=0}^{H-1} \bar{\pi}(a_t|s_t). Consequently, log⁡Pπˉ(τ∣s0)=∑t=0H−1log⁡πˉ(at∣st)\log P_{\bar{\pi}}(\tau\mid s_0) = \sum_{t=0}^{H-1} \log\bar{\pi}(a_t \mid s_t). Let Rx(y)∈{0,1}R_x(y) \in\{0,1\} be a terminal verifier applied to a complete response yy. We write V+(s)={τ:τ starts at s and terminates at y with Rx(y)=1}\mathcal{V}^{+}(s) = \{\tau: \tau\text{ starts at } s \text{ and terminates at } y \text{ with } R_x(y) = 1\} for the set of verified successful continuations from ss. A verified trajectory may receive a terminal quality score Rx(τ)R_x(\tau). ST\mathcal{S}_{\mathrm{T}} is the set of terminal states, and Rx(s)R_x(s) is the terminal score for task xx.

Compositional reasoning and generalization. We call a solution compositional when it is a sequence of reusable computations, τ=f1∘⋯∘fd\tau= f_1 \circ\cdots\circ f_d, in which each fragment fif_i, such as a reduction, a theorem application, or an arithmetic step, starts at the state produced by the previous one. Compositional reasoning is the ability to produce such a sequence for a given problem. Compositional generalization is the ability to solve problems whose solutions combine known fragments in a way that has not been observed before (Lake & Baroni, 2018; Keysers et al., 2020; Press et al., 2023). In this paper, “not observed” has a specific meaning: every fragment of the solution may already have appeared in some rollout, but never all of them together in a single one. The question we study is how a learner can turn fragments found in separate attempts into a verified solution that it was never able to sample.

Expected-Return RL. In a deterministic computation graph, the corresponding Bellman equations are Qπˉ(s,a)=r(s,a)+Vπˉ(T(s,a))Q^{\bar{\pi}}(s,a) = r(s,a) + V^{\bar{\pi}}(T(s,a)), Vπˉ(s)=∑a∈A(s)πˉ(a∣s)Qπˉ(s,a)V^{\bar{\pi}}(s) = \sum_{a \in\mathcal{A}(s)} \bar{\pi}(a \mid s)Q^{\bar{\pi}}(s,a). With binary verification on a deterministic computation graph, the classical Bellman equation is Vπˉ(s)=∑aπˉ(a∣s)Vπˉ(T(s,a))V^{\bar{\pi}}(s) = \sum_a \bar{\pi}(a \mid s)V^{\bar{\pi}}(T(s,a)) with Vπˉ(y)=Rx(y)V^{\bar{\pi}}(y) = R_x(y) at terminals. It uses two operations: probabilities of successive steps are multiplied, and probabilities of alternative actions are added. Unrolling the recursion yields

Vπˉ(s)=∑τ∈V+(s)∏tπˉ(at∣st)=∑τ∈V+(s)Pπˉ(τ∣s).(1)V^{\bar{\pi}}(s) = \sum_{\tau\in\mathcal{V}^{+}(s)} \prod_t \bar{\pi}(a_t \mid s_t) = \sum_{\tau\in\mathcal{V}^{+}(s)} P_{\bar{\pi}}(\tau\mid s). \tag*{(1)}

The classical value therefore has a direct operational meaning: Vπˉ(s)V^{\bar{\pi}}(s) is the probability that one continuation sampled from πˉ\bar{\pi}, beginning at ss, will eventually be accepted by the verifier.

The Algebra of Expected Return

Expected return is a path sum in the semiring (R≥0,+,×)(\mathbb{R}_{\ge0}, +, \times) (Eq. (1)): steps along a path combine by ⊗=×\otimes= \times, and alternative paths combine by ⊕=+\oplus= +. The two operations play different roles. We keep the first and identify the second as the source of the problem.

Multiplying step probabilities is the autoregressive factorization of the model. In log space it becomes a sum of fragment scores: for an edge f=(s,uf,s′)f = (s, u_f, s') and a path τ\tau,

w(f)=∑j=1∣uf∣log⁡πˉ(uf,j∣x,s,uf,<j),W(τ)=∑f∈τw(f)=log⁡Pπˉ(τ∣s).(2)w(f) = \sum_{j=1}^{\lvert u_f\rvert} \log\bar{\pi}(u_{f,j} \mid x, s, u_{f,<j}), \qquad W(\tau) = \sum_{f\in\tau} w(f) = \log P_{\bar{\pi}}(\tau\mid s). \tag*{(2)}

A composed path is scored from its fragments without resampling, and because multiplication distributes over addition, the value admits dynamic programming.

Adding the probabilities of alternative continuations has three properties. Each is a strength when the goal is the success probability of a single sample, and a weakness when the goal is to retain and compose computations. (i) Addition is not selective. a+ba+b is the score of no single path, so the value reports how much of the actor succeeds, not which computation succeeds (Observation 1). (ii) Addition acts on normalized weights. Since ∑aπˉ(a∣s)=1\sum_a \bar{\pi}(a\mid s)=1, raising one alternative lowers the others (Proposition 1). (iii) Addition is not idempotent. a+a=2aa+a=2a: a computation found twice counts twice, so what is sampled often is reinforced more (Appendix § 12.§ 3).

The sum does not say which computation succeeds. Composition needs the most accessible verified continuation, the one to reuse:

Mπˉ(s)=max⁡τ∈Yx+(s)Pπˉ(τ∣s).(3)M^{\bar{\pi}}(s) = \max_{\tau\in\mathcal{Y}^{+}_{x}(s)} P_{\bar{\pi}}(\tau\mid s). \tag*{(3)}

Observation 1 (Non-sufficiency). No function gg satisfies Mπˉ(s)=g(Vπˉ(s))M^{\bar{\pi}}(s)=g(V^{\bar{\pi}}(s)) for all states and continuation sets.

Proof. Let Yx+(s)={τ1}\mathcal{Y}^{+}_{x}(s)=\{\tau_1\} with Pπˉ(τ1∣s)=0.5P_{\bar{\pi}}(\tau_1\mid s)=0.5, and Yx+(s′)={τ2,τ3}\mathcal{Y}^{+}_{x}(s')=\{\tau_2,\tau_3\} with Pπˉ(τ2∣s′)=Pπˉ(τ3∣s′)=0.25.ThenP_{\bar{\pi}}(\tau_2\mid s')=P_{\bar{\pi}}(\tau_3\mid s')=0.25. ThenV^{\bar{\pi}}(s)=V^{\bar{\pi}}(s')=0.5$, while Mπˉ(s)=0.5M^{\bar{\pi}}(s)=0.5 and Mπˉ(s′)=0.25M^{\bar{\pi}}(s')=0.25.

The gap can be arbitrarily large: nn continuations of probability 1/n1/n give Vπˉ=1V^{\bar{\pi}}=1 but Mπˉ=1/nM^{\bar{\pi}}=1/n. The converse also fails, since {0.5}\{0.5\} and {0.5,0.25}\{0.5, 0.25\} share Mπˉ=0.5M^{\bar{\pi}}=0.5 but differ in VπˉV^{\bar{\pi}}. Once alternatives are added, the sum cannot tell which computations produced it (Figure 2).

A difference between expected $V$ and max $M$ continuation

Figure 2. A difference between expected VV and max MM continuation.

The sum can forget a verified solution. We call a value policy-indexed if it depends only on the current policy, Vt(s)=Φ(πθt,s)V_t(s)=\Phi(\pi_{\theta_t},s). Every on-policy expected-return method is policy-indexed, with or without baselines, critics, or entropy bonuses.

Proposition 1 (Policy-indexed values forget). Let ss have two actions a,ba,b with independent softmax logits. The continuation after bb always succeeds, Vπˉ(T(s,b))=1V^{\bar{\pi}}(T(s,b))=1, and the continuation after aa succeeds half the time, Vπˉ(T(s,a))=12V^{\bar{\pi}}(T(s,a))=\frac{1}{2}. Suppose a batch samples only aa at ss, some of these rollouts succeed, and the group baseline is below 11, so aa receives estimated advantage A^>0\hat{A}>0. Then after one policy-gradient step, π+(b∣s)<π(b∣s)\pi^{+}(b\mid s)<\pi(b\mid s) and Vπˉ+(s)<Vπˉ(s)V^{\bar{\pi}^{+}}(s)<V^{\bar{\pi}}(s), even though no rollout observed bb and the verifier’s judgement of the continuation through bb is unchanged.

References

  1. [1]Azwar Abdulsalam, Nishil Patel, and Andrew Saxe. RL Post-Training Builds Compositional Reasoning Strategies. arXiv preprint arXiv:2607.07646, 2026. URL https://arxiv.org/abs/2607.07646.
  2. [2]Marianne Akian, Stéphane Gaubert, and Asma Lakhoua. The Max-Plus Finite Element Method for Solving Deterministic Optimal Control Problems: Basic Properties and Convergence Analysis. SIAM Journal on Control and Optimization, 47(2):817–848, 2008. doi: 10.1137/060655286.DOI
  3. [3]Francis Bach. Max-Plus Matching Pursuit for Deterministic Markov Decision Processes. arXiv preprint arXiv:1906.08524, 2019.arxiv.org/abs/1906.08524
  4. [4]Eloise Berthier and Francis Bach. Max-Plus Linear Approximations for Deterministic Continuous-State Markov Decision Processes. IEEE Control Systems Letters, 4(3):767–772, 2020. doi: 10.1109/LCSYS.2020.2973199.DOI
  5. [5]Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. OpenAI Gym, 2016. URL https://arxiv.org/abs/1606.01540.
  6. [6]Bradley Brown, Jordan Juravsky, Ryan Ehrlich, Ronald Clark, Quoc V. Le, Christopher Ré, and Azalia Mirhoseini. Large Language Monkeys: Scaling Inference Compute with Repeated Sampling. arXiv preprint arXiv:2407.21787, 2024. URL https://arxiv.org/abs/2407.21787.
  7. [7]Gangu Cui, Yuchen Zhang, Jiacheng Chen, Lifan Yuan, Zhi Wang, Yuxin Zuo, Haozhan Li, Yuchen Fan, Huayu Chen, Weize Chen, Zhiyuan Liu, Hao Peng, Lei Bai, Wanli Ouyang, Yu Cheng, Bowen Zhou, and Ning Ding. The Entropy Mechanism of Reinforcement Learning for Reasoning Language Models, 2025. URL https://arxiv.org/abs/2505.22617.
  8. [8]DeepSeek-AI et al. DeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligence, 2026. URL https://arxiv.org/abs/2606.19348.
  9. [9]Lang Feng, Zhenhai Xue, Tingcong Liu, and Bo An. Group-in-Group Policy Optimization for LLM Agent Training, 2025. URL https://arxiv.org/abs/2505.10978.
  10. [10]Xiyan Fu and Wei Liu. Reinforcement Learning for Compositional Generalization with Outcome-Level Optimization. arXiv preprint arXiv:2605.04920, 2026. URL https://arxiv.org/abs/2605.04920.

Machine contribution statement

This work lists 4 machine contributors.

  • OpenAI ChatGPT · AI contributor

    Roles
    SoftwareWriting — review & editing
    Verification
    self-declared at submission
  • Anthropic Claude · AI contributor

    Roles
    SoftwareWriting — review & editing
    Verification
    self-declared at submission
  • Codex · AI contributor

    Roles
    SoftwareWriting — original draftWriting — review & editing
    Verification
    self-declared at submission
  • Claude Code · AI contributor

    Roles
    SoftwareWriting — review & editing
    Verification
    self-declared at submission

Recorded on the work at submission, not per version. Names and roles are shown as submitted; roles use the CRediT taxonomy.

How machine contributions are recorded

Paper details

Citation

Cite
Published
Version
Latest

Data & code

No code, data or supplementary files were declared for this version.

Table 1

1 / 4
Contents

Pick where to look, or just type