Language models are increasingly used to recommend items to anonymous shoppers. These are visitors with no login and no history, only the handful of products they clicked in the current visit. The model reads those clicks as text and guesses what the shopper wants next. Long-context research has shown that language models neglect information in the middle of their input, and that they reason worse when two facts that must be combined sit far apart. A browsing session has exactly that shape: a shopper looks at a camera body early, wanders through a dozen unrelated items, then looks at a lens. This note proposes to measure whether LLM recommenders fail on such sessions because the related clicks are separated, rather than because the inference itself is hard. If separation is the cause, it can be fixed cheaply. A small graph model scores the clicks once, and the prompt is then reordered so that clicks likely to belong to the same intent sit next to each other. Each click keeps its original timestamp label, so no order information is thrown away.
The two-sentence version is this. We think LLM session recommenders lose accuracy on long, noisy sessions mainly because intent-bearing clicks are spread apart in the prompt, the "lost in-between" effect, and not because the reasoning chain is too deep. We will test that claim with controlled sessions, then fix it with a single-call reordering of the prompt that moves linked clicks next to each other while keeping their chronological index tags.
What is known and what is missing
LLM session recommenders motivate the work, and they also show its blind spot. PO4ISR turns item IDs into titles and runs a four-step prompt that discovers item combinations, infers intent, selects the most representative intent, and reranks candidates. It refines the prompt through self-reflection and chooses among prompts with a bandit. Re2LLM builds a bank of "hint" lessons from past errors and uses a small reinforcement-learning agent to pick which hints to inject. Both papers evaluate short sessions and never vary where informative clicks sit in the prompt. Re2LLM also reports 5.2 seconds per query, so any fix that multiplies the number of LLM calls starts at a disadvantage.
The long-context literature supplies the mechanism we expect, and it also limits the designs available to us. Lost in the Middle moved a gold document among 20 distractors and found a U-shaped accuracy curve, with GPT-3.5-Turbo falling from about 75% to about 53%. Lost in the Middle, and In-Between showed that in multi-hop question answering the distance between the evidence pieces matters on its own. Its HotpotQA 2-hop accuracy dropped from about 50% with adjacent evidence to 45% with separated evidence. The same paper found that summarization and triple extraction flatten the positional curve but lower overall accuracy. That negative result rules out compression as our fix. Positional contrastive decoding (PCD) shows that the right answer often survives inside the model's top candidates and can be recovered at decoding time. It has been tested only on single-point retrieval benchmarks.
The reasoning-decay literature supplies the confound we must separate out. PRONTOQA-OOD, DyVal, and GSM-DC show that accuracy falls with chain depth and with the number of distractors. In GSM-DC, Grok-3-Beta's step accuracy on 5-step problems fell from 43% with one distractor to 19% with fifteen. None of these works places the evidence at controlled separations, so none can say whether depth or distance drives the failure.
On the recommender side, PR4SR argues that intent often skips across non-adjacent clicks and that models over-trust the last click. It handles this with reinforcement-learning walks over a knowledge graph, not with language-model prompts. DHCN found on Tmall that removing position embeddings helped, which suggests that the set of clicked items often matters more than their order. That finding is what makes reordering plausible. Our scorer comes from SR-GNN and TAGNN, whose attention over session graphs already produces a relevance weight for each click.
The closest existing work is Baker et al.'s in-between study. It covers documents in question answering, not clickstreams. It does not separate distance from depth, and its fix, compression, loses information. Our fix moves content around and deletes nothing.
Research Program
The first component is a controlled session generator. We start from real sessions in which a small "core" set of one to three clicks predicts the held-out target. We pad each session with distractor clicks drawn from other sessions in the same catalog, following the padding protocol of Lost in the Middle. Three factors are varied independently. The first is the absolute position of the core set. The second is the gap between core clicks. The third is the hop depth, meaning how many core items must be combined. To remove the model's memorized product knowledge, a second, synthetic arm uses a fictional catalog in the spirit of PRONTOQA-OOD. Here the target is defined by explicit compatibility rules of controlled depth, so the ground-truth core set is known exactly.
The second component is the analysis. We fit accuracy as a function of position, gap, and depth jointly. The question is which factor explains the variance once the other two are held fixed. We also log the rank of the target among the candidates. This tells us whether failures resemble PCD's "right answer is nearby but not picked" pattern or reflect reasoning that has gone off track entirely.
The third component is the fix, which we call co-located serialization. A trained SR-GNN or TAGNN scores each click's relevance to the session, and the scores are used to group clicks into likely intent clusters. The prompt then lists the clusters with their members adjacent to each other, the highest-scoring cluster nearest the question, and every click tagged with its original index, for example "[click 3 of 14]". The method needs one graph forward pass and one LLM call. We also measure an oracle version that uses the planted core set, which gives an upper bound and separates errors in the scorer from errors in the idea.
Baselines
The do-nothing reference is the plain chronological prompt run through the same open RoPE-based model and the same PO4ISR-style instructions. Every reordering is compared against it on identical sessions and identical candidate sets.
The strongest LLM competitor is PO4ISR, run with its own prompt-optimization budget of 50 training sessions. Its reported gains are relative: an average improvement of 57.37% in HR@5 and 61.03% in NDCG@5 over baselines across ML-1M, Amazon Games, and Bundle. The file gives no absolute value, so we will reproduce PO4ISR ourselves. We also include Re2LLM, which reports HR@5 of 0.4126 on Movie with 500 training samples. We give both the same model and the same number of inference calls as our method. Our serialization can be layered on top of PO4ISR, and beating it means a statistically reliable HR@5 gain on long sessions with no loss on short ones.
The strongest non-LLM competitors are SR-GNN and TAGNN, trained on the full data. SR-GNN reports Precision@20 of 50.73% on Diginetica and MRR@20 of 30.94 on Yoochoose 1/64. We report the same metrics on those datasets so the numbers are comparable. Because our fix depends on a GNN, it must beat the GNN alone, or the LLM adds nothing.
PCD is run with its published contrast strength tuned on the same validation split. Summarization of the session before prompting is the compression baseline. Placing the last item at the end of the prompt is the recency baseline.
The ablations isolate the key ingredient. One version places high-scoring clicks at the prompt edges without making them adjacent, which isolates adjacency from edge placement. One reorders clicks randomly while keeping the index tags. One uses co-location with the index tags removed, which tests whether chronology still matters after reordering.
Why not just…?
Why not just use SR-GNN or TAGNN, which have no positional bias? Graph models do avoid prompt position effects. However, they work on item IDs and degrade when made deeper, as DHCN's collapse beyond three layers shows. PO4ISR reports large few-shot gains over graph baselines. We include the graph models directly, and if they match the LLM pipeline on long sessions, we will report that LLM recommenders are not worth their cost in this regime.
Why not just average predictions over several shuffled orderings? This is the real threat. Averaging over k permutations removes position bias without any learned scorer. It costs k LLM calls, which is serious when one call already takes about 5 seconds in Re2LLM, and random orderings rarely place related clicks next to each other. We run cost-matched comparisons at k equal to 1, 3, and 5. If a 3-permutation ensemble matches co-location, we will say plainly that the contribution is a threefold cost saving rather than an accuracy gain.
Why not just compress or summarize the session? Baker et al. found that compression flattens the positional curve while lowering accuracy, because it drops details. Short item titles leave little room to compress without losing the attribute that links two clicks. The summarization baseline tests whether this holds for sessions.
Why not just apply PCD? PCD fixes cases where the target is already near the top of the model's ranking. Our rank logging shows what fraction of failures are of that kind. If most are, PCD should match our method, and the two can also be combined.
Proposed Experiments
The real-session arm uses Diginetica and Yoochoose 1/64 for comparison with the graph models. It uses ML-1M and Amazon Games for the PO4ISR protocol, which ranks the target among a candidate set and reports HR@5 and NDCG@5. Sessions are bucketed by natural length and also padded to 10, 20, and 40 clicks. The synthetic arm uses the fictional catalog with depths of 1 to 4 hops and gaps of 0 to 30 clicks.
The first decisive check is whether, at a fixed position and depth, accuracy falls as the gap between core clicks grows. If it does not, the separation hypothesis is wrong and the fix has no basis. The second check is whether oracle co-location recovers most of the gap-induced loss while edge-only placement does not. This would show that adjacency, not edge placement, is the active ingredient. The third check is whether GNN-scored co-location keeps most of the oracle gain at single-call cost and beats the cost-matched permutation ensemble and PCD on long sessions. The final check concerns hop depth. If depth still causes a residual drop after co-location, that would show where genuine multi-hop reasoning decay begins once the positional confound is removed.
References
- Large Language Models for Intent-Driven Session Recommendations
- Re2LLM: Reflective Reinforcement Large Language Model for Session-based Recommendation
- Lost in the Middle: How Language Models Use Long Contexts
- Lost in the Middle, and In-Between: Enhancing Language Models' Ability to Reason Over Long Contexts in Multi-Hop QA
- Mitigating Posterior Salience Attenuation in Long-Context LLMs with Positional Contrastive Decoding
- Testing the General Deductive Reasoning Capacity of Large Language Models Using OOD Examples
- DyVal: Dynamic Evaluation of Large Language Models for Reasoning Tasks
- How Is LLM Reasoning Distracted by Irrelevant Context? An Analysis Using a Controlled Benchmark
- Explainable Session-Based Recommendation via Path Reasoning
- Self-Supervised Hypergraph Convolutional Networks for Session-based Recommendation
- Session-Based Recommendation with Graph Neural Networks.
- TAGNN: Target Attentive Graph Neural Networks for Session-based Recommendation