id stringlengths 3 3 | label stringclasses 2
values | decisions listlengths 1 3 |
|---|---|---|
e01 | positive | [
{
"stage": "hash",
"decision": "reject",
"reason": "synthetic contract decision"
}
] |
e02 | negative | [
{
"stage": "hash",
"decision": "reject",
"reason": "synthetic contract decision"
}
] |
e03 | positive | [
{
"stage": "hash",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "cheap",
"decision": "reject",
"reason": "synthetic contract decision"
}
] |
e04 | negative | [
{
"stage": "hash",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "cheap",
"decision": "reject",
"reason": "synthetic contract decision"
}
] |
e05 | positive | [
{
"stage": "hash",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "cheap",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "expensive",
"decision": "reject",
"reason": "synthetic contract decision"
}
] |
e06 | negative | [
{
"stage": "hash",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "cheap",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "expensive",
"decision": "reject",
"reason": "synthetic contract decision"
}
] |
e07 | positive | [
{
"stage": "hash",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "cheap",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "expensive",
"decision": "pass",
"reason": "synthetic contract decision"
}
] |
e08 | negative | [
{
"stage": "hash",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "cheap",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "expensive",
"decision": "pass",
"reason": "synthetic contract decision"
}
] |
e09 | positive | [
{
"stage": "hash",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "cheap",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "expensive",
"decision": "pass",
"reason": "synthetic contract decision"
}
] |
e10 | negative | [
{
"stage": "hash",
"decision": "reject",
"reason": "synthetic contract decision"
}
] |
e11 | positive | [
{
"stage": "hash",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "cheap",
"decision": "reject",
"reason": "synthetic contract decision"
}
] |
e12 | negative | [
{
"stage": "hash",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "cheap",
"decision": "pass",
"reason": "synthetic contract decision"
},
{
"stage": "expensive",
"decision": "pass",
"reason": "synthetic contract decision"
}
] |
Rejected Check Audit
An offline audit tool for multi-stage filters. It keeps rejected events in the denominator and separates missing labels from negative labels. Python 3.9+; no dependencies, network requests, model inference or training.
All bundled events and labels are author-constructed fixtures. Results demonstrate accounting behavior, not model quality or production performance.
Dataset views
The complete, released_only, and partial_review configurations each contain twelve rows in the test split. They are three labeling views of the same twelve event identities, not 36 independent samples. JSONL files under data/ mirror the events in their matching executable fixture documents under fixtures/ exactly. The fixture document also records stage order and review-selection metadata, which the auditor requires.
For reproducible offline runs, download this repository and run from its root. No access token or model dependency is needed for the tool. The frozen FIXTURE-ORACLE-v0.1.md is the original preimplementation contract; subsequent local execution is demonstrated by the notebook and tests.
Run
From this directory:
python3 audit.py fixtures/complete.json --output results-complete
python3 verify_oracle.py fixtures/complete.json results-complete/report.json
python3 audit.py fixtures/released_only.json --output results-released
python3 audit.py fixtures/partial_review.json --output results-partial
python3 -m unittest discover -s tests -v
Use a new output directory on every run. A valid run exports report.json, stages.csv, paths.csv, metrics.csv, and bounds.csv. Invalid input exits with status 2 and creates no completed output directory. Existing reports are never silently overwritten. Events are sorted by ID, with no timestamp in results, so equivalent event ordering produces identical exports.
demo.ipynb runs the same three fixtures on CPU using the standard library. Set ROOT to the directory containing audit.py; the notebook creates only a temporary output directory. No paid API or accelerator is required.
New in 0.2.0: exact identification bounds
Original point estimates keep their existing eligibility rules: a metric that was unavailable still returns null; released precision can remain available when only rejected labels are missing. A separate identification_bounds object now reports exact rational lower/upper endpoints for precision and recall, along with whether a completion can make the denominator zero. bounds.csv exports the same values and flags.
The completion model keeps every known label and resolved prediction fixed. Each unknown label can be positive or negative; each unresolved prediction can resolve either way. Endpoints are the tight minimum and maximum among completions where that metric is defined. The tool makes no claim that every allowed completion is physically achievable. These are finite-input logical bounds, not sampling confidence intervals or population estimates.
| Existing fixture | Precision range | Recall range |
|---|---|---|
| Complete labels | [1/2, 1/2] | [1/3, 1/3] |
| Released-only labels | [1/2, 1/2] | [1/5, 1] |
| Selected review subset | [1/2, 1/2] | [2/9, 2/3] |
With only released events labeled, all eight rejected events might contain missed positives; alternatively none might. Reviewing e01 and e04 leaves six rejected labels unknown, narrowing the possible recall range without estimating their distribution.
A single known-positive event with unresolved prediction has precision [1,1] conditional on any event being released. It also admits an undefined precision completion. That interval alone is not a guarantee of perfect precision. Empty inputs have null endpoints and always_undefined=true. Precision and recall endpoints are separately attainable; their Cartesian rectangle should not be assumed jointly attainable.
BOUNDS-CONTRACT-v0.1.md was fixed before this implementation. BOUNDS-RESEARCH.md gives the endpoint formulas and proof sketch. The independent verify_bounds.py enumerates binary completions without using the analytical endpoint logic; tests compare all 715 observed-state multisets of up to four events, covering 6,978 binary completions. That finite verification does not replace the algebraic argument for larger inputs. No model was trained or evaluated for this update.
Frozen example
The twelve-event contract was fixed before implementation. See FIXTURE-ORACLE-v0.1.md for the event-by-event table.
| Labels available | Covered / all | TP / FP / FN / TN observed | Precision of final releases | Overall recall |
|---|---|---|---|---|
| Complete | 12/12 | 2 / 2 / 4 / 4 | 1/2 | 1/3 |
| Released only | 4/12 | 2 / 2 / 0 / 0 | 1/2 | Not identifiable |
| Selected review subset | 6/12 | 2 / 2 / 1 / 1 | 1/2 | Not identifiable |
The zero observed FN/TN in released-only review does not mean no misses. None of the eight rejected events was reviewed. The selected review subset covers two of eight rejections and is not a probability sample; its error rate is never extrapolated.
Stage reach/reject/pass counts are 12/3/9, 9/3/6, and 6/2/4. Rejected fractions are exported against both the reached denominator and all twelve original events. An early rejection does not fabricate downstream decisions. Known missed-positive paths are e01 at hash, e03/e11 at cheap, and e05 at expensive.
Input contract
One UTF-8 JSON document, schema version 1. Exact fields are required; unsupported keys fail validation.
| Field | Meaning |
|---|---|
schema_version |
Integer 1 |
stages |
Nonempty ordered list of unique stage names |
review.scope |
What inputs were reviewed |
review.selection |
How reviewed events were selected |
review.rule |
What the positive/negative label means |
events[].id |
Unique nonempty event identity; duplicates, even identical, fail |
events[].label |
positive, negative, or explicit unknown |
events[].decisions |
Ordered, contiguous prefix of configured stages |
decisions[].stage |
Exact configured stage name at this position |
decisions[].decision |
pass, reject, or unknown |
decisions[].reason |
Nonempty reason, retained in the source trace |
Every event starts at the first stage. reject and unknown are terminal. A short trace ending in pass is invalid: append an explicit unknown at the next uncompleted stage. Only a full all-pass trace predicts positive. Rejection predicts negative; unknown predicts neither. Label conflicts represented as duplicate identities fail instead of silently picking one label. Duplicate JSON object keys also fail.
Output interpretation
observed_confusion_matrix counts only resolved predictions with known labels. confusion_matrix is null unless all labels and predictions are complete. Precision is reported only when every released event has a label. Recall conservatively requires all labels and resolved predictions. The separate bounds object computes logical identification intervals under its declared completion model; it does not turn them into point estimates. Every null ratio carries a reason; an empty denominator is null, never zero. Known numerators beside null metrics are observed counts only.
Stage unresolved counts explicit unknown decisions, not_reached counts stages with no recorded decision. paths retains terminal stage/reason and observed matrix cell by identity; the original JSON retains every intermediate reason. Review metadata is descriptive, not verified evidence of random sampling. No sampling weights, population extrapolation, confidence intervals, deduplication heuristics, or claims of causal filter improvement are implemented.
Verification and provenance
verify_oracle.py reconstructs counts separately and never imports the implementation. It also checks constants transcribed from the preimplementation contract. Tests cover incomplete labels, abstention, all-reject behavior, empty denominators, order invariance, renamed identities, invalid traces and deterministic/fail-closed exports. This is offline accounting validation, not external validation of an ML system.
Code, notebook, and synthetic fixtures: copyright 2026 Renchao Wu; Apache-2.0. No third-party data, private traces, credentials, employer material, model responses, or course answers are included. Source code and fixtures are inspectable. A real deployment must establish event identity, label quality, sampling design and stage semantics before interpreting its results. Reports copy IDs/reasons from their input: review your own data before sharing reports.
中文说明
这是多阶段筛选链路的离线分母审计工具。被前置阶段拒绝的事件仍留在原始分母里;未知标签不当成负例,未知判定单独统计。只标注放行项时可以算放行精确率,但不能据此声称知道总体召回率。按目的选择的少量拒绝样本只报告实审覆盖,不外推总体漏检率。
附带的十二项数据是作者构造的合成案例,标签与手算结果在实现前固定。没有训练、模型推理、真实业务数据或模型性能结论。使用上面的命令即可在本地CPU运行,所有产出为JSON和CSV,Notebook也是同一套离线演示。当前版本0.2.0。
版本0.2.0新增精确上下界,原单值/null结果保持。上下界只针对输入事件,并以相应指标分母非零为条件;未知结果可能仍使指标无定义,需同时读取undefined_possible。它不是总体外推或抽样置信区间。
- Downloads last month
- 118