Think Harder Where It Matters: Item-Level Adaptive Recursion for Sequential Recommendation
Zhanshuo Cao, Jiakai Tang, Yuqi Zhou, Sunhao Dai, Jun Xu
cs.IR, cs.AI, cs.CL, cs.LG
2026-10-22
LoopRec reuses one block and exits each item alone. All 48 comparisons beat fixed-depth models; mean NDCG@20 rises 11.14% on sparse Patio, at 0.41-0.76x compute.
Sequential recommenders read an interaction history in time order and score the next item. SASRec, BSARec, NextItNet, and LRURec use very different encoders, and all of them still give every history position the same number of layers. Repeat purchases carry little new signal. A rare exploration, or a click from moments ago, is what moves the current intent. Fixed depth idles on the easy positions and underserves the few that still change the ranking.
The diagnostic is a trained 3-layer SASRec on Amazon Office. Saturation depth is the earliest layer at which freezing that item's later updates leaves the Top-30 set unchanged. 76.14% of items saturate at layer 1, 93.28% by layer 2, and only 6.72% need all 3 layers. Shallow and deep items regularly share one sequence.
A second probe freezes the weights and only changes the exit layer of the five most recent positions. An oracle that can see the true next item picks the assignment with the best rank. Fixed depth is optimal on 4.6% of test sequences. Against that baseline the oracle gains 7.1% NDCG@20, 6.5% MRR@20, and 8.8% HR@20. The oracle peeks at the label, so those numbers are an upper bound. LoopRec has to learn a depth per position without depth labels.
Two constraints decide the shape of the model. States that exit at different depths still have to share one scoring space. And a position usually looks finished only after it has taken in another round of context. LoopRec reuses a single backbone block, written LxRy: x layers per pass, at most y passes. Shared weights keep an early exit and a late exit in the same feature space.
The forward pass has three stages. One shared encoding runs over the full history, so the gate sees context rather than the raw embedding. At each recursion boundary a small binary gate scores the current state plus a learned recursion embedding. Exit probability is one minus a sigmoid. At 0.5 or above the position stops and its state is frozen. Positions that continue keep their order and re-enter the same block under the causal mask. The active set shrinks each round, and the last round forces every survivor to stop. Stopping at round r means r times L layers of encoding. The readout adds the chosen hidden state, scaled by a depth-dependent weight, back onto the input token, then scores the next item.
The prediction loss stays next-item cross-entropy. A load-balance term pushes back when every position piles into one depth. A z-loss keeps the gate from locking before the hidden states settle. For the first few epochs every position is forced through the maximum depth and the router penalties are off. That warm-up length is chosen by validation NDCG@20.
Mixture-of-Recursions, the language-model cousin, either cuts a top-k capacity at each step or commits to a total depth up front. LoopRec does neither. Each round redecides from the current state. The block can be SASRec, BSARec, NextItNet, or LRURec.
The benchmarks are Software, Office, and Patio from Amazon Reviews 2023: leave-one-out, histories capped at 50, full-catalog ranking, users with at least 10 interactions. Patio is the sparsest at 99.96%, with 37,179 items and a mean history of 15.85. Metrics are MRR and NDCG at 10 and 20, means of five runs, with paired t-tests against the matched fixed-depth backbone.
All 48 backbone, dataset, and metric cells improve, 44 of them at p<0.05. Relative gains run from 0.69% to 49.07%. Averaged across backbones, NDCG@20 rises 3.92% on Software, 4.55% on Office, and 11.14% on Patio.
| Backbone | Dataset | Fixed NDCG@20 | LoopRec | Relative |
| SASRec | Software | 0.0944 | 0.0998 | +5.68% |
| SASRec | Office | 0.0582 | 0.0595 | +2.20% |
| SASRec | Patio | 0.0448 | 0.0458 | +2.19% |
| BSARec | Patio | 0.0453 | 0.0469 | +3.48% |
| LRURec | Software | 0.0958 | 0.1001 | +4.51% |
| NextItNet | Patio | 0.0192 | 0.0263 | +37.02% |
On attention models the lift is modest: 2.19% to 5.68% NDCG@20 for SASRec, 0.97% to 3.48% for BSARec. BSARec on Office gains 0.92% and 0.97% NDCG at 10 and 20, and neither is significant. LRURec gains 1.85% to 4.51% NDCG@20. NextItNet on Patio moves from 0.0192 to 0.0263, and its Office NDCG@20 rises 13.18%. Fixed-depth NextItNet on Patio is 0.0192, against 0.0448 for fixed-depth SASRec. The large percentage sits on a weak baseline.
Recent positions run deeper both in the learned router and in the saturation probe. On Office, items seen once in training have mean depth 2.160, and 29.1% of them take depth 4. Items with 100 or more interactions have mean depth 1.330; 88.6% stop at depth 1, and 10.7% reach depth 4. Later time deciles get more rounds. Under the 3-layer SASRec, the most recent quartile has mean saturation depth 1.76, against 1.16, 1.17, and 1.20 for the earlier three, and 30.3% of full-depth saturations fall in that recent slice.
A sequence-level loop reuses the same block on the whole history and has no per-item exit. It beats vanilla SASRec on Software and Office, and it does not on Patio. Full LoopRec is best on all three. On Software, NDCG@20 goes from 0.0950 for the sequence-level loop to 0.0998. On Office the two are 0.0595 and 0.0594. Dropping warm-up cuts average MRR@20 by 4.03% and NDCG@20 by 3.11%. Dropping both router regularizers cuts them by 5.36% and 4.25%. Selected compute falls to 0.407 to 0.755 times the fixed-depth reference. Encoder latency only falls to 0.869 to 0.995 times.
The backbone family and the next-item loss can stay as they are. The change is how many layers each history position gets. The same wrapper fits attention, frequency-biased attention, causal convolution, and a linear recurrence, so the gain tracks the allocation.
On the strong backbones, NDCG@20 moves by about 2% to 6%. That is an incremental improvement. The router spends extra depth on recent and rare items and lets frequent, older interactions stop early, the same direction as the saturation probe. On Office with SASRec it also beats hand-written position rules and frequency rules. The scores for those rules are only in the appendix.
Compute drops to 0.407 to 0.755 times the fixed budget, and latency stays at 0.869 to 0.995 times. A serving stack that is bound by wall clock will not feel this version. The maximum number of recursions is still chosen before training.
The diagnostics and the routing study sit on a 3-layer SASRec and on Office. Saturation depth only preserves the Top-30 set, so ranks inside that set can still move. The oracle searches five tail positions and sees the true next item. The 8.8% HR@20 lift is an upper bound. LoopRec raises that SASRec's NDCG@20 by 2.20% on the same data, and the learned router is never lined up against the oracle under one configuration.
NextItNet's largest relative jump still lands at 0.0263 NDCG@20 on Patio, below fixed SASRec at 0.0448. Four of the 48 cells are not significant: both NDCG numbers for BSARec on Office, and both MRR numbers for LRURec on Patio. On Office, sequence-level looping and item-level routing differ by 0.0001 NDCG@20, so most of the accuracy comes from shared recursion, and early exit is doing more for compute than for rank. Stopped positions never re-enter later blocks, and nothing in the main results tests whether long-range dependence suffers. The max round count is fixed before training. All three categories share one Amazon preprocessing pipeline, with no online test.