omnibias.core.implicit
Coefficient recurrences, activation contracts, jet algebra, and verified arithmetic shared by the numerical backends.
import omnibias.core.implicitModule contract & mathematical conventions
Implicit / DEQ algebra (theory 08-08).
An equilibrium u = sigma(W u + x) is a root of
F(u) = u - sigma(W u + x). The implicit-function theorem differentiates
the root with exact sigma' from the founding bias collapse
(delta -> 0): one linear solve against
I - diag(sigma'(z)) W replaces unrolled backprop through a
fixed-point iteration.
This module is backend-free: config, the contraction raise, and the
infinity-norm spectral-radius bound. Tensor Newton / Banach iteration
and the IFT VJP live in omnibias.{torch,jax}.implicit.
No temperature collapse. Not a global min, and not a continuum PDE existence claim. IFT is the chain rule at a fixed point, not an absence of the chain rule.
Shared formulas do not imply universal floating-point identity. Verify dtype, shape, derivative-order support, and the stated numerical assumptions for the path you use.
DEQConfig
omnibias.core.DEQConfigSource ↗class DEQConfigDataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.
Fixed-point solver budget and contraction policy.
newton is the gated method. iterate is Banach iteration.
anderson is recorded extra and raises
DEQSolverUnknown until it earns a gate.
Parameters
| Name | Type & default | Contract |
|---|---|---|
solverdataclass field | DEQSolverDefault: 'newton' | See the operation contract and implementation below. |
max_iterdataclass field | intDefault: 50 | See the operation contract and implementation below. |
toldataclass field | floatDefault: 1e-10 | See the operation contract and implementation below. |
require_contractiondataclass field | boolDefault: False | See the operation contract and implementation below. |
Executed regression · contraction raises
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_contraction_raises() -> None:
cfg = DEQConfig(require_contraction=True, max_iter=2)
with pytest.raises(DEQNotContractive, match="unroll"):
deq_solve(jnp.asarray([[3.0]]), jnp.asarray([0.1]), "tanh", config=cfg)python -m pytest "packages/omnibias-jax/tests/test_implicit.py::test_contraction_raises" -qRegression example · anderson raises
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_anderson_raises() -> None:
with pytest.raises(DEQSolverUnknown, match="newton"):
deq_solve(
jnp.asarray([[0.2]]),
jnp.asarray([0.5]),
"tanh",
config=DEQConfig(solver="anderson"),
)python -m pytest packages/omnibias-jax/tests/test_implicit.py -k test_anderson_raises -qFields & methods
solverfield
solver: DEQSolver = 'newton'Declared DEQSolver field on DEQConfig. Default expression: 'newton'.
max_iterfield
max_iter: int = 50Declared int field on DEQConfig. Default expression: 50.
tolfield
tol: float = 1e-10Declared float field on DEQConfig. Default expression: 1e-10.
require_contractionfield
require_contraction: bool = FalseDeclared bool field on DEQConfig. Default expression: False.
__post_init__method
__post_init__(self) -> NoneSee the class contract above and the exact method implementation below.
Returns: None
Validation & failure cases
- When
self.solver not in ('newton', 'iterate', 'anderson'), raisesValueError(f"solver must be 'newton', 'iterate', or 'anderson', got {self.solver!r}"). - When
self.max_iter < 1, raisesValueError(f'max_iter must be >= 1, got {self.max_iter}'). - When
self.tol <= 0.0 or not math.isfinite(self.tol), raisesValueError(f'tol must be a finite number > 0, got {self.tol}').
Executed regression · contraction raises
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_contraction_raises() -> None:
cfg = DEQConfig(require_contraction=True, max_iter=2)
with pytest.raises(DEQNotContractive, match="unroll"):
deq_solve(jnp.asarray([[3.0]]), jnp.asarray([0.1]), "tanh", config=cfg)python -m pytest "packages/omnibias-jax/tests/test_implicit.py::test_contraction_raises" -qMethod implementation
def __post_init__(self) -> None:
if self.solver not in ("newton", "iterate", "anderson"):
raise ValueError(
f"solver must be 'newton', 'iterate', or 'anderson', "
f"got {self.solver!r}"
)
if self.max_iter < 1:
raise ValueError(f"max_iter must be >= 1, got {self.max_iter}")
if self.tol <= 0.0 or not math.isfinite(self.tol):
raise ValueError(f"tol must be a finite number > 0, got {self.tol}")Read the implementation
class DEQConfig:
"""Fixed-point solver budget and contraction policy.
``newton`` is the gated method. ``iterate`` is Banach iteration.
``anderson`` is recorded extra and raises
:class:`DEQSolverUnknown` until it earns a gate.
"""
solver: DEQSolver = "newton"
max_iter: int = 50
tol: float = 1e-10
require_contraction: bool = False
def __post_init__(self) -> None:
if self.solver not in ("newton", "iterate", "anderson"):
raise ValueError(
f"solver must be 'newton', 'iterate', or 'anderson', "
f"got {self.solver!r}"
)
if self.max_iter < 1:
raise ValueError(f"max_iter must be >= 1, got {self.max_iter}")
if self.tol <= 0.0 or not math.isfinite(self.tol):
raise ValueError(f"tol must be a finite number > 0, got {self.tol}")Other public import paths
omnibias.core.DEQConfigomnibias.jax.DEQConfigomnibias.torch.DEQConfigomnibias.core.implicit.DEQConfigomnibias.jax.implicit.DEQConfigomnibias.torch.implicit.DEQConfig
DEQNotContractive
omnibias.core.DEQNotContractiveSource ↗class DEQNotContractive(ValueError)Raised when require_contraction=True and the bound is >= 1.
Regression example · contraction raises
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_contraction_raises() -> None:
cfg = DEQConfig(require_contraction=True, max_iter=2)
with pytest.raises(DEQNotContractive, match="unroll"):
deq_solve(jnp.asarray([[3.0]]), jnp.asarray([0.1]), "tanh", config=cfg)python -m pytest packages/omnibias-jax/tests/test_implicit.py -k test_contraction_raises -qRegression example · contraction raise
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_contraction_raise() -> None:
reject_deq_contraction(0.5, require=True)
with pytest.raises(DEQNotContractive, match="unroll"):
reject_deq_contraction(1.0, require=True)
reject_deq_contraction(1.5, require=False)python -m pytest packages/omnibias-core/tests/test_implicit.py -k test_contraction_raise -qRead the implementation
class DEQNotContractive(ValueError):
"""Raised when ``require_contraction=True`` and the bound is ``>= 1``."""Other public import paths
omnibias.core.DEQNotContractiveomnibias.jax.DEQNotContractiveomnibias.torch.DEQNotContractiveomnibias.core.implicit.DEQNotContractiveomnibias.jax.implicit.DEQNotContractiveomnibias.torch.implicit.DEQNotContractive
DEQSolver
omnibias.core.implicit.DEQSolverSource ↗DEQSolver = Literal['newton', 'iterate', 'anderson']This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
DEQSolver = Literal["newton", "iterate", "anderson"]DEQSolverUnknown
omnibias.core.DEQSolverUnknownSource ↗class DEQSolverUnknown(ValueError)Raised when the solver name is not implemented.
Regression example · anderson is extra
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_anderson_is_extra() -> None:
with pytest.raises(DEQSolverUnknown, match="newton"):
reject_anderson("anderson")
reject_anderson("newton")python -m pytest packages/omnibias-core/tests/test_implicit.py -k test_anderson_is_extra -qRegression example · anderson raises
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_anderson_raises() -> None:
with pytest.raises(DEQSolverUnknown, match="newton"):
deq_solve(
jnp.asarray([[0.2]]),
jnp.asarray([0.5]),
"tanh",
config=DEQConfig(solver="anderson"),
)python -m pytest packages/omnibias-jax/tests/test_implicit.py -k test_anderson_raises -qRead the implementation
class DEQSolverUnknown(ValueError):
"""Raised when the solver name is not implemented."""Other public import paths
omnibias.core.DEQSolverUnknownomnibias.jax.DEQSolverUnknownomnibias.torch.DEQSolverUnknownomnibias.core.implicit.DEQSolverUnknownomnibias.jax.implicit.DEQSolverUnknownomnibias.torch.implicit.DEQSolverUnknown
HONESTY
omnibias.core.implicit.HONESTYSource ↗HONESTY: dict[str, bool] = {'global_convergence_claim': False, 'global_min_claim': False, 'unrolled_bptt_claim': False, 'greedy_only_claimed_optimal': False}This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
HONESTY: dict[str, bool] = {
"global_convergence_claim": False,
"global_min_claim": False,
"unrolled_bptt_claim": False,
"greedy_only_claimed_optimal": False,
}honesty_payload
omnibias.core.honesty_payloadSource ↗honesty_payload() -> dict[str, bool]Sealed artifact keys. Values are copies.
dict[str, bool]Executed regression · honesty sealed
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_honesty_sealed() -> None:
payload = honesty_payload()
assert payload["global_convergence_claim"] is False
assert payload["unrolled_bptt_claim"] is False
payload["global_convergence_claim"] = True
assert honesty_payload()["global_convergence_claim"] is Falsepython -m pytest "packages/omnibias-core/tests/test_implicit.py::test_honesty_sealed" -qRead the implementation
def honesty_payload() -> dict[str, bool]:
"""Sealed artifact keys. Values are copies."""
return dict(HONESTY)Other public import paths
omnibias.core.honesty_payloadomnibias.core.implicit.honesty_payloadomnibias.jax.implicit.honesty_payloadomnibias.torch.implicit.honesty_payload
reject_anderson
omnibias.core.reject_andersonSource ↗reject_anderson(solver: str) -> NoneAnderson is extra; the gate uses Newton.
Parameters
| Name | Type & default | Contract |
|---|---|---|
solverpositional-or-keyword | strRequired | See the operation contract and implementation below. |
NoneExplicit validation & failure cases
- When
solver == 'anderson', raisesDEQSolverUnknown("anderson acceleration is extra and is not the gated solver; use solver='newton' or solver='iterate'").
These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.
Executed regression · anderson is extra
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_anderson_is_extra() -> None:
with pytest.raises(DEQSolverUnknown, match="newton"):
reject_anderson("anderson")
reject_anderson("newton")python -m pytest "packages/omnibias-core/tests/test_implicit.py::test_anderson_is_extra" -qRead the implementation
def reject_anderson(solver: str) -> None:
"""Anderson is extra; the gate uses Newton."""
if solver == "anderson":
raise DEQSolverUnknown(
"anderson acceleration is extra and is not the gated solver; "
"use solver='newton' or solver='iterate'"
)Other public import paths
omnibias.core.reject_andersonomnibias.core.implicit.reject_anderson
reject_deq_contraction
omnibias.core.reject_deq_contractionSource ↗reject_deq_contraction(bound: float, *, require: bool) -> NoneG11: raise rather than silently unroll when the bound is >= 1.
Parameters
| Name | Type & default | Contract |
|---|---|---|
boundpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
requirekeyword-only | boolRequired | See the operation contract and implementation below. |
NoneExplicit validation & failure cases
- When
require and radius >= 1.0, raisesDEQNotContractive(f'spectral_radius_bound={radius} >= 1; refuse to unroll. Pass require_contraction=False to attempt Newton without a Banach certificate').
These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.
Executed regression · contraction raises
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_contraction_raises() -> None:
cfg = DEQConfig(require_contraction=True, max_iter=2)
with pytest.raises(DEQNotContractive, match="unroll"):
deq_solve(jnp.asarray([[3.0]]), jnp.asarray([0.1]), "tanh", config=cfg)python -m pytest "packages/omnibias-jax/tests/test_implicit.py::test_contraction_raises" -qRegression example · contraction raise
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_contraction_raise() -> None:
reject_deq_contraction(0.5, require=True)
with pytest.raises(DEQNotContractive, match="unroll"):
reject_deq_contraction(1.0, require=True)
reject_deq_contraction(1.5, require=False)python -m pytest packages/omnibias-core/tests/test_implicit.py -k test_contraction_raise -qRead the implementation
def reject_deq_contraction(bound: float, *, require: bool) -> None:
"""G11: raise rather than silently unroll when the bound is ``>= 1``."""
radius = spectral_radius_inf_bound(bound)
if require and radius >= 1.0:
raise DEQNotContractive(
f"spectral_radius_bound={radius} >= 1; refuse to unroll. "
"Pass require_contraction=False to attempt Newton without "
"a Banach certificate"
)Other public import paths
omnibias.core.reject_deq_contractionomnibias.core.implicit.reject_deq_contraction
spectral_radius_inf_bound
omnibias.core.spectral_radius_inf_boundSource ↗spectral_radius_inf_bound(abs_sigma_prime_times_row_l1: float) -> floatInfinity-norm bound on diag(sigma') W.
max_i |sigma'_i| ||W_{i,:}||_1 is enough for the gate. A value
< 1 is a sufficient Banach contraction test, not a necessary one.
Parameters
| Name | Type & default | Contract |
|---|---|---|
abs_sigma_prime_times_row_l1positional-or-keyword | floatRequired | See the operation contract and implementation below. |
floatExplicit validation & failure cases
- When
bound < 0.0 or not math.isfinite(bound), raisesValueError(f'spectral-radius bound must be a finite number >= 0, got {bound}').
These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.
Executed regression · inf bound
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_inf_bound() -> None:
assert spectral_radius_inf_bound(0.141) == pytest.approx(0.141)
with pytest.raises(ValueError):
spectral_radius_inf_bound(-0.1)python -m pytest "packages/omnibias-core/tests/test_implicit.py::test_inf_bound" -qRead the implementation
def spectral_radius_inf_bound(
abs_sigma_prime_times_row_l1: float,
) -> float:
"""Infinity-norm bound on ``diag(sigma') W``.
``max_i |sigma'_i| ||W_{i,:}||_1`` is enough for the gate. A value
``< 1`` is a sufficient Banach contraction test, not a necessary one.
"""
bound = float(abs_sigma_prime_times_row_l1)
if bound < 0.0 or not math.isfinite(bound):
raise ValueError(
f"spectral-radius bound must be a finite number >= 0, got {bound}"
)
return boundOther public import paths
omnibias.core.spectral_radius_inf_boundomnibias.core.implicit.spectral_radius_inf_bound