Skip to content

Compact Comparison Suites

The compact comparison API runs compatible families on shared deterministic tasks. Its purpose is to verify complete execution, optimization, gradients, and numerical diagnostics under common inputs and budgets.

Run All Suites

from silva_networks import run_compact_comparisons

for suite in run_compact_comparisons(seed=120):
    print(suite.name, suite.task)
    for result in suite.results:
        print(
            result.family,
            result.initial_loss,
            result.final_loss,
            result.residual,
        )

For model \(m\), each suite evaluates

\[ z_{m,i}^{\star}=T_{m,\theta_m}(z_{m,i}^{\star};x_i), \qquad \mathcal L_m = \frac{1}{N}\sum_{i=1}^{N} \left\|Q_m(z_{m,i}^{\star})-y_i\right\|_2^2. \]

The input, target, seed, optimizer steps, and task loss are shared. Each family retains its own well-posedness mechanism, so the compact values are diagnostics, not a general ranking.

Public Objects

silva_networks.compact_benchmarks

Deterministic same-task comparison suites for compatible SILVA families.

SILVACompactBenchmarkResult dataclass

Measured result for one family in a compact same-task suite.

Source code in src/silva_networks/compact_benchmarks.py
@dataclass(frozen=True)
class SILVACompactBenchmarkResult:
    """Measured result for one family in a compact same-task suite."""

    suite: BenchmarkSuiteName
    family: str
    seed: int
    samples: int
    train_steps: int
    parameter_count: int
    initial_loss: float
    final_loss: float
    residual: float
    iterations: int
    gradient_norm: float
    runtime_seconds: float
    evidence_status: str = "compact-verified"

    @property
    def loss_reduction(self) -> float:
        """Return the fractional reduction in the common task loss."""

        denominator = max(abs(self.initial_loss), 1e-12)
        return (self.initial_loss - self.final_loss) / denominator

    def as_dict(self) -> dict[str, object]:
        """Return a JSON-compatible result record."""

        result = asdict(self)
        result["loss_reduction"] = self.loss_reduction
        return result

loss_reduction property

loss_reduction

Return the fractional reduction in the common task loss.

as_dict

as_dict()

Return a JSON-compatible result record.

Source code in src/silva_networks/compact_benchmarks.py
def as_dict(self) -> dict[str, object]:
    """Return a JSON-compatible result record."""

    result = asdict(self)
    result["loss_reduction"] = self.loss_reduction
    return result

SILVACompactBenchmarkSuite dataclass

A complete compact suite and its common task definition.

Source code in src/silva_networks/compact_benchmarks.py
@dataclass(frozen=True)
class SILVACompactBenchmarkSuite:
    """A complete compact suite and its common task definition."""

    name: BenchmarkSuiteName
    task: str
    metric: str
    results: tuple[SILVACompactBenchmarkResult, ...]
    limitations: tuple[str, ...]

    def as_dict(self) -> dict[str, object]:
        """Return a JSON-compatible suite record."""

        return {
            "name": self.name,
            "task": self.task,
            "metric": self.metric,
            "results": [result.as_dict() for result in self.results],
            "limitations": list(self.limitations),
        }

as_dict

as_dict()

Return a JSON-compatible suite record.

Source code in src/silva_networks/compact_benchmarks.py
def as_dict(self) -> dict[str, object]:
    """Return a JSON-compatible suite record."""

    return {
        "name": self.name,
        "task": self.task,
        "metric": self.metric,
        "results": [result.as_dict() for result in self.results],
        "limitations": list(self.limitations),
    }

run_vector_comparison

run_vector_comparison(*, seed=120, train_steps=12)

Train five compatible vector equilibria on one positive regression task.

Source code in src/silva_networks/compact_benchmarks.py
def run_vector_comparison(
    *, seed: int = 120, train_steps: int = 12
) -> SILVACompactBenchmarkSuite:
    """Train five compatible vector equilibria on one positive regression task."""

    torch.manual_seed(seed)
    inputs = torch.randn(16, 3)
    target = torch.sigmoid(0.7 * inputs[:, :1] - 0.4 * inputs[:, 1:2] + 0.2)
    results: list[SILVACompactBenchmarkResult] = []
    for index, (family, model) in enumerate(_vector_models()):
        torch.manual_seed(seed + index + 1)
        results.append(
            _train_one(
                "vector",
                family,
                model,
                inputs,
                target,
                seed=seed,
                train_steps=train_steps,
                learning_rate=2e-2,
            )
        )
    return SILVACompactBenchmarkSuite(
        name="vector",
        task="fit one bounded nonlinear scalar field from the same 16 three-feature samples",
        metric="mean squared error, equilibrium residual, iterations, gradients, parameters, and CPU time",
        results=tuple(results),
        limitations=(
            "The training budget is deliberately small and is not a ranking of the families.",
            "Each family retains its own well-posedness parameterization and therefore has a different hypothesis class.",
        ),
    )

