Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ Knowledge retrieval is read-only; candidate storage is optional and separately
authorized. Automatic search and automatic knowledge promotion remain planned. Missing
or incomplete evidence stays `INCONCLUSIVE`.

An optional [offline harness-improvement path](docs/harness-improvement.md)
now checks caller-prepared skill edits using the existing Skill Eval runner:

```mermaid
flowchart LR
A["H0 + INV / DOM skill snapshots"] --> B["Matched development probes"]
B --> C["Quality-first, cost-aware choice or H0"]
C --> D["Mandatory rerun"]
D -->|"eligible candidate"| E["One-shot holdout gate"]
E --> F["Bounded candidate or retain H0"]
D -->|"H0 / invalid evidence"| F
```

This path is verified with fixed-output fixtures. Real-model automatic editing,
cross-task reuse and measured model savings remain unverified.

## Choose your starting path

| You want to… | Start at |
Expand Down Expand Up @@ -137,6 +153,11 @@ Ready to measure your own model? [Connect your benchmark and quality checks →]
The implemented [Harness × Model × Infra boundary](docs/architecture.md) keeps new
campaigns out of the common AB/BA scheduler, process cleanup and evaluator.

The [bounded skill policy](docs/harness-improvement.md#implemented-architecture)
sits above Skill Eval, reuses its comparison runner and independent verifier,
and records development experience separately from executor-facing skills.
Engine performance claims continue through the engine AB/BA lane.

![InferRSI system architecture: inputs, experiment loop and evidence](docs/assets/system-architecture-en.svg)

[English SVG](docs/assets/system-architecture-en.svg) ·
Expand Down
19 changes: 19 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ src/inferrsi/
runner.py One AB/BA loop; execute/snapshot adapter hooks
evaluation.py Performance/quality/source-integrity adjudication
reporting.py HTML evidence report
skill_evaluation.py Skill trials, usage summaries and shared trial budget
improvement.py Offline quality/cost selection policy; no model execution
scenarios/
external.py External benchmark/validator commands; metric-reader hook
media.py Warmup seeds, first-response retention, sample/artifact groups
Expand Down Expand Up @@ -116,6 +118,23 @@ examples/ Current Qwen runner, image validator and v4 adapter
tests/fixtures/legacy/ Frozen historical validation dependencies for regressions
```

### Bounded skill improvement

[`tools/skill_eval_improve.py`](../tools/skill_eval_improve.py) composes the existing
Skill Eval comparison tool for caller-prepared H0/INV/DOM snapshots. It freezes
the supported audit inputs and policy, shares one outer budget across probes,
mandatory rerun and one-shot holdout, and revalidates retained evidence when
reporting. The Harness policy module owns quality gates and cost selection;
the existing comparison runner and Infra executor still own trials and cleanup.
See the [implemented flow and offline limits](harness-improvement.md).

This is a separate optional skill-evaluation path. It neither replaces engine
AB/BA adjudication nor automatically writes/promotes knowledge. The initial
executor accepts only explicitly supplied trusted offline fixtures; automatic
model edits, external sandbox qualification and cross-task reuse remain future
work. Shared total-token and command-count summaries also serve the original
pilot, configured comparison and PR integration consumers.

## Where to extend

| Add | Main extension locations | Required qualification |
Expand Down
42 changes: 42 additions & 0 deletions docs/examples/harness-improvement/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Recorded offline controller example

These are fixed-output software controls for
[issue #93](https://github.com/InferMatrixLab/InferRSI/issues/93), generated with
the adjacent implementation and `tests.fixtures.skill_eval_improvement_demo`.
Python 3.12.3 and Git 2.47.3 were used on Linux. No real model was invoked.
Full raw trial artifacts are produced locally by the reproduction command;
these public JSON files retain the aggregate report without private paths.

| Control | Actual subprocess calls | Scripted total tokens | Scripted held-out candidate checks | Regressions |
| --- | ---: | ---: | ---: | ---: |
| Paired H0/H0 | 12 | 1,440 | 6/6 | 0 |
| Repeated H0, same call budget as the loop | 48 | 5,760 | 24/24 | 0 |
| Bounded INV/DOM → rerun → holdout | 48 | 4,200 | 6/6 | 0 |

The cheaper DOM fixture costs 240 scripted tokens over six development trials
but has three regressions; the controller rejects it. INV costs 360 versus its
paired H0's 720, passes the mandatory rerun and then the held-out checks. The
full loop records 4,200, not just the selected candidate's 360. These values
are deliberately programmed inputs to test quality-first selection and complete
accounting. **They do not show a measured percentage saving or success-rate
improvement for InferRSI.** The repeated-H0 control matches call count, not billed
cost or a hard token budget, and has no best-of-N answer selection.

The [summary](offline-summary.json) separates preparation and local pipeline
wall time. A single local timing observation is not a speedup benchmark; these
fixtures were also run alongside repository tests. The
[bounded report](bounded-report.json) retains phase costs, selection reasons,
rerun/holdout assessments and unknown proposal/monetary cost. Cached-input tokens
are recorded separately and are not added to total tokens twice.

Reproduce from the repository checkout with development dependencies:

```bash
python -m tests.fixtures.skill_eval_improvement_demo --output <new-output-dir>
```

The generated JSON includes retained-plan/report digests for that invocation.
Temporary Git commit identities, file digests and wall times can differ between
runs. The scripted call/token/outcome values above are reproducible. Model
efficacy, complete authoring-plus-execution cost and engine benefits remain
`INCONCLUSIVE`; this example is not a campaign `PASS`.
131 changes: 131 additions & 0 deletions docs/examples/harness-improvement/bounded-report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"plan_sha256": "81e4d4e425ea4eb58ea6dd7f145e4fc17df3bc37197cd7d3e1e430cfd6e82031",
"selection": {
"selected": "INV",
"reason": "quality_then_cost",
"assessments": {
"INV": {
"eligible": true,
"reason": null,
"success_rate": 1.0,
"baseline_success_rate": 1.0,
"total_tokens": 360,
"baseline_total_tokens": 720,
"regressions": 0
},
"DOM": {
"eligible": false,
"reason": "quality_floor",
"success_rate": 0.5,
"baseline_success_rate": 1.0,
"total_tokens": 240,
"baseline_total_tokens": 720,
"regressions": 3
}
},
"pareto": [
"INV"
],
"scores": {
"INV": 0.0
},
"plan_sha256": "81e4d4e425ea4eb58ea6dd7f145e4fc17df3bc37197cd7d3e1e430cfd6e82031"
},
"retained_selection_consistent": true,
"rerun": {
"eligible": true,
"reason": null,
"success_rate": 1.0,
"baseline_success_rate": 1.0,
"total_tokens": 360,
"baseline_total_tokens": 720,
"regressions": 0
},
"holdout": {
"eligible": true,
"reason": null,
"success_rate": 1.0,
"baseline_success_rate": 1.0,
"total_tokens": 360,
"baseline_total_tokens": 720,
"regressions": 0
},
"accepted": true,
"effective_candidate": "INV",
"phase_usage": {
"probe-INV": {
"calls": 12,
"input_tokens": 960,
"output_tokens": 120,
"cached_input_tokens": 240,
"total_tokens": 1080,
"command_calls": 24,
"elapsed_seconds": 0.20449978415854275
},
"probe-DOM": {
"calls": 12,
"input_tokens": 840,
"output_tokens": 120,
"cached_input_tokens": 240,
"total_tokens": 960,
"command_calls": 24,
"elapsed_seconds": 0.1887140409089625
},
"rerun-INV": {
"calls": 12,
"input_tokens": 960,
"output_tokens": 120,
"cached_input_tokens": 240,
"total_tokens": 1080,
"command_calls": 24,
"elapsed_seconds": 0.1887151626870036
},
"holdout-INV": {
"calls": 12,
"input_tokens": 960,
"output_tokens": 120,
"cached_input_tokens": 240,
"total_tokens": 1080,
"command_calls": 24,
"elapsed_seconds": 0.18848644592799246
}
},
"observed_execution": {
"calls": 48,
"input_tokens": 3720,
"output_tokens": 480,
"cached_input_tokens": 960,
"total_tokens": 4200,
"command_calls": 96,
"elapsed_seconds": 2.1600983038078994,
"cost": null
},
"budget": {
"calls": 48,
"observed_tokens": 4200,
"usage_complete": true,
"stop_reason": "call_budget"
},
"proposal_cost": null,
"proposal_cost_note": "Caller-prepared snapshots; authoring cost is unknown and excluded.",
"selected_execution": {
"trials": 6,
"verdicts": {
"PASS": 6,
"FAIL": 0,
"INCONCLUSIVE": 0
},
"evaluation_errors": 0,
"elapsed_seconds": 0.09431080287322402,
"input_tokens": 300,
"output_tokens": 60,
"cached_input_tokens": 120,
"total_tokens": 360,
"command_calls": 12,
"cost": null,
"expected_trials": 6,
"missing_trials": 0
},
"promotion": "not_evaluated",
"claim": "Offline control-flow evidence only. Fixture tokens are scripted, not billed. No measured model efficacy, end-to-end savings, sandbox isolation or engine speedup."
}
65 changes: 65 additions & 0 deletions docs/examples/harness-improvement/offline-summary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"kind": "offline_fixture_control",
"rows": [
{
"condition": "H0",
"preparation_seconds": 0.05566692119464278,
"execution_seconds": 0.5605955601204187,
"calls": 12,
"scripted_total_tokens": 1440,
"scripted_command_calls": 24,
"holdout_candidate_trials": 6,
"holdout_candidate_verdicts": {
"PASS": 6,
"FAIL": 0,
"INCONCLUSIVE": 0
},
"holdout_regressions": 0,
"effective_candidate": "H0",
"plan_sha256": "bd0d7c0062dfe8bf244b46cb8b7423e4db65d08c651f5207a9dbf07f446f79ad",
"report_sha256": "9c1c68988dc512a3bc95b0004de5ba7d0bc3f9dfd689ca46675592a1a8f00fb2"
},
{
"condition": "repeated-H0",
"preparation_seconds": 0.04197078011929989,
"execution_seconds": 1.9998727978672832,
"calls": 48,
"scripted_total_tokens": 5760,
"scripted_command_calls": 96,
"holdout_candidate_trials": 24,
"holdout_candidate_verdicts": {
"PASS": 24,
"FAIL": 0,
"INCONCLUSIVE": 0
},
"holdout_regressions": 0,
"effective_candidate": "H0",
"plan_sha256": "6ebec22ce01f12d61ec07c00711f3c190206b0830d92345adbdceb4a42789f21",
"report_sha256": "ba0866d1d2f145117eb122a1c844c2ecc5ee0eb6e3b79e3231e3263a8a2f0c2a"
},
{
"condition": "bounded",
"preparation_seconds": 0.1715290721040219,
"execution_seconds": 2.1994067209307104,
"calls": 48,
"scripted_total_tokens": 4200,
"scripted_command_calls": 96,
"holdout_candidate_trials": 6,
"holdout_candidate_verdicts": {
"PASS": 6,
"FAIL": 0,
"INCONCLUSIVE": 0
},
"holdout_regressions": 0,
"effective_candidate": "INV",
"plan_sha256": "81e4d4e425ea4eb58ea6dd7f145e4fc17df3bc37197cd7d3e1e430cfd6e82031",
"report_sha256": "b0e3d7f1d17708a737687b6aca07838f42a45919071343e9e74634812b3bb04b"
}
],
"scope": "Actual subprocess calls and pipeline wall time; scripted answers and tokens. H0 is a paired H0/H0 control, repeated-H0 has the bounded loop's 48-call budget. No best-of-N answer selection. Different repeat counts are not efficacy estimates.",
"model_calls": 0,
"monetary_cost": null,
"proposal_authoring_cost": null,
"efficacy_verdict": "INCONCLUSIVE",
"engine_performance_verdict": "INCONCLUSIVE"
}
Loading
Loading