Expand description
A/B Testing Framework for Embedding Models (v0.3.0)
Production-ready framework for comparing embedding model variants with:
ModelVariant: encapsulates a model with metadata and metrics collectionABTestConfig: configures traffic splits, metric targets, and test durationABTestRunner: routes inference requests between variants and records outcomesABTestAnalyzer: statistical significance testing (Welch’s t-test, Mann-Whitney U)ABTestReport: generates detailed comparison reports
§Design
The framework is model-agnostic: any function from an input key to a
Vec<f64> embedding qualifies as a “model variant”. This keeps the A/B
framework decoupled from specific GNN or KGE implementations.
§Example
use oxirs_embed::ab_testing::{ABTestConfig, ABTestRunner, ModelVariant};
let control = ModelVariant::new("transe-v1", |_key: &str| vec![0.0f64; 64]);
let treatment = ModelVariant::new("transe-v2", |_key: &str| vec![0.1f64; 64]);
let config = ABTestConfig::default();
let mut runner = ABTestRunner::new(config, control, treatment)?;
// Simulate requests
for i in 0..200 {
let key = format!("entity:{i}");
let (embedding, variant_name) = runner.route(&key)?;
// Record a business metric (e.g., link prediction hit@10)
runner.record_metric(&variant_name, 0.85)?;
}
let report = runner.analyze()?;
println!("{}", report.summary());Structs§
- ABTest
Analyzer - Statistical significance testing for A/B experiment results.
- ABTest
Config - Configuration for an A/B test.
- ABTest
Report - Full A/B test analysis report.
- ABTest
Runner - Routes inference requests between two variants and records metrics.
- Mann
Whitney Result - Result of Mann-Whitney U test.
- Model
Variant - A named embedding model variant for A/B testing.
- Observation
- A single metric observation from a model variant.
- TTest
Result - Result of Welch’s two-sample t-test.
- Variant
Stats - Summary statistics for one variant’s metric observations.
Enums§
- Optimize
Metric - Metric to optimize / compare between variants.
- Winner
- Which variant won the A/B test.