Audience sizing is a critical component of digital marketing. It enables precise resource allocation, campaign planning, and performance optimization. Traditional approaches using skeleton audiences, sampling, or predictive modeling suffer from significant delays, estimation errors, and poor scalability over high-dimensional profile data. We present REALMS (Real-time Exact Audience sizing via LLM-based Multi-attribute Search), a conversational system for exact audience sizing deployed in production on an enterprise customer data platform. REALMS enables marketers to query massive profile stores with millions of profiles and thousands of attributes using natural language and receive precise counts in seconds. The system introduces three key components: (1) a categorical attribute retrieval mechanism using embedding-based vector search to dynamically identify relevant schema attributes without manual configuration; (2) an LLM-powered NL2SQL pipeline with template-based in-context learning for accurate query generation over complex nested schemas; and (3) schema standardization enabling industry-agnostic deployment across diverse enterprise environments. Evaluation on real enterprise data demonstrates strong recall for attribute retrieval, high SQL execution accuracy, and low latency, which enables real-time interactive audience insights where prior methods required hours.
Figures & tables
Fig. 1: Comparative Analysis of Conventional and REALMS (Our Approach) for Real-time Exact Audience Sizing Over Large-Scale Enterprise Profiles.
Skeleton
Sampling
Predictive
REALMS
Audiences
Techniques
Models
(Ours)
Real-time
×
×
×
✓
Exact sizing
✓
×
×
✓
Compute needed
High
Medium
High
Medium
TABLE I: Comparison of audience sizing approaches.
Fig. 2: High-level system architecture of REALMS: offline pre-processing and real-time AI Assistant runtime.
Fig. 3: Offline pre-processing and hydration flow.
Fig. 4: Five stages demonstration of the REALMS runtime query processing pipeline.
Fig. 5: End-to-end REALMS runtime flow.
RPM
Conc.
#Req
#Fail
Med (s)
Avg (s)
P95 (s)
P99 (s)
10
1
15
0
5.9
6.7
11.0
11.0
30
5
68
0
8.3
8.3
12.0
13.0
60
10
105
2
10.0
10.5
14.0
15.0
TABLE II: Load test results under varying RPM and conc. users.
Task
Metric
Score
Schema attribute retrieval
Recall@ k
94%
Exact-match rate@ k
93%
Structured query correctness
Execution match
90%
LLM-as-a-judge match
95%
TABLE III: Performance on the evaluation dataset (accuracy %).
Method
Execution Match (%)
LLM-Judge Match (%)
REALMS (Full)
90%
95%
– w/o KG-RAG
68%
72%
– w/o Schema Retrieval
57%
63%
– Random Example Retrieval
72%
75%
TABLE IV: Ablation study of REALMS for structured query correctness.
# Attributes
Recall@5 (%)
Execution Match (%)
LLM-Judge Match (%)
1 Attribute
100%
100%
99%
2 Attributes
98%
94%
97%
3 Attributes
93%
88%
93%
TABLE V: Performance under different query complexities.
Per-user LLM inference on transaction histories binds the inference budget linearly to user count, which becomes prohibitive at applied scale. We re-cast attribute inference from per-user to per-transaction-pattern. The pipeline runs in three phases: Resolve abstracts item names with optional web grounding, Profile infers attributes for each frequent pattern, and Tag clusters free-text attributes into a queryable database. In Profile, a single LLM call per pattern emits predefined categorical labels, free-text attributes, and per-attribute prevalence estimates. Because inference runs over patterns rather than users, the budget grows with the pattern count rather than the user count. On the public Open e-commerce corpus, the database is statistically indistinguishable from an LLM that reads each user's raw history directly in AUC across the evaluated attributes, and the prevalence estimates carry discriminative signal between positive and negative users. The pipeline is deployed at a major Japanese bank profiling on the order of tens of millions of users, with close to a three-order-of-magnitude reduction in LLM inference targets versus a per-user pipeline. The code is publicly available on https://github.com/CyberAgentAILab/profiling-agent-open-ecommerce.
The evolution of customer support systems is rapidly advancing with agentic chatbots, yet these systems face significant limitations when accessing enterprise data without predefined API endpoints. This paper presents SAFAARI (Schema-Aware Framework for Accelerated Advertiser Response Intelligence), a multi-agent framework that addresses the critical bottleneck of schema linking in Natural Language to SQL (NL-to-SQL) systems through specialized content, metadata, and orchestration agents. We also introduce SEAL (Schema Evaluation and Accuracy in Language-to-SQL), a novel composite metric that holistically evaluates system performance while penalizing inconsistent results. Through systematic experimentation with five feature set configurations, SAFAARI achieves an 81.66% SEAL score (6.65% improvement over baseline), with notable gains in datapoint accuracy (5.51%) and schema-linking precision (4.69%). The framework's effectiveness is validated through human-in-the-loop evaluation with domain experts, which proves its adaptability across diverse support domains. By automating the labor-intensive process of schema linking and query generation, our framework demonstrates 8x reduction in development time while maintaining high accuracy. The solution streamlines API development and enhances self-service capabilities, particularly benefiting customer support enterprises with complex data ecosystems.
Dynamic Product Ads (DPA) require retrieving relevant items from multi-million product catalogs, balancing two competing objectives: retargeting (re-surfacing known interests) and prospecting (discovering new categories). While Large Language Models (LLMs) capture semantic intent better than traditional embedding models, deploying them at scale introduces prohibitive inference costs and lexical mismatch issues. Through controlled experiments on millions of users, we demonstrate a critical retrieval decomposition: rule-generated queries excel at retargeting on a lexical BM25 index, while LLM-generated queries excel at prospecting on a dense ANN index. Building on this, we propose SMART (SeMantic-aware Adaptive ReTrieval). To manage costs, a lightweight quality gate identifies coverage gaps in initial keyword results, adaptively routing only the ~10% of users who benefit from semantic prospecting to the LLM path. Offline evaluation demonstrates that this gated approach captures the bulk of semantic prospecting gains in Relevance Score while maintaining competitive re-targeting performance at a 90% reduction in LLM costs. Finally, in a 2-week online A/B test at Snap, SMART improved the ad conversion rate by +27.6% over a strong embedding-based baseline.
Congfei Zhang, Jingxiao Ma, Xiaodong Liu +14
Snap Inc. Bellevue, WA, USA · Snap Inc. Seattle, WA, USA · Snap Inc. Palo Alto, CA, USA +1