Manuscript Offprint

arXiv:2611.04663

Best-of-Depth: Learning Exploratory Dynamics in Looped Transformers

Shota Takashiro, Takeshi Kojima, Masanori Koyama, Kohei Hayashi, Yusuke Iwasawa

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Looped Transformers extend inference-time computation through repeated latent-state updates, but final-depth training does not directly encourage useful intermediate alternatives. We introduce Best-of-Depth (BoD), which trains a recurrent trajectory as a candidate set by minimizing prediction loss across depths. Different valid targets can be matched at different depths without architectural changes or depth-specific labels. An exact-match analysis connects this objective to solution coverage. On N-Queens completion and graph coloring, BoD improves coverage over final-depth and intermediate-supervision objectives. N-Queens coverage reaches 91.03%, versus 45.75% for final-depth training. Further experiments show discovery beyond the training depth and recovery of solutions withheld from teacher pools on familiar inputs. Fine-tuning a pretrained looped language model with BoD yields higher pooled code-generation success than final-depth training when programs are generated separately at evaluated fixed depths. These results support training recurrent computation for solution discovery along its trajectory.

1 INTRODUCTION

Additional inference-time computation can improve a model's ability to solve problems (Snell et al., 2025; Brown et al., 2024). Looped Transformers accumulate computation by repeatedly applying a shared transformation to a latent state (Dehghani et al., 2019; Giannou et al., 2023; Yang et al., 2024). This extends computational depth without adding parameters, and greater recurrent depth can improve reasoning performance (Saunshi et al., 2025; Geiping et al., 2025). Making these models effective therefore involves learning how successive updates should contribute to solving a problem.

The learning objective can reflect how predictions are used at inference. Best-of-N sampling generates and verifies multiple candidate solutions, increasing the opportunity to find a correct answer beyond a single attempt (Brown et al., 2024; Cobbe et al., 2021). Inference-aware Best-of-N training incorporates this procedure into learning (Chow et al., 2025), while Explorative Modeling (XM) trains on the candidate that best matches a target (Gladstone et al., 2026). These approaches illustrate how learning objectives shape candidate generation. Recurrent models also offer multiple predictions, read out at successive depths along one trajectory. We therefore ask: Can a single recurrent trajectory be trained to visit distinct useful solution candidates?

Simply increasing recurrent computation does not guarantee distinct useful candidates. Recent work promotes fixed-point convergence for stability (Yang et al., 2026) or uses convergence for halting (Movahedi et al., 2026), but convergence alone does not determine which alternatives a trajectory discovers. Supervising only the final prediction (Dehghani et al., 2019; Saunshi et al., 2025) does not directly reward useful intermediate alternatives; supervising every depth against the same target asks all readouts to reproduce that target. Candidate-set evaluation suggests another criterion: the target should be reached somewhere within the depth budget. Because later predictions depend on preceding latent states, the learning problem is to train these coupled predictions collectively.

Figure

Figure 1: Learning alternative solutions along one recurrent trajectory. Top: One input admits multiple valid solutions. Middle: Schematic latent trajectories illustrate (a) repeated predictions under Last-Depth, (b) independent candidates from Best-of-N, and (c) distinct solutions along one BoD trajectory; shaded regions decode to A–C. Bottom: Both models reuse F0F_0 across depths. Last-Depth trains on LDL_D; BoD trains on the lowest loss across depths (highlighted L2L_2 for target A).

We introduce Best-of-Depth (BoD), which trains a recurrent trajectory as a candidate set using the minimum prediction loss across supervised depths (Figure 1). A shared decoder reads out predictions, and the loss at the selected depth trains the recurrent computation. Each target need only be matched at one depth, allowing different valid targets for the same input to be matched at different depths without a prescribed assignment or visitation order. The set-loss formulation is related to multiple-hypothesis learning (Guzmán-Rivera et al., 2012; Lee et al., 2016; Bhattacharyya et al., 2018); here, candidates are generated successively and coupled through shared latent dynamics. BoD requires no architectural changes, additional parameters, or depth-specific labels.

We study solution discovery theoretically and empirically. Under exact-match loss and uniformly sampled valid targets, minimizing expected BoD loss maximizes solution coverage. On N-Queens completion and graph coloring, where all valid solutions can be enumerated, Success@Depth measures whether any valid solution is found, while Coverage@Depth measures the fraction of the valid solution set recovered. Coverage therefore tests whether additional computation discovers alternatives after an initial solution is found. We also test discovery beyond teacher pools and training depth, and compare trajectory counts and depths under a fixed recurrent-step budget on these controlled tasks. For autoregressive code generation, we fine-tune Huggin (Geiping et al., 2025) and evaluate programs generated separately at different fixed depths.

We find that BoD recovers more distinct valid solutions on both controlled tasks. The N-Queens coverage reaches 91.03 coverage continues increasing after success nearly saturates, showing further discovery of valid alternatives. BoD also recovers solutions withheld from teacher pools on familiar inputs and finds new solutions beyond the training depth. BoD achieves higher pooled code-generation success than final-depth training on HumanEval and MBPP (Chen et al., 2021; Austin et al., 2021). On MBPP, it also gains more solved problems from pooling beyond depth 32 alone. Fixed-budget comparisons favor combining depth with multiple trajectories. Together with analyses of outputs and latent states, these results characterize how candidate-set training changes solution discovery along recurrent trajectories.

References (75)