Add a cross-backend differential harness: evaluate one job at a fixed parameter set on every backend that can run it, and compare the simulated outputs and the objective value

Abierto
#980 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
testing-qa

Línea de trabajo

Start by reading tests/test_experiment_independence.py, tests/test_preequilibration.py, tests/test_bngsim_sbml_bridge.py, and benchmarks/run_pybnf_fitting_jobs.py, then compare their entry points with bngsim's parity_checks/ design. Define how the shared manifest, runner, comparator, and outcomes fit PyBNF before building the cross-backend harness. Done means the stated disagreement regressions fail when their fixes are reverted, exercised open bugs are recorded as KNOWN, and the per-push subset meets a stated time budget.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

PyBNF has no harness that takes one job, evaluates it at a fixed parameter set on every simulation backend able to run it, and compares the results. Backends that disagree are the largest class in the 2026-09-23 audit: 35 of the 106 silently-wrong-result bugs (#929). The test suite passed with all of them present.

bngsim has this for engines, in parity_checks/ (lanl/bngsim). It compares bngsim with libRoadRunner, the legacy BioNetGen stack and AMICI over committed manifests, with one comparison kernel and one outcome taxonomy. It stops at the engine on purpose: its README says "Fitting/sampling parity is PyBNF's, not ours", and its corpus leaves out .conf and .exp files. Everything between the engine and the objective value is PyBNF's to check: the bridges, the synthesized actions, conditions and mutants, pre-equilibration, normalization, and the scoring.

What PyBNF has today

  • Per-feature tests on two backends. tests/test_experiment_independence.py and tests/test_preequilibration.py run tiny models on bionetgen and bngsim against closed forms. tests/test_bngsim_sbml_bridge.py and tests/test_bngsim_ssa_replaces_rr.py compare the bngsim SBML backend with RoadRunner on one model each. Each test covers the feature its author had in mind.
  • A name-level differential. tests/_bngl_differential.py compares the entity names the PEtab BNGL reader finds with BNG2.pl's. It compares no numbers.
  • A launch smoke test. benchmarks/run_pybnf_fitting_jobs.py starts twelve jobs on BNG2.pl and on bngsim. It checks that each one starts, not that the two agree.
  • No use of bngsim's golden references. parity_checks publishes them so that PyBNF can regenerate them through its own bridges with only a pinned bngsim installed. Nothing in PyBNF does.
  • A manual rule. #929 asks every PR that can change a number to run the shipped examples before and after at a fixed parameter set. No committed script does that.

How this relates to #929 phase 3

Phase 3 is a conformance suite: tiny models on every backend, judged against closed forms. That is the only way to catch two backends returning the same wrong number (#830). But it covers only models small enough to solve by hand, and only the cases someone thought to write.

A differential harness covers the other side: real jobs, with combinations of features nobody listed. It cannot catch a shared wrong number, and a disagreement does not say which backend is wrong. The two should share one runner, one comparator and one set of outcomes.

Proposal

  • Manifest. One committed file with one entry per job: the conf, the parameter set, the backends that apply, and the tolerances.
  • Runner. For each job and each backend, load the conf the way a fit does and evaluate once at the parameter set. Record every simulated output table and the objective value.
  • Backend pairs.
    • BNGL, ODE and SSA: bngl_backend = bionetgen against bngsim.
    • BNGL, network-free: BNG2.pl with NFsim against bngsim nf for legacy-edition jobs, and bngsim nf against rm. Edition-2 network-free experiments are to be refused under bngl_backend = bionetgen (#929).
    • SBML: sbml_backend = roadrunner against bngsim.
    • Antimony runs only on bngsim. It has no pair unless it is compared with its SBML translation on RoadRunner.
  • Comparator. Deterministic output tables must agree within a numeric tolerance, and then the objective values within a relative tolerance. Stochastic and network-free outputs need a statistical comparison over seeds; parity_checks/rr_parity/ssa_screen.py has one to follow. Two backends that report different column names are a failure. The comparator must not compare only the columns they share (#817).
  • Outcomes. PASSED, FAILED, KNOWN and REFUSED.
    • REFUSED: one backend rejects the job at load. That is correct behaviour and is recorded as such.
    • KNOWN: a disagreement tied to an open issue number. A KNOWN row that now passes fails the run, so a stale entry cannot stay.
  • Missing backend. If a backend the manifest names is not installed, the run stops with an error. It does not skip the row.
  • Corpus. Start with the shipped examples/ confs that evaluate in seconds, plus tests/full_tests. Then regenerate bngsim's golden references through PyBNF's bridges.
  • CI. A fast subset on every push, and the full sweep in integration.yml.

The same runner can later check the other sibling paths named in AGENTS.md: the gradient against finite differences of the recorded objective, a fit against job_type = ms, and a conf against its PEtab export and re-import. Those are follow-ups, not part of this issue.

Depends on

  • #923. job_type = check simulates a BNGL model with BNG2.pl whatever bngl_backend says. The single evaluation above is a check, so either #923 is fixed first or the runner needs its own entry point.
  • #816. BNG2.pl must be available in every CI run.
  • The open backend bugs (#866, #868, #870, #872, #873, #926, #927, #941 and others). They will make rows fail on the first run. Each enters the manifest as KNOWN with its number.

Worked if

  • Reverting the fix for a closed backend-disagreement bug turns a row FAILED. This is shown for at least three such bugs.
  • Every open backend-disagreement issue that a shipped example exercises appears as a KNOWN row.
  • The per-push subset has a stated time budget and meets it.

Open question

Whether to import bngsim's parity_checks/_core (the differ, the outcome taxonomy, the fingerprint) or to copy its contract. It is in the bngsim repository but not in the wheel.

Related: #929 (roadmap), #923, #816, #817.

Lenguaje dominante
Python
Estrellas
25
Forks
25
Merge medio
4 h 5 min
PR fusionados (30 d)
10

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de lanl/PyBNF

Todos los issues de lanl/PyBNF

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.