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

未关闭
#980 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
testing-qa

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Python
星标
25
派生
25
平均合并
4 小时 5 分钟
30 天内合并 PR
10

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

lanl/PyBNF 的其他 Issue

查看 lanl/PyBNF 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。