trueno/brick/tracing/mod.rs
1//! Model-Level Inference Tracing (Phase 13, E.11)
2//!
3//! Comprehensive tracing system for transformer model inference:
4//! - MLT-01: LayerActivationTrace - anomaly detection per layer
5//! - MLT-02: AttentionWeightTrace - attention pattern analysis
6//! - MLT-03: LogitEvolutionTrace - token probability evolution
7//! - MLT-04: QuantizationErrorTrace - quantization quality metrics
8//! - MLT-05: KvCacheStateTrace - KV cache efficiency tracking
9//!
10//! # Example
11//!
12//! ```rust,ignore
13//! use trueno::brick::{ModelTracer, ModelTracerConfig};
14//!
15//! let config = ModelTracerConfig::lightweight();
16//! let mut tracer = ModelTracer::new(config);
17//!
18//! tracer.begin_forward(position);
19//! // ... forward pass with trace hooks ...
20//! if let Some(anomaly) = tracer.end_forward() {
21//! log::warn!("Anomaly: {}", anomaly);
22//! }
23//! ```
24
25mod activation;
26mod attention;
27mod kv_cache;
28mod logit;
29mod quant_error;
30mod quant_type;
31mod tracer;
32
33pub use activation::{LayerActivationTrace, ModelActivationTrace, TensorStats};
34pub use attention::{AttentionTraceConfig, AttentionWeightTrace};
35pub use kv_cache::{KvCacheSessionTrace, KvCacheStateTrace};
36pub use logit::{LogitEvolutionTrace, TokenLogitEvolution};
37pub use quant_error::{ModelQuantizationError, QuantizationErrorTrace};
38pub use quant_type::QuantType;
39pub use tracer::{ModelTracer, ModelTracerConfig, ModelTracerSummary};