boundlab.polysp#

The sparse polynomial domain: monomials over error symbols.

Where a zonotope must collapse every product into interval noise, a PolySp keeps the monomials themselves:

\[x \;=\; \sum_r d_r \prod_{k \in I_r} \varepsilon_k , \qquad \varepsilon_k \in [-1, 1],\]

stored sparsely — one coefficient tensor row and one -1-padded index row per monomial. A product of two order-1 values is then an exact order-2 value; only monomials beyond the configured order, or with negligible coefficients (eps), are truncated into sound interval noise. Attention blocks, whose error budget is dominated by Q @ K^T and attn @ V, are the motivating case.

The pair-product kernels live in boundlab.ops.sparse_poly (reference and Triton backends); this module wraps them in the Expr interface.

Module Attributes

interpret

The sparse polynomial interpreter.

Functions

keep_ploysp

after_each normalizer: lift stray Bias / Noise components into PolySp so every value stays inside the polynomial world and new residuals become first-class symbols.

Classes

Generator

A sparse polynomial in error_len symbols.

Matmul

PolySp × PolySp matrix product via PolySp.sparse_matmul().

Poly

Apply a concrete polynomial (given as a coefficient list) to a PolySp via PolySp.sparse_applypoly().

PolySp

A polynomial expression component with sparse representation.

Modules

generator

Sparse monomial storage behind a PolySp.

legendre

Polynomial (Legendre-projection) relaxations of scalar activations.

softmax

Softmax over sparse polynomials, tightened by the simplex constraint.