Skip to main content

Crate hanzo_hmm

Crate hanzo_hmm 

Source
Expand description

Hamiltonian Hidden-Markov MarketMaker (HMM) for heterogeneous compute.

AMM-analogue with HMM dynamics. Quotes prices for compute resources (different GPU classes, model sizes, latencies) using Hidden-Markov state transitions for market regimes plus Hamiltonian mechanics for energy- conserving price evolution. BitDelta 1-bit quantization compresses per-tenant price-adapter tables. Active-inference (expected free energy) drives quote width / inventory decisions.

Distinct from the inference engine: this crate sets prices; the engine at ~/work/hanzo/engine actually runs models.

Re-exports§

pub use regime::Regime;
pub use regime::RegimeDetector;
pub use regime::MarkovChain;
pub use hamiltonian::HamiltonianDynamics;
pub use hamiltonian::PhaseSpace;
pub use hamiltonian::PriceDynamics;
pub use bitdelta::BitDeltaAdapter;
pub use bitdelta::BitQuantizer;
pub use bitdelta::AdapterCache;
pub use routing::Router;
pub use routing::RoutingDecision;
pub use routing::ModelSelection;
pub use adapter::UserAdapter;
pub use adapter::AdapterManager;
pub use storage::Storage;
pub use storage::VectorIndex;
pub use free_energy::ExpectedFreeEnergy;
pub use free_energy::BeliefState;
pub use free_energy::Precision;

Modules§

adapter
Per-tenant price adapters. Each tenant has a 1-bit delta against the base quote table that shifts their effective bid/ask under each regime. Adapter management = create / update / persist / look up by tenant id.
bitdelta
BitDelta 1-bit quantization for price-adapter storage.
free_energy
Expected Free Energy calculations for active inference
hamiltonian
Hamiltonian price dynamics. Compute prices evolve as a conservative mechanical system: price = position, momentum = trend. Energy-conserving integrator (symplectic) prevents the marketmaker from drifting on noise. Coupled to regime state via a regime-dependent potential.
hmm_core
Hidden Markov Model Implementation
regime
Compute-market regime detection via Hidden Markov Models.
routing
Quote dispatch: routes a compute request to the cheapest-acceptable resource given the current regime, posted bid/ask, and tenant adapter. Output is a quote (price + venue), not a model identity.
storage
SQLite storage layer with vector search

Structs§

Config
Main MarketMaker system configuration
MarketMaker
Main MarketMaker system for routing decisions
PerformanceRequirements
Performance requirements
RoutingRequest
Request for routing decision
SystemState
System state snapshot
UserPreferences
User preferences for model selection