Physics-Informed API
Poisson mirror equilibrium, physics-informed ODE equilibrium, implicit DAE stage layer, and adversarial residual objective.
SILVAPhysicsInformedEquilibrium supports dense and matrix-free implicit time
derivatives. The matrix-free route solves
from JVPs. SILVAImplicitDAEStep likewise offers dense Newton and
Newton-Krylov linear solves. The small-state auto defaults preserve the dense
educational path, while build_scaled_silva selects the matrix-free routes.
Operational Contract
This API surface connects physics-informed and algebraic equilibrium layers to the same SILVA experiment contract used by the learning pages and notebooks. Its central relation is
| Part | What must remain inspectable |
|---|---|
| State | the implicit representation and the decoded physical state. |
| Condition | the physical residual callable is evaluated on the decoded state with declared boundary or algebraic constraints. |
| Diagnostic | physics residual, boundary residual, equilibrium residual, and adjoint residual. |
| Replacement point | the dynamics, residual, boundary projector, regularizer, stage equation, or discriminator. |
| Scale axes | collocation points, temporal horizon, stiffness, stage count, tolerance, and precision. |
The relevant method lineage is recorded in [50] 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 DAE row verifies its stage equation directly, while the physics-informed row is a weighted training objective. A full study must print the individual objective components rather than only their sum.
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.
Physics-informed and inverse-problem mechanisms expressed inside SILVA.
SILVAAdversarialResidualLoss
dataclass
Generator and discriminator losses for residual-distribution matching.
Source code in src/silva_networks/physics_informed.py
SILVABurgMirrorTransition
Bases: Module
One positive-domain Burg mirror-descent transition for Poisson data.
With h(x)=-sum(log(x)), the unconstrained mirror update is
The final clamp is the box-domain Bregman projection used by the compact implementation.
Source code in src/silva_networks/physics_informed.py
SILVADAEOutput
dataclass
Implicit Runge-Kutta DAE step and its stage/root diagnostics.
Source code in src/silva_networks/physics_informed.py
SILVAImplicitDAEStep
Bases: Module
Differentiable implicit Runge-Kutta step for a semi-explicit DAE.
For y'=f(y,z) and 0=g(y,z), stage states satisfy
followed by y_next=y_n+h sum_i b_i f(Y_i,Z_i) and the endpoint
constraint g(y_next,z_next)=0. A damped Newton root solve makes the
entire stage system one implicit SILVA layer.
Source code in src/silva_networks/physics_informed.py
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 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | |
SILVAPhysicsInformedEquilibrium
Bases: Module
Physics-informed ODE solution represented by a SILVA equilibrium.
The latent state satisfies z_star = f_theta(t, z_star). Time
derivatives are evaluated with the implicit function theorem,
rather than by differentiating through stored solver iterates. Dense and
matrix-free derivative solves share the same equation; auto uses the
dense path only for modest latent dimensions.
Source code in src/silva_networks/physics_informed.py
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 318 319 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 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
implicit_time_derivative
Compute d readout(z_star(t)) / dt by implicit linear solves.
Source code in src/silva_networks/physics_informed.py
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 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
physics_loss
physics_loss(times, dynamics, *, initial_time, initial_state, physics_weight=1.0, jacobian_weight=0.0, jacobian_samples=1)
Evaluate initial, ODE-residual, and transition-Jacobian terms.
Source code in src/silva_networks/physics_informed.py
SILVAPhysicsInformedOutput
dataclass
Predicted physical state, latent equilibrium, and solver diagnostics.
Source code in src/silva_networks/physics_informed.py
SILVAPhysicsInformedTransition
Bases: Module
Time-injected state transition used by a physics-informed equilibrium.
Source code in src/silva_networks/physics_informed.py
SILVAPhysicsLoss
dataclass
Decomposed initial-condition, differential-residual, and Jacobian loss.
Source code in src/silva_networks/physics_informed.py
SILVAPoissonMirrorEquilibrium
Bases: Module
Poisson inverse problem solved by a SILVA Burg-mirror equilibrium.
Source code in src/silva_networks/physics_informed.py
SILVAPoissonMirrorOutput
dataclass
Positive reconstruction, predicted counts, and equilibrium diagnostics.
Source code in src/silva_networks/physics_informed.py
SILVAResidualDiscriminator
Bases: Module
Small discriminator for residual-distribution training objectives.
Source code in src/silva_networks/physics_informed.py
poisson_kl
Evaluate the generalized Poisson Kullback-Leibler divergence.
Source code in src/silva_networks/physics_informed.py
silva_adversarial_residual_loss
Match equation residuals to a supplied near-zero reference distribution.
Source code in src/silva_networks/physics_informed.py
silva_implicit_dae_step
silva_physics_informed_equilibrium
silva_poisson_mirror_equilibrium
Create a positive Poisson mirror-descent equilibrium.
Where to Go Next
| Question | Page |
|---|---|
| How are the ODE, DAE, and loss equations derived? | Physics-Informed Equilibria |
| Where are the mechanisms executed together? | Advanced Equilibria Example |
| Which analytic ODE and DAE batches are available? | Advanced Equilibrium Datasets |
| How are the matrix-free systems derived? | Full-Scale SILVA |