Advanced Equilibria API
Monotone graph and injected-transformer equilibria.
The monotone transition accepts operator_rank and applies its channel map
from low-rank factors. monotonicity_lower_bound() returns the analytic margin
without an eigendecomposition. Injected attention accepts manual, fused
sdpa, and query-chunked execution modes; all implement the same attention
equation and are covered by numerical-equivalence tests.
Operational Contract
This API surface connects advanced equilibrium transitions to the same SILVA experiment contract used by the learning pages and notebooks. Its central relation is
| Part | What must remain inspectable |
|---|---|
| State | the converged graph, token, image, physical, or algebraic state. |
| Condition | the transition must preserve the declared state shape, device, and floating dtype. |
| Diagnostic | forward residual, task loss, and backward linear-solve residual. |
| Replacement point | the stimulus, internal transition, interaction operator, solver, or readout. |
| Scale axes | state width, token or node count, grid size, solver tolerance, and maximum iterations. |
The relevant method lineage is recorded in [47] through [52]. Those references define the source mechanisms; this API exposes them through SILVA objects so a reader can inspect, replace, solve, differentiate, and scale the construction.
Complete Compact Study
Run the complete repository program below from the project root. The page uses the same file that is exercised by the test suite, so the displayed call is not an isolated fragment.
"""Run compact advanced equilibrium and physics-informed SILVA mechanisms."""
from __future__ import annotations
import torch
from silva_networks import (
SILVABurgMirrorTransition,
SILVAGenerativeEquilibriumTransformer,
SILVAImplicitDAEStep,
SILVAMonotoneGraphEquilibrium,
SILVAPhysicsInformedEquilibrium,
SILVAPoissonMirrorEquilibrium,
SILVAResidualDiscriminator,
SolverConfig,
make_linear_dae_dataset,
make_linear_ivp_dataset,
make_monotone_chain_dataset,
make_poisson_inverse_dataset,
make_teacher_image_pairs,
silva_adversarial_residual_loss,
silva_distillation_loss,
)
def main() -> None:
torch.manual_seed(25)
chain = make_monotone_chain_dataset(nodes=8, seed=25)
graph = SILVAMonotoneGraphEquilibrium(
1,
4,
1,
config=SolverConfig(solver="picard", max_iter=12, tol=1e-5),
)
graph_result = graph(chain.source, chain.edge_index, return_result=True)
print("monotone graph:", tuple(graph_result.output.shape), graph_result.solver_result.residual)
teacher = make_teacher_image_pairs(samples=2, height=4, width=4, seed=25)
transformer = SILVAGenerativeEquilibriumTransformer(
in_channels=1,
patch_size=2,
hidden_dim=8,
heads=2,
equilibrium_depth=1,
config=SolverConfig(solver="picard", max_iter=8, tol=1e-5, anderson_batch_dims=1),
)
generated = transformer(teacher.noise, return_result=True)
print(
"equilibrium transformer:", float(silva_distillation_loss(generated.output, teacher.target))
)
poisson = make_poisson_inverse_dataset(samples=2, height=4, width=4, seed=25)
mirror = SILVAPoissonMirrorEquilibrium(
transition=SILVABurgMirrorTransition(
forward_operator=poisson.forward_operator,
adjoint_operator=poisson.adjoint_operator,
step_size=0.05,
),
config=SolverConfig(max_iter=8, tol=1e-5, anderson_batch_dims=1),
)
reconstruction = mirror(poisson.observation, return_result=True)
print("Poisson mirror:", float(poisson.data_fidelity(reconstruction.output)))
ivp = make_linear_ivp_dataset(points=5, rate=-0.5)
physics_model = SILVAPhysicsInformedEquilibrium(
3,
1,
config=SolverConfig(
solver="picard",
max_iter=8,
tol=1e-5,
backward_mode="implicit",
anderson_batch_dims=1,
),
)
physics = physics_model.physics_loss(
ivp.times,
ivp.dynamics,
initial_time=ivp.times[:1],
initial_state=ivp.initial_state,
jacobian_weight=0.01,
)
print("physics-informed loss:", float(physics.total))
dae = make_linear_dae_dataset(steps=2, step_size=0.1)
dae_result = SILVAImplicitDAEStep()(
dae.differential[:1],
dae.algebraic[:1],
dae.step_size,
dae.dynamics,
dae.constraint,
)
print("implicit DAE step:", dae_result.differential.flatten().tolist(), dae_result.residual)
discriminator = SILVAResidualDiscriminator(1, hidden_dim=8, depth=1)
residual_losses = silva_adversarial_residual_loss(
discriminator,
physics.time_derivative - ivp.dynamics(ivp.times, physics.prediction),
)
print(
"adversarial residual objective:",
float(residual_losses.generator),
float(residual_losses.discriminator),
)
if __name__ == "__main__":
main()
Measured Compact Output
monotone graph: (8, 1) 0.023554455488920212
equilibrium transformer: 0.18536624312400818
Poisson mirror: 0.005979819223284721
physics-informed loss: 0.8003759384155273
implicit DAE step: [0.4761904776096344] 1.862645149230957e-09
adversarial residual objective: 0.7888258695602417 1.3886094093322754
Interpret the Output
The output demonstrates six distinct mechanisms through one package surface. The small values verify equations or compact objectives; they are not source-scale benchmark scores.
For a controlled experiment, retain the compact call as a regression case and change one scale axis at a time. Record the resolved constructor, data source and split, preprocessing, seed, forward and backward solver settings, task metric, normalized residual, iteration count, runtime, peak memory, and any failed convergence case. A larger run becomes evidence only when its own resolved configuration and outputs are archived; the compact output above is evidence for the executable mechanism and its stated invariants.
Monotone graph and injected-transformer equilibria inside SILVA.
The modules in this file preserve the source/state/operator contracts of the published mechanisms while exposing ordinary PyTorch modules and SILVA solver diagnostics. Compact defaults are intended for teaching and small experiments; benchmark-scale width, depth, data, and training protocols remain user choices.
SILVAEquilibriumTransformerBlock
Bases: Module
Injected attention and feed-forward branches reused by a fixed-point solve.
Source code in src/silva_networks/advanced_equilibria.py
SILVAGenerativeEquilibriumOutput
dataclass
Decoded image, token equilibrium, one-time injection, and solver trace.
Source code in src/silva_networks/advanced_equilibria.py
SILVAGenerativeEquilibriumTransformer
Bases: Module
One-time image injection followed by a weight-tied token equilibrium.
Image patches are embedded and processed once by injection blocks. Their
projections supply a distinct QKV injection to each block inside the tied
equilibrium transition. The compact tanh stability envelope makes the
teaching configuration numerically inspectable without changing the
one-time-injection contract.
Source code in src/silva_networks/advanced_equilibria.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | |
SILVAInjectedSelfAttention
Bases: Module
Multi-head self-attention with a precomputed QKV source injection.
For equilibrium state Z and one-time source injection U, the three
attention projections are
Source code in src/silva_networks/advanced_equilibria.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | |
SILVAMonotoneGraphEquilibrium
Bases: Module
Monotone implicit graph network represented as a SILVA equilibrium.
Source code in src/silva_networks/advanced_equilibria.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
SILVAMonotoneGraphOutput
dataclass
Task output, equilibrium state, solver trace, and monotonicity certificate.
Source code in src/silva_networks/advanced_equilibria.py
SILVAMonotoneGraphTransition
Bases: Module
Forward-backward monotone graph transition.
The graph channel matrix is parameterized as
and one forward-backward step is
activation supplies the proximal map; ReLU is the default.
Source code in src/silva_networks/advanced_equilibria.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
apply_channel_weight
Apply values @ W.T without materializing W when factorized.
Source code in src/silva_networks/advanced_equilibria.py
channel_weight
Return the constrained channel matrix W.
Source code in src/silva_networks/advanced_equilibria.py
monotonicity_certificate
Return the smallest eigenvalue of I-(W+W^T)/2.
Source code in src/silva_networks/advanced_equilibria.py
monotonicity_lower_bound
normalized_laplacian_field
Apply one half of the symmetric normalized graph Laplacian.
For an adjacency matrix A and degree matrix D, the returned field is
Bidirectional edges should be supplied when an undirected graph is wanted.
Isolated nodes receive the identity contribution Z / 2.
Source code in src/silva_networks/advanced_equilibria.py
silva_distillation_loss
Return the mean-squared one-step teacher-matching objective.
Source code in src/silva_networks/advanced_equilibria.py
silva_generative_equilibrium_transformer
Create an injected equilibrium transformer inside SILVA.
silva_monotone_graph_equilibrium
Create a monotone graph equilibrium inside SILVA.
Where to Go Next
| Question | Page |
|---|---|
| How are the operators derived? | Advanced Equilibrium Families |
| Where are all six mechanisms run together? | Advanced Equilibria Example |
| Which exact datasets exercise these classes? | Advanced Equilibrium Datasets |
| How do these operators run at larger scale? | Full-Scale SILVA |