run_graph_comparison

run_graph_comparison(*, seed=121, train_steps=10)

Train four compatible graph equilibria on one chain-node task.

Source code in src/silva_networks/compact_benchmarks.py
def run_graph_comparison(
    *, seed: int = 121, train_steps: int = 10
) -> SILVACompactBenchmarkSuite:
    """Train four compatible graph equilibria on one chain-node task."""

    torch.manual_seed(seed)
    nodes = 12
    inputs = torch.randn(nodes, 3)
    operator = _chain_operator(nodes)
    smoothed = operator @ inputs
    target = torch.sigmoid(0.6 * smoothed[:, :1] - 0.25 * inputs[:, 1:2])
    results: list[SILVACompactBenchmarkResult] = []
    for index, (family, model) in enumerate(_graph_models(nodes)):
        torch.manual_seed(seed + index + 1)
        results.append(
            _train_one(
                "graph",
                family,
                model,
                inputs,
                target,
                seed=seed,
                train_steps=train_steps,
                learning_rate=1.5e-2,
            )
        )
    return SILVACompactBenchmarkSuite(
        name="graph",
        task="predict the same smoothed node field on one bidirectional 12-node chain",
        metric="node mean squared error, equilibrium residual, iterations, gradients, parameters, and CPU time",
        results=tuple(results),
        limitations=(
            "The edge-index and dense-operator routes encode the same chain but use their native normalization paths.",
            "The compact run validates interoperability and optimization; it is not a graph benchmark claim.",
        ),
    )

run_field_comparison

run_field_comparison(*, seed=122, train_steps=6)

Train three compatible spectral field families on one periodic map.

Source code in src/silva_networks/compact_benchmarks.py
def run_field_comparison(
    *, seed: int = 122, train_steps: int = 6
) -> SILVACompactBenchmarkSuite:
    """Train three compatible spectral field families on one periodic map."""

    torch.manual_seed(seed)
    inputs = torch.randn(4, 2, 8, 8)
    target = torch.tanh(
        0.45 * inputs[:, :1]
        + 0.2 * torch.roll(inputs[:, 1:2], shifts=1, dims=-1)
        - 0.1 * torch.roll(inputs[:, :1], shifts=1, dims=-2)
    )
    results: list[SILVACompactBenchmarkResult] = []
    for index, (family, model) in enumerate(_field_models()):
        torch.manual_seed(seed + index + 1)
        results.append(
            _train_one(
                "field",
                family,
                model,
                inputs,
                target,
                seed=seed,
                train_steps=train_steps,
                learning_rate=1e-2,
            )
        )
    return SILVACompactBenchmarkSuite(
        name="field",
        task="fit the same periodic 8 by 8 two-channel-to-one-channel field operator",
        metric="field mean squared error, equilibrium or increment residual, iterations, gradients, parameters, and CPU time",
        results=tuple(results),
        limitations=(
            "The target is an analytic periodic map rather than a publication dataset.",
            "The unrolled implicit Fourier family reports its final increment norm where root-solved families report a solver residual.",
        ),
    )

run_compact_comparisons

run_compact_comparisons(*, seed=120)

Run every deterministic compact comparison suite.

Source code in src/silva_networks/compact_benchmarks.py
def run_compact_comparisons(
    *, seed: int = 120
) -> tuple[SILVACompactBenchmarkSuite, ...]:
    """Run every deterministic compact comparison suite."""

    return (
        run_vector_comparison(seed=seed),
        run_graph_comparison(seed=seed + 1),
        run_field_comparison(seed=seed + 2),
    )

Where to Go Next

Question Page
What values were measured? Cross-Family Comparisons
How does each family scale? Family Reproduction Dossiers
How are failures diagnosed? Failure Diagnostics