Skip to main content

Crate spectral_budget

Crate spectral_budget 

Source
Expand description

A budget primitive for bounded sequential domains: token windows, time horizons, request counts, anything where you need to refuse work that would exceed a principled ceiling.

The framing comes from the Faber–Krahn inequality on the principal eigenvalue of a bounded Laplacian: a closed domain of diameter d with propagation speed c has a slowest mode with period T_1 ≈ 2·d/c. Capping aggregate diameter at k · T_1 (default k = 3) keeps becoming finite. The same arithmetic applies whether d is photon path-length, an LLM token window, or an agent reasoning depth.

§Example

use spectral_budget::SpectralBudget;

// 200 000-token context window; admit up to 3·T_1.
let budget = SpectralBudget {
    principal_period: 200_000.0,
    ring_down_factor: 3.0,
};

assert!(budget.admits(400_000.0));
assert!(budget.try_admit(700_000.0).is_err());

Structs§

SpectralBudget
A ceiling on the diameter a bounded sequential domain may reach before its becoming exceeds the principal eigenvalue of the underlying Laplacian.

Enums§

BudgetError
Failure modes of SpectralBudget. The Display impl is informative enough to surface directly at a user-facing prompt.