Skip to main content

Crate ruvector_attn_mincut

Crate ruvector_attn_mincut 

Source
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 (graph module).
  • Dinic’s max-flow / min-cut solver (mincut module).
  • Gating operators: standard softmax and min-cut gated (gating module).
  • Temporal hysteresis to stabilise gating over time (hysteresis module).
  • Witness logging with SHA-256 hashing for determinism verification (witness module).
  • Configuration with sane defaults (config module).

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;

Modules§

config
gating
graph
hysteresis
mincut
witness