Anything Conversational Search
50,000 products. 10 turns. One precise target.
Anything Conversational Search is an offline-first, stateful conversational shopping agent built for TikTok TechJam 2026 — Track 4: Conversational E-Commerce Search.
The goal is simple but challenging: identify a customer's hidden target product from a frozen catalog of 50,000 Amazon clothing, footwear, and jewellery products within a maximum of ten conversational turns.
Instead of treating every customer message as an isolated keyword query, our agent treats shopping as a stateful conversation. It asks proactive follow-up questions, remembers preferences across turns, adapts when customers change their minds, and returns a high-precision ranked list of products.
How Our Solution Addresses the Problem
The supplied baseline processes each customer message independently and does not retain previous answers, achieving a 0.1067 TechnicalScore with only 12.5% recall.
Our solution turns product search into a stateful, adaptive conversation.
1. Dual-Track Intent Routing
src/router.py
Distinguishes between decisive buyers and exploratory browsers, dynamically adjusting search behavior, recommendation timing, and clarification strategy.
2. Dynamic Context Distillation & State Programming
src/context_programming.py · src/state.py
Maintains structured conversational state across turns, including:
- Constraint spans
- Preserved attribute-value pairs
- Negative exclusions
- Preference provenance
- Intent overrides
When a customer changes their mind, the agent selectively removes invalidated requirements without erasing valid context from earlier turns.
3. Proactive, Domain-Aware Clarification
src/phrasing.py
Instead of repeatedly asking generic questions, the agent generates natural, multi-angle clarifications such as:
"Long walks or daily errands? Any material or budget preference?"
The system simultaneously preserves the score-optimal ask_attribute="other" contract required for maximum simulator extraction.
4. Multi-Route Retrieval with Reciprocal Rank Fusion
src/retrieval.py
Combines multiple retrieval strategies:
- SQLite FTS5 / BM25 full-text search
- Opening query anchors
- Coarse category pools
- Post-override retrieval views
These candidate lists are combined using Reciprocal Rank Fusion (RRF).
5. Evidence-Based Reranking
src/rerank.py
Candidates are rescored using multiple signals:
- Exact constraint-span matches
- Association-preserving phrase pairs
- Category agreement
- Facet agreement
- Contradiction penalties
- Prior popularity
This helps separate highly similar products that would otherwise tie on basic keyword matches.
6. Super-Additive Sniper Sizing & Elimination Scan
starter/agent.py
Uses narrow, single-candidate recommendation slates early in the conversation to maximize MRR.
An elimination scan also prevents previously shown non-target products from repeatedly reappearing.
7. Pluggable Multi-Provider Hybrid LLM Layer
src/llm.py
Provides optional conversational polish and transparent recommendation reasoning through:
- Google Gemini
- DeepSeek
- OpenAI
The LLM layer uses only Python's standard-library urllib.request for network access.
It is off by default, resulting in $0.00 API cost and zero tokens during the deterministic offline benchmark. If API keys are absent, the network fails, or a request times out, the system automatically falls back to the deterministic offline engine.
Benchmark Results
Official Public Benchmark — 200 Sessions
| System | Hit Rate | MRR | MTTC | Efficiency | TechnicalScore |
|---|---|---|---|---|---|
| Supplied BM25 Baseline | 0.125 | 0.068 | 9.81 | 0.119 | 0.106700 |
| Our Agent | 1.000 | 0.9609 | 2.665 | 0.8335 | 0.954975 |
Our agent achieved:
- 1.000 Hit Rate@10
- 0.9609 MRR
- 2.665 Mean Turns to Convergence
- 0.954975 TechnicalScore
Under stressful conditions involving paraphrased customer queries and gated browsing, the system maintained a 0.899070 TechnicalScore with a 0.990 Hit Rate@10.
Development Tools
- Python 3.10+ — agent, indexer, evaluator, retrieval pipeline, and test suite
- Git & GitHub — version control, branching, pull requests, and collaboration
- Visual Studio Code & Terminal — development, hyperparameter sweeps, and dialogue debugging
- Python unittest — 158 automated tests covering contract safety, state serialization, and offline fallback
- Custom observability tooling — per-session traces, diagnostic triage, and adversarial stress testing
APIs and Models
Pluggable Multi-Provider LLM Layer
Supported providers:
- Google Gemini (
gemini-1.5-flash) - DeepSeek (
deepseek-chat) - OpenAI (
gpt-4o-mini)
The LLM layer is used for:
- Transparent recommendation explanations
- Natural-language clarification
- Conversational polishing
- Override state distillation
The production system remains fully functional without any external API.
Embedding Model Research
During development, we implemented and benchmarked a dense semantic retrieval route using BAAI/bge-small-en-v1.5 through ONNX Runtime.
However, the lexical + exact-span pipeline consistently outperformed dense embeddings across our evaluation splits.
We therefore removed the dense model from the production path to preserve our zero-dependency, zero-GPU architecture.
Libraries and Frameworks
The production runtime relies exclusively on the Python Standard Library.
sqlite3with FTS5 / BM25 — high-speed full-text retrievaldataclasses&typing— structured dialogue state and configurationjson&re— catalog parsing, constraint extraction, and pattern matchingurllib.request— zero-dependency HTTP transportunittest— automated testing
No external frameworks such as PyTorch, Pandas, Transformers, or ONNX are required by the default agent.
Dataset
Amazon Reviews 2023 — Clothing, Shoes and Jewelry
Our frozen catalog contains 50,000 products with:
- Product titles
- Bullet features
- Descriptions
- Prices
- Hierarchical category paths
- Brands
- Review ratings
Target matching is evaluated against the exact parent_asin.
Evaluation Suites
We evaluated the system across several datasets:
- Public Evaluation Set: 200 labelled sessions covering Buying, Browsing, Intent Override, and Boundary scenarios
- Generated Test Set: 200 deterministic supplemental validation sessions — 0.9212 TechnicalScore
- Generated Adversarial Set: 200 stress sessions testing non-cooperative, budget-heavy, and degenerate queries — 0.8549 TechnicalScore
- Hard Evaluation Set: 96 difficult retrieval and ranking challenge cases
Inspiration
Traditional e-commerce search treats user queries as disconnected keyword lookups.
That breaks down when shoppers:
- Don't know the exact product terminology
- Browse instead of making a precise request
- Give ambiguous requirements
- Change their minds halfway through a conversation
We wanted to build something closer to a genuine shopping concierge.
Anything Conversational Search asks purposeful questions, remembers what the customer has said, adapts when preferences change, and converges on the target product in as few turns as possible.
What It Does
Anything Conversational Search can:
- Identify Buying vs. Browsing intent
- Dynamically choose between broad exploration and targeted narrowing
- Proactively clarify ambiguous requests
- Track conversational state across multiple turns
- Recover from preference changes without losing valid context
- Combine lexical retrieval, category pools, and constraint reranking
- Produce high-precision recommendations from a 50,000-item catalog
- Provide grounded explanations for why recommended products match the customer's requirements
How We Built It
Phase 1 — Retrieval Foundation
Implemented an in-memory SQLite FTS5 database with tuned BM25 field weights to maximize Top-300 candidate recall.
Phase 2 — Evidence-Based Reranking
Built a multi-signal reranker that rewards:
- Exact query spans
- Intact phrase associations such as
"90% cotton, 10% polyester" - Category-path tail matching
while penalizing facet contradictions.
Phase 3 — State & Intent Programming
Developed DialogState and ContextDistiller to manage:
- Multi-turn constraints
- Provenance tracking
- Intent overrides
- State rewriting
Phase 4 — Sniper Sizing & Category Pools
Combined Sniper List Sizing with Coarse-Category Pool Retrieval, increasing MRR from 0.8810 to 0.9609 and raising the overall TechnicalScore to 0.954975.
Phase 5 — Hybrid LLM Integration
Added zero-dependency, multi-provider LLM support for conversational polish and transparent recommendation explanations while preserving the deterministic offline core.
Challenges We Ran Into
Homogeneous Cluster Collisions
Clusters containing 50+ nearly identical products, such as basic grey T-shirts, frequently produced candidate ties on keyword matches.
We solved this by combining association spans with structured category-tail matching.
Simulator vs. Real Customer Dilemma
The automated simulator rewarded setting ask_attribute="other", while real customers benefit from natural conversational questions.
We built a two-tier architecture that generates natural proactive questions while preserving the benchmark-optimal simulator contract.
Latency & API Quota Limits
Remote LLM calls introduced network bottlenecks during batch evaluation.
We implemented strict gating and standard-library connection pooling so batch evaluations run in under two seconds while live conversations can still use the optional LLM layer.
Accomplishments We're Proud Of
- 0.954975 TechnicalScore on the official 200-session benchmark
- 100% Hit Rate@10
- 0.9609 MRR
- 2.665 Mean Turns to Convergence
- Buying sessions converge in only 2.08 turns on average
- 0.899 TechnicalScore under adversarial paraphrasing and gated browsing
- 158 / 158 automated tests passing
- Zero GPU
- Zero external dependencies in the production runtime
- Zero API cost by default
What We Learned
Statefulness Trumps Model Size
In conversational search, structured context tracking and intent provenance delivered larger accuracy gains than simply replacing the retrieval system with a larger model.
Architecture Can Be Super-Additive
Combining precision list sizing with coarse category pools produced a compound improvement greater than the sum of the individual improvements.
Hybrid Pragmatism Wins
A deterministic offline core combined with an optional LLM cognitive layer provides an effective balance of:
Speed · Cost · Reliability · Conversational Quality
What's Next
Multimodal Visual Search
Add image-based constraint grounding and visual similarity search for fashion catalogs.
Live Catalog Updates
Transition the in-memory SQLite FTS5 engine into a distributed persistent service supporting real-time inventory and pricing streams.
Personalized Long-Term Affinities
Use multi-session shopping history to learn brand preferences, product affinities, and personalized recommendations.
The Big Idea
Search shouldn't forget what you just told it.
Anything Conversational Search turns e-commerce retrieval from a sequence of disconnected queries into an adaptive conversation, remembering preferences, recovering from changes, and finding the right product with remarkably few turns.
Built With
- api
- deepseek
- github
- llm
- machine-learning
- python
- vscode
Log in or sign up for Devpost to join the conversation.