Query as Anchor: Scenario-Adaptive User Representation via Large Language Model

Jiahao Yuan, Yike Xu, Jinyong Wen, Baokun Wang, Ziyi Gao, Xiaotong Lin, Yun Liu, Xing Fu, Yu Cheng, Yongchao Liu, Weiqiang Wang, Zhongle Xie

Abstract

Industrial-scale user representation learning requires balancing robust universality with acute task-sensitivity. However, existing paradigms primarily yield static, task-agnostic embeddings that struggle to reconcile the divergent requirements of downstream scenarios within unified vector spaces. Furthermore, heterogeneous multi-source data introduces inherent noise and modality conflicts, degrading representation. We propose Query-as-Anchor, a framework shifting user modeling from static encoding to dynamic, query-aware synthesis. To empower Large Language Models (LLMs) with deep user understanding, we first construct UserU, an industrial-scale pre-training dataset that aligns multi-modal behavioral sequences with user understanding semantics, and our Q-Anchor Embedding architecture integrates hierarchical coarse-to-fine encoders into dual-tower LLMs via joint contrastive-autoregressive optimization for query-aware user representation. To bridge the gap between general pre-training and specialized business logic, we further introduce Cluster-based Soft Prompt Tuning to enforce discriminative latent structures, effectively aligning model attention with scenario-specific modalities. For deployment, anchoring queries at sequence termini enables KV-cache-accelerated inference with negligible incremental latency. Evaluations on 10 Alipay industrial benchmarks show consistent SOTA performance, strong scalability, and efficient deployment.

Introduction

In industrial AI ecosystems like Alipay, user representation learning serves as the foundation for personalization, risk management, and digital marketing. Traditional approaches typically compress a user's multi-faceted history into a single static embedding. However, this "one-size-fits-all" paradigm faces significant hurdles. A single vector often fails to capture the distinct nuances required for different tasks—for instance, a user's preference for electronics (marketing) versus their likelihood of credit default (risk). Additionally, the gap between symbolic, sparse behavioral logs and the dense natural language space of Large Language Models (LLMs) complicates effective modeling.

To address these challenges, researchers from Ant Group developed Q-Anchor, a framework that transitions from static encoding to dynamic, query-aware synthesis. By treating natural language task descriptions as "semantic anchors," the model selectively extracts relevant features from complex user histories, providing task-specific representations on demand.

Methodology

The Q-Anchor framework reimagines user modeling as a query-response task, utilizing a multi-stage pipeline to bridge behavioral data with semantic understanding.

Hierarchical Coarse-to-Fine Encoder

Rather than feeding raw, noisy logs directly into an LLM, Q-Anchor employs a three-level hierarchical encoder (Event → Modality → User). This structure distills multi-source data—such as bills, app usage, and search queries—into a format compatible with LLM processing. This approach mitigates the modality gap and ensures the model focuses on high-level behavioral patterns.

Query-as-Anchor and Joint Optimization

The core of the framework is the "Anchor Tower" architecture. The LLM processes the user's history and appends a natural language query (e.g., "Is the user price-conscious?"). The model is trained using a dual-tower setup with joint optimization: Contrastive Alignment ensures that similar user-query pairs are clustered in the vector space, while Next-Token Prediction (NTP) ensures the model retains a deep semantic understanding of user behavior.

The Q-Anchor framework architecture, including the coarse-to-fine user encoder, joint pre-training, and soft prompt tuning stages.

Scenario Adaptation and Deployment

To adapt to specific business logic without full model retraining, the framework utilizes Cluster-based Soft Prompt Tuning. Learnable tokens act as differentiable task controllers, aligning the model's attention with scenario-specific modalities. For industrial deployment, Q-Anchor leverages KV-cache sharing. By processing the user's history once and storing it, the model can compute multiple scenario-specific queries (e.g., one for risk, one for marketing) with nearly instantaneous incremental latency.

Experimental Setup

The model was pre-trained on UserU, a massive industrial dataset containing 102.4 million user behavior sequences aligned with LLM-generated query-answer pairs. Performance was evaluated across 10 real-world Alipay benchmarks categorized into three domains: User Engagement, Risk Control, and Marketing Sensitivity.

Results and Discussion

Q-Anchor demonstrates significant improvements over existing state-of-the-art (SOTA) models. It outperformed top-tier general embedding models, such as Llama-Embed-Nemotron-8B, by +9.8% in AUC and +38.4% in KS (Kolmogorov-Smirnov) score, a critical metric for ranking stability in industrial applications.

Performance comparison on Alipay benchmarks showing Q-Anchor (Deepfind) significantly outperforming general and user-specific baselines in Average KS Score.

Key Insights

  • The Semantic Lens: Natural language queries act as a lens, filtering out high-entropy noise and focusing the model on task-relevant behavioral patterns.
  • The Scaling Paradox: Interestingly, the researchers found that a 0.5B parameter model outperformed 1.5B and 3B versions. This suggests that larger models may face "gradient attenuation," making them harder to optimize for discriminative embedding alignment under fixed data budgets.
  • Real-World Impact: Live A/B testing at Alipay confirmed the framework's effectiveness. In marketing scenarios, it increased the drawdown rate for cash-reserve outreach by 12.5%, while in risk management, it improved credit delinquency identification by 1.96% (KS score).

Conclusion

Q-Anchor represents a shift toward more flexible and efficient user representation learning. By integrating LLMs with a query-aware anchoring mechanism, the framework reconciles the need for universal understanding with the demand for scenario-specific precision. While the "Scaling Paradox" highlights ongoing challenges in optimizing large-scale embedding models, the current 0.5B parameter implementation offers a highly effective and deployable solution for complex industrial ecosystems.

Summary updated

BibTeX
@misc{yuan2026query,
  author = {Jiahao Yuan and Yike Xu and Jinyong Wen and Baokun Wang and Ziyi Gao and Xiaotong Lin and Yun Liu and Xing Fu and Yu Cheng and Yongchao Liu and Weiqiang Wang and Zhongle Xie},
  title = {{Query as Anchor: Scenario-Adaptive User Representation via Large Language Model}},
  year = {2026},
  eprint = {2602.14492},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.14492},
}
Figure