entrenar_bench/
lib.rs

1//! Distillation benchmarking and hyperparameter sweep tool.
2//!
3//! This crate provides tools for:
4//! - Systematic hyperparameter sweeps
5//! - Statistical analysis of results
6//! - Comparison of distillation strategies
7//!
8//! # Toyota Way Principles
9//!
10//! - **Kaizen**: Data-driven optimization through systematic experimentation
11//! - **Muda Elimination**: Avoid wasted training runs through early stopping
12//! - **Visual Control**: Clear visualization of benchmark results
13
14pub mod stats;
15pub mod strategies;
16pub mod sweep;
17
18pub use stats::{StatisticalAnalyzer, TestResult};
19pub use strategies::{DistillStrategy, StrategyComparison};
20pub use sweep::{SweepConfig, SweepResult, Sweeper};
21
22use entrenar_common::Result;
23
24/// Run a temperature sweep.
25pub fn temperature_sweep(
26    range: std::ops::Range<f32>,
27    step: f32,
28    runs_per_point: usize,
29) -> Result<SweepResult> {
30    let config = SweepConfig::temperature(range, step).with_runs(runs_per_point);
31    Sweeper::new(config).run()
32}
33
34/// Compare multiple distillation strategies.
35pub fn compare_strategies(strategies: &[DistillStrategy]) -> Result<StrategyComparison> {
36    strategies::compare(strategies)
37}
38
39#[cfg(test)]
40mod tests {
41    use super::*;
42
43    #[test]
44    fn test_temperature_sweep_returns_results() {
45        let result = temperature_sweep(1.0..4.0, 1.0, 1);
46        assert!(result.is_ok());
47    }
48}