Skip to main content

Module inference

Module inference 

Source
Expand description

Real-Time Audit Log & Explainability for APR Format Models

§Toyota Way: 現地現物 (Genchi Genbutsu)

Every decision is traceable to ground truth. All predictions can be explained.

§Architecture

  • DecisionPath: Model-specific explanation of how a decision was made
  • DecisionTrace: Complete record of a single prediction
  • Explainable: Trait for models that can explain their predictions
  • TraceCollector: Strategy for collecting decision traces

§Collectors

  • RingCollector: Stack-allocated, <100ns, for games/drones
  • StreamCollector: Write-through, <1µs, for persistent logging
  • HashChainCollector: SHA-256 chain, <10µs, for safety-critical

§Example

use entrenar::monitor::inference::{
    InferenceMonitor, RingCollector, LinearPath,
};

let model = LinearRegressor::load("model.apr")?;
let collector = RingCollector::<LinearPath, 64>::new();
let mut monitor = InferenceMonitor::new(model, collector);

let prediction = monitor.predict(&input);
let traces = monitor.traces();

Re-exports§

pub use collector::ChainEntry;
pub use collector::ChainVerification;
pub use collector::HashChainCollector;
pub use collector::RingCollector;
pub use collector::StreamCollector;
pub use collector::StreamFormat;
pub use collector::TraceCollector;
pub use counterfactual::Counterfactual;
pub use counterfactual::FeatureChange;
pub use provenance::Anomaly;
pub use provenance::AttackPath;
pub use provenance::CausalRelation;
pub use provenance::IncidentReconstructor;
pub use provenance::NodeId;
pub use provenance::ProvenanceEdge;
pub use provenance::ProvenanceGraph;
pub use provenance::ProvenanceNode;
pub use safety_andon::EmergencyCondition;
pub use safety_andon::SafetyAndon;
pub use safety_andon::SafetyIntegrityLevel;
pub use serialization::PathType;
pub use serialization::SerializationError;
pub use serialization::TraceFormat;
pub use serialization::TraceSerializer;
pub use serialization::APRT_MAGIC;
pub use serialization::APRT_VERSION;
pub use trace::DecisionTrace;

Modules§

collector
Trace Collectors (ENT-105, ENT-106, ENT-107)
counterfactual
Counterfactual Explanations (ENT-104)
path
Decision Path Types (ENT-102)
provenance
Provenance Graph for Incident Reconstruction (ENT-111)
safety_andon
Safety Andon for Inference (ENT-110)
serialization
Trace Serialization (ENT-108)
trace
Decision Trace (ENT-104)

Structs§

ForestPath
Decision path for ensemble models (Random Forest, Gradient Boosting)
InferenceMonitor
High-level inference monitor
KNNPath
Decision path for KNN
LeafInfo
Information about the leaf node reached
LinearPath
Decision path for linear regression/logistic regression
NeuralPath
Decision path for neural networks (gradient-based)
TreePath
Decision path for tree-based models
TreeSplit
A single split decision in a tree

Enums§

PathError
Error type for path operations

Traits§

DecisionPath
Common interface for all decision paths
Explainable
Trait for models that can explain their predictions

Functions§

fnv1a_hash
FNV-1a hash for input features
hash_features
Hash a slice of f32 values
monotonic_ns
Monotonic nanosecond timestamp