Skip to content

OnePiece: Bringing Context Engineering and Reasoning to Industrial Cascade Ranking System

OnePiece is a unified Transformer-based framework that ports two LLM design patterns — context engineering and multi-step latent reasoning — into both the retrieval and ranking stages of an industrial cascaded recommender. Heterogeneous signals (interaction history, preference anchors mined from domain knowledge, situational descriptors, candidate items) are packed into a structured token sequence; a stack of Transformer layers then performs block-wise latent reasoning, where each “block” of M tokens refines the user representation against the cached context via KV-caching. Progressive multi-task training uses naturally staged user feedback chains (exposure → click → add-to-cart → order) to supervise successive reasoning blocks. Deployed in Shopee’s main personalized search serving billions of users, OnePiece delivers +1.08% GMV/UU at retrieval, +1.12% GMV/UU and +2.90% advertising revenue at ranking.

  • Transplanting Transformer architectures alone (HSTU, ReaRec-style) into industrial ranking yields only incremental gains over strong DLRMs; the missing ingredients are LLM-style context engineering and multi-step reasoning [§1].
  • Context engineering packs four signal types into one tokenized sequence: Interaction History (chronological user-item events), Preference Anchors (e.g. top-clicked items per query, injecting collaborative-filtering priors), Situational Descriptors (static user/query features), and (for ranking only) Candidate Items with mutual inter-visibility attention [§3].
  • Block-wise latent reasoning refines representations over K iterative steps, where each step emits a block of M tokens (vs. ReaRec’s single-token-per-step recurrence); block size M is the “reasoning bandwidth” knob and KV-caching makes per-step cost O(Md²) on top of cached context [§4, complexity analysis].
  • Progressive multi-task training assigns each reasoning block a supervisory signal of increasing strength along the user feedback chain (exposure → click → add-to-cart → order), avoiding the gradient conflicts of single-embedding multi-task heads [§5].
  • Context engineering alone improves Recall@100 by +0.110 and click-AUC by +0.109 over the DLRM baseline; block-wise reasoning adds another +0.047 Recall@100 and +0.030 click-AUC on top [§6, ablations].
  • OnePiece achieves higher data efficiency than DLRM/HSTU/ReaRec and keeps improving with longer training spans, while DLRM plateaus quickly [§6, Fig. 4].
  • Ranking-side block-size scaling shows monotonic AUC gains with diminishing returns past M≈12 [§6, block-size sweep].
  • Online A/B at Shopee: retrieval +1.08% GMV/UU, +0.98% Paid Order/UU, −0.17% Bad Query Rate; ranking +1.12% GMV/UU, +2.90% advertising revenue [§7].
  • In retrieval A/B, OnePiece covers ~70% of impressions recalled by other routes while delivering 2× higher exclusive contribution than DLRM, indicating it both subsumes existing recall strategies and surfaces novel-but-relevant items [§7].
  • Inference latency is 25% lower than the DLRM retrieval path (30ms vs. baseline) despite the reasoning steps, thanks to KV-cached reuse of the backbone context [§7].

OnePiece is a pure Transformer backbone (no DLRM-style feature-cross modules) that operates in two phases. The context-encoding phase consumes a structured token sequence — Interaction History, Preference Anchors (auxiliary item sequences built from domain heuristics like “top-clicked items for this query”), Situational Descriptors, and, in ranking mode, Candidate Items with bidirectional inter-visibility attention. The block-wise reasoning phase then unrolls K iterative blocks; each block contributes M new tokens that attend to all cached context plus prior reasoning blocks via KV-caching, so per-step cost grows only in M and not in the context length N. In retrieval each block contains two global tokens (user + personalization); in ranking each block contains M candidate-aware tokens.

Training is progressive multi-task: the K reasoning blocks are aligned with successive levels of the user feedback funnel (exposure → click → add-to-cart → order), so each block receives a distinct, increasingly sparse supervision signal. This distributes the multi-task supervision across depth rather than across heads, which the ablations show prevents the gradient-conflict failure mode of standard single-embedding multi-task setups.

At serving time, retrieval uses HNSW ANN over the precomputed user vectors; ranking fuses block-wise reasoning outputs via a learned score-fusion strategy.

  • Offline (Shopee 30-day log, June 11 – July 10 2025; billion-scale users across SEA and LATAM): Recall@100 0.485 (ReaRec+PA) → 0.517 (OnePiece); ranking C-AUC 0.862 (ReaRec+PA) → 0.911 (OnePiece) [§6, Table].
  • Ablations: context engineering alone +0.110 Recall@100 / +0.109 click-AUC over DLRM; block-wise reasoning adds +0.047 / +0.030 on top [§6].
  • Scaling: OnePiece keeps improving with more training-log days while DLRM plateaus; ranking-side block-size sweep shows monotonic AUC gains with optimum at M≈12 [§6, Fig. 4 + block-size table].
  • Online A/B (Shopee personalized search, full deployment): retrieval +1.08% GMV/UU, +0.98% Paid Order/UU, −0.17% Bad Query Rate; ranking +1.12% GMV/UU, +2.90% advertising revenue [§7].
  • Coverage: OnePiece retrieval subsumes ~70% of impressions from other recall routes and contributes 2× more exclusive impressions than DLRM [§7].
  • Latency: 25% reduction in retrieval inference time (30ms) vs. DLRM baseline despite the added reasoning steps [§7].

OnePiece is the first paper on the wiki applying the LLM-style “context + reasoning” template to industrial cascade ranking at billion-user scale, and it gives a clean industrial datapoint for two threads the wiki has been tracking on the foundation-model side. (1) The block-wise latent reasoning here is a close cousin of the iterative-refinement idea in Looped Transformers — both refine representations across multiple steps rather than via a single forward pass, and both treat the reasoning width (block size M here, loop count L there) as a tunable compute knob — but OnePiece anchors that idea in a production system with reported GMV gains rather than benchmark FID/PPL, and uses task-staged supervision (exposure → click → order) per reasoning step rather than ground-truth supervision at every prefix. (2) Compared to the inference-compute-for-capability flavors in Inference-Time Scaling (KV-cache compression, scaffold-side sub-LM calls, interaction-depth scaling, parallel-agent orchestration, test-time weight updates), OnePiece’s block count K is fixed at training time and the reasoning lives entirely inside a single forward pass — it’s a trained-in iterative refinement, not a serving-time compute knob, which is what places it more squarely in the looped-transformer family than the inference-time-scaling one. The 2× exclusive-impression contribution vs DLRM is the kind of evidence that’s hard to get from offline benchmarks alone and suggests the structured-context route discovers genuinely different candidates rather than just re-ranking the same ones.

  • Looped Transformers — block-wise latent reasoning is a recommendation-system instance of iterative representation refinement; OnePiece’s “reasoning bandwidth via block size M” parallels ELT/Hyperloop’s “depth via loop count L”
  • ELT: Elastic Looped Transformers for Visual Generation — closest architectural relative on the wiki: elastic loop count as an inference-time compute knob, the same “more iterations → better representations” intuition applied to visual generation rather than ranking
  • Inference-Time Scaling — adjacent but distinct: OnePiece’s K reasoning steps are fixed at training time, not a runtime knob, so it does not belong to the inference-time-scaling family despite the iterative-refinement aesthetic