Expand description
§ruvector-attn-mincut
Dynamic min-cut gating as an alternative to softmax attention.
Instead of applying softmax uniformly over all Q*K^T logits, this crate builds a weighted directed graph from the logits and computes a minimum cut (via Dinic’s max-flow algorithm) to gate irrelevant edges. Surviving edges are then normalised with row-softmax and multiplied by V.
§Key features
- Graph construction from attention logits (
graphmodule). - Dinic’s max-flow / min-cut solver (
mincutmodule). - Gating operators: standard softmax and min-cut gated (
gatingmodule). - Temporal hysteresis to stabilise gating over time (
hysteresismodule). - Witness logging with SHA-256 hashing for determinism verification (
witnessmodule). - Configuration with sane defaults (
configmodule).
Re-exports§
pub use config::MinCutConfig;pub use gating::attn_mincut;pub use gating::attn_softmax;pub use gating::AttentionOutput;pub use graph::graph_from_logits;pub use graph::AttentionGraph;pub use graph::Edge;pub use hysteresis::HysteresisTracker;pub use mincut::dynamic_min_cut;pub use mincut::CutResult;pub use mincut::DinicSolver;pub use mincut::GatingResult;pub use witness::hash_tensor;pub use witness::witness_log;pub use witness::WitnessEntry;