Search Relevance Experiments Plan
Overview
This plan outlines a comprehensive set of experiments to evaluate and improve search relevance in our system. We'll focus on four key methodologies: interleaving (live user behavior comparisons), counterfactuals (offline simulation from logs), click models (probabilistic relevance estimation), and guardrails (safety and quality controls).
Goals:
- Measure relevance improvements objectively.
- Compare candidate ranking models (e.g., baseline vs. new neural reranker).
- Ensure experiments are scalable, low-risk, and actionable.
Common Setup:
- Dataset: 1M+ anonymized search queries from production logs (past 30 days), with clicks, dwells, and skips.
- Metrics: Click-Through Rate (CTR), Normalized Discounted Cumulative Gain (NDCG@10), Mean Reciprocal Rank (MRR), Session Success Rate (SSR). For guardrails: Harm Rate (HR), Bias Score (BS).
- Tools: Offline eval framework (e.g., custom Python with RecBole/TREC-eval), live A/B platform (e.g., Eppo or internal), MLflow for tracking.
- Success Criteria: Statistical significance (p<0.01 via bootstrap), lift >5% on primary metric.
- Timeline: 4 weeks (Week 1: Design/Offline; Week 2-3: Live/Validation; Week 4: Analysis).
- Team/Risks: 2 ML engineers, 1 data scientist, 1 PM. Risks: Traffic allocation (mitigate with 1% exposure), data freshness (use real-time logs).
1. Interleaving Experiments
Interleaving pits two rankers (A: baseline, B: candidate) head-to-head in a single SERP by shuffling results and attributing clicks/exam/exits.
Experiment Variants
| Variant | Description | Traffic Split | Primary Metric | Duration |
|---|
| Dual Interleave | Alternate A/B positions randomly per query. Promote based on click wins. | 5% traffic | Interleave CTR lift | 7 days |
| Team Draft | Group results into "teams" (A vs. B), interleave within teams. | 2% traffic | Team-draft win rate | 5 days |
| Position-Aware | Bias interleaving toward top positions; control for bias with simulations. | 1% traffic | NDCG@5 (attr. via interleaves) | 3 days |
Implementation Steps
- Build interleaver: Python script using
numpy.random for shuffles, ensuring 50/50 exposure.
- Log attributions: Click on A-item → A win; no-click skip → potential loss.
- Analysis: Bradley-Terry model for win probabilities; t-test for significance.
- Guardrail: Cap exposure to safe queries (no sensitive topics).
Expected Output: Win rates (e.g., B beats A 55% → deploy candidate).
2. Counterfactual Experiments
Use logged data to simulate "what-if" scenarios without live traffic. Ideal for rapid iteration.
Experiment Variants
| Variant | Description | Eval Queries | Primary Metric | Compute Time |
|---|
| Log Replay | Rerank historical SERPs with candidate; compare to observed clicks. | 100K sessions | Counterfactual CTR | 2 hours |
| Bootstrap CI | Resample logs 1K times; estimate variance in relevance lift. | 500K queries | NDCG delta (95% CI) | 4 hours |
| Multi-Armed Bandit Sim | Simulate Thompson Sampling on logs to optimize ranking params. | 10K diverse queries | Regret minimization | 1 day |
Implementation Steps
- Extract logs: Query, impressions, clicks, features (e.g., via BigQuery).
- Simulator:
rerank_serp(logged_results, candidate_model) → predict_clicks().
- Bias Correction: Inverse Propensity Scoring (IPS) for position/exam bias.
- Validation: Compare to known A/B lifts from past tests.
Expected Output: Offline lift estimates (e.g., +8% NDCG) with confidence bounds; prioritize high-lift features.
3. Click Models Experiments
Train/fit click models to infer relevance from noisy click data, decoupling position bias.
Experiment Variants
| Model | Description | Training Data | Primary Metric | Fit Time |
|---|
| Position-Based (PBM) | P(click) = rel * pos_bias. Simple baseline. | 1M sessions | Log-likelihood | 30 min |
| Cascade (CM) | Users scan top-down, stop on first click. | 1M sessions | AUC on held-out clicks | 1 hour |
| Dynamic Bayesian (DBN) | Accounts for sessions, dwells, reformulations. Advanced. | 500K sessions | NDCG correlation w/ human labels | 4 hours |
| Neural (DeepCTR) | Embeddings + attention for complex biases. | Full logs | Counterfactual lift | 1 day |
Implementation Steps
- Preprocess: Bin positions, filter short sessions (<5s).
- Training: PyTorch/Scikit-learn; EM algorithm for unsupervised fit.
- Evaluation: Fit on train, predict relevance on test; compare inferred rel to editorial labels (if available).
- Ablation: Test bias correction impact (e.g., PBM vs. raw CTR).
Expected Output: Relevance scores for offline ranking; model comparison table (e.g., DBN > PBM by 12% AUC).
4. Guardrails Experiments
Integrate safety checks into relevance pipeline; evaluate trade-offs with utility.
Experiment Variants
| Variant | Description | Scope | Primary Metrics | Duration |
|---|
| Harm Filtering | Block/derank toxic results (e.g., via Perspective API). | All traffic | HR ↓, CTR trade-off | 3 days (1%) |
| Diversity Boost | Enforce min diversity score (e.g., MMIR metric). | Long-tail queries | BS ↓, NDCG@10 | 5 days (2%) |
| Query Rewrites | Guardrail rewrites for ambiguous/sensitive queries. | 10K edge queries | SSR ↑, False Pos Rate | Offline + 2 days live |
| Interleave w/ Guardrails | Interleave safe vs. aggressive rankers. | Full | Safe win rate | 7 days |
Implementation Steps
- Guardrail Pipeline: Pre-rank filter (toxicity >0.7 → drop), post-rank demotion.
- Offline Sim: Apply to logs; measure utility drop.
- Live Test: Shadow mode → full interleave.
- Monitoring: Alert on HR spikes; A/B stats with Bonferroni correction.
Expected Output: Pareto frontier (e.g., -2% CTR for -90% HR); deploy optimal guardrail config.
Analysis & Next Steps
- Cross-Validation: Run interleaving as gold standard; calibrate offline methods (counterfactuals/click models) to match.
- Reporting: Unified dashboard (e.g., Streamlit) with lifts, p-values, waterfalls.
- Iteration: Top performer → full rollout (10% traffic). Re-run quarterly.
- Budget: ~$5K compute (GPU hours), 80 engineer-days.
This plan is modular—start with offline (counterfactuals + click models) for quick wins, then scale to live. Questions? Let's iterate!