Skip to content
Merged
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
2 changes: 1 addition & 1 deletion docs/contracts/function-owners.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Any later split of a mixed function is accepted by real pytest/host/wheel/record

## Implemented rows

The skill-evaluation split (#410) implements the `skill_evaluation`, `skill_eval_diagnostic`, `skill_eval_engineering` and `improvement` rows. H keeps `harness/skill_evaluation.py`, `harness/artifact_sandbox.py` and `harness/improvement.py`; B holds `benchmark/skill_evaluation.py`, `benchmark/skill_eval_diagnostic.py`, `benchmark/skill_eval_engineering.py` and `benchmark/improvement.py`; Apps composes them in `apps/workflows/skill_evaluation.py`, `apps/workflows/skill_eval_engineering.py` and `apps/workflows/improvement.py`. Two points follow the tree as it stands after #338, not the row text:
The skill-evaluation split (#410) implements the `skill_evaluation`, `skill_eval_diagnostic`, `skill_eval_engineering` and `improvement` rows. H keeps `harness/skill_evaluation.py`, `harness/artifact_sandbox.py` and `harness/manager/search/improvement.py`; B holds `benchmark/skill_evaluation.py`, `benchmark/skill_eval_diagnostic.py`, `benchmark/skill_eval_engineering.py` and `benchmark/improvement.py`; Apps composes them in `apps/workflows/skill_evaluation.py`, `apps/workflows/skill_eval_engineering.py` and `apps/workflows/improvement.py`. Two points follow the tree as it stands after #338, not the row text:

- `usage_totals` stays in `harness/usage.py`, because `harness/optimization.py` consumes it for budget accounting. B `assessment` receives the baseline and candidate totals from Apps and does not import H.
- `SelectionPolicy` holds only the two thresholds, so it lives whole in B. H `choose` receives the assessments, the validity block and the composition flag; it holds no threshold and no policy class.
2 changes: 1 addition & 1 deletion docs/guides/harness-improvement.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ flowchart TB
```

`src/inferrsi/benchmark/improvement.py` owns the thresholds and acceptance rules,
`src/inferrsi/harness/improvement.py` the search progression and
`src/inferrsi/harness/manager/search/improvement.py` the search progression and
`src/inferrsi/harness/usage.py` usage accounting; `src/inferrsi/apps/workflows/improvement.py`
composes them.
`tools/skill_eval_improve.py` owns freezing, declarative snapshot materialization
Expand Down
17 changes: 9 additions & 8 deletions docs/guides/module-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,22 +332,23 @@ The leaf's own import rule and `REPO_TYPES` object identity govern it.
names, with or without a file behind it. Since #498 the names `inferrsi.infra`
and `inferrsi.model` are retired as a whole, so any import of either fails. Before
that, `inferrsi.infra` reached no Knowledge, Harness, Benchmark, or Apps module.
- **New H entries.** The registered entry modules are
`inferrsi.harness.api`, `inferrsi.harness.execution_service`,
- **Harness entries.** The registered component packages are
`inferrsi.harness.manager` and `inferrsi.harness.executor`. The gate also
tracks `inferrsi.harness.api`, `inferrsi.harness.execution_service`,
`inferrsi.harness.input_binding`, `inferrsi.harness.local_process`,
`inferrsi.harness.run_store`, and `inferrsi.harness.errors`. Each entry's
closure is walked on the full graph. The gate does not infer other module
paths from labels. Any `inferrsi.harness.*` module that exists is still
checked against the closure rule above. The current mixed `harness` tree is
not automatically an isolated core.
`inferrsi.harness.run_store`, and `inferrsi.harness.errors`. Each registered
entry must appear in the import graph and satisfy its dependency rules.
The closure rule above applies to every Harness module. The gate rejects
imports of the ten former root-level search modules and any file that
restores one of those paths.
- **No residual.** The skill-evaluation split (#410) moved `export_bundle` to
Apps and removed the registered `harness.skill_evaluation` → root
`knowledge_operations` edge together with its exemption. Every harness
module is walked on the full graph. A harness module that reaches an old
root leaf fails, and so does each harness module that reaches the leaf
through it. The report lists every remaining `harness` → Model or Infra
path in `harness_model_infra`; the split modules `harness.skill_evaluation`,
`harness.improvement`, `harness.artifact_sandbox` and `harness.atomic_json`
`harness.manager.search.improvement`, `harness.artifact_sandbox` and `harness.atomic_json`
have none.

The manifest records the base commit, each old leaf's file hash at that
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Effect classes used below:
| Qualify an artifact verifier host | [Manual reviewer qualification](skill-evaluation/skill-eval-reviewer-qualification.md), `python -m tools.skill_eval_qualify` | Trusted-control execution / report-generating | Manual main-only workflow; fixed software controls, no model or external artifact input; unavailable isolation fails rather than skips |
| Replay a cloud-generated parser pair | [Isolated cloud replay](skill-evaluation/skill-eval-cloud-replay.md), `python -m tools.skill_eval_cloud_replay` | Untrusted-artifact execution / report-generating | Manual pinned data ingress; same-host controls before bubblewrap-only replay; no models or credentials |
| Validate one harness-improvement step | [Offline improvement](harness-improvement.md), Python `tools.skill_eval_improve.prepare` / `run_offline` | Snapshot-writing / offline experiment-executing | Supplied declarative INV/DOM edits, shared total limits, rerun and one holdout gate; trusted fixed-output clients only; no real-model or Store execution |
| Build an offline candidate tree and completion menu | Python `harness.search_tree` / `harness.verification_plans.completion_menu`; [control contract](speculative-search.md) | Read-only / in-memory transitions | Immutable candidates, scoped caller-supplied receipts and bounded exact plans; execution, durable state, accounting, learned roles and final acceptance require separate adapters |
| Build an offline candidate tree and completion menu | Python `harness.manager.search.search_tree` / `harness.manager.search.verification_plans.completion_menu`; [control contract](speculative-search.md) | Read-only / in-memory transitions | Immutable candidates, scoped caller-supplied receipts and bounded exact plans; execution, durable state, accounting, learned roles and final acceptance require separate adapters |
| Run bounded speculative Engine search and role updates | `inferrsi search engine`; [support and configuration](speculative-search.md) | Execution / candidate writes / CPU model updates | Explicit shared RunStore, permissions, checkpoint, budgets, domain and final gate; actual device allocation is caller-owned |
| Inspect/export speculative search | `inferrsi search status` / `search export` | Read / output artifact | Reads the existing store; never restarts search, training or final evaluation |
| Compose Skill speculative search | Python `apps.workflows.search_benchmarks.SkillEvaluator` and checkout `tools.speculative_skill.Comparator` | Explicit provider execution through existing comparator | Frozen original baseline, split descriptors, independent grader and bounded provider; see campaign accounting limits in the support matrix |
Expand Down
26 changes: 20 additions & 6 deletions docs/guides/speculative-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,32 @@ paper's language-model training or establish its reported gains. Existing

## Supported profile and authority

Direct callers import `EngineSearchPlan`, `run_engine_search` and `read_engine_search`
from `inferrsi.harness.manager`. Apps parses `inferrsi search engine` arguments and
supplies the checkpoint loader and evaluator factory. Manager checks the campaign cap
and final reserve before either callback runs or any session or RunStore is created.
It selects a candidate using development evidence, binds that candidate to one final
evaluation and returns the stored result. `read_engine_search(session)` reads it back.

The search implementation moved from the Harness root to `harness/manager/search/`.
This includes `gvo`, `improvement`, `search_adapter`, `search_campaign`,
`search_continuations`, `search_records`, `search_tree`, `vats`, `verification_plans`
and `work_control`. For subprocess environment setup, replace imports of
`runtime_environment` from `inferrsi.harness.optimization_session` with
`from inferrsi.harness.executor import runtime_environment`.

| Component | Implementation | Boundary |
| --- | --- | --- |
| Candidate/evidence model | `harness.search_tree`, `search_records` | Immutable artifacts, actual dependency epochs and complete-candidate selection |
| Solver | `harness.verification_plans`, `vats.menu` | Bounded exhaustive completion plans; conservative integer millisecond caps |
| Drafter | `apps.workflows.search_roles`, `harness.search_adapter` | Trainable softmax over supplied exact text edits; actual retained changes, not free-form LLM generation |
| Candidate/evidence model | `harness.manager.search.search_tree`, `search_records` | Immutable artifacts, actual dependency epochs and complete-candidate selection |
| Solver | `harness.manager.search.verification_plans`, `vats.menu` | Bounded exhaustive completion plans; conservative integer millisecond caps |
| Drafter | `apps.workflows.search_roles`, `harness.manager.search.search_adapter` | Trainable softmax over supplied exact text edits; actual retained changes, not free-form LLM generation |
| Policy | `apps.workflows.search_roles` | Independent eight-feature linear softmax, recorded behavior probabilities, deterministic deployment actions |
| Scorer | `apps.workflows.search_roles` | Separate linear model; actual suffix MSE and optional paid continuation differences |
| Work/state authority | `harness.work_control` | Transactions in the shared `RunStore` SQLite database |
| Work/state authority | `harness.manager.search.work_control` | Transactions in the shared `RunStore` SQLite database |
| Execution | Existing `trials.external` and `local_process` | Absolute deadline and process-domain cleanup; no new subprocess runner |
| Engine | `apps.workflows.search_benchmarks.EngineEvaluator` | Existing packaged `optimization.py` as one whole check; currently the Qwen denoiser NPU task |
| Skill | `apps.workflows.search_benchmarks.SkillEvaluator`, checkout `tools.speculative_skill.Comparator` | Explicit provider configuration, original baseline, independent grader, separate development/holdout descriptors |
| Final | `harness.search_campaign.finalize` | One-time scope claim before access; receipt-only recovery/export; task promotion only |
| Final | `harness.manager.search.search_campaign.finalize` | One-time scope claim before access; receipt-only recovery/export; task promotion only |

This is a trusted local host controller. Resource domains exclude **cooperating
controllers sharing one RunStore**. They are not scheduler/GPU reservations,
Expand Down Expand Up @@ -150,7 +164,7 @@ The formal objectives are in [SpecRSI §3.4](https://arxiv.org/html/2610.16491v2
receipts. Final measurements are reserved for independently retesting the
selected candidate.

The [collection and target code](../../src/inferrsi/harness/gvo.py) and the
The [collection and target code](../../src/inferrsi/harness/manager/search/gvo.py) and the
[CPU role update](../../src/inferrsi/apps/workflows/search_roles.py) implement these
steps with finite edit operators, a linear Policy and a linear Scorer. The
caller supplies the initial checkpoint and its provenance.
Expand Down
2 changes: 1 addition & 1 deletion evidence/qwen-vats-gvo-910b1-20261124/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This Engine diagnostic for [InferRSI #363](https://github.com/InferMatrixLab/Inf
compares a fixed-order serial control, frozen VATS and VATS after one GVO update
on the packaged Qwen-Image 2.1 denoiser. The underlying search and task code was
[f5b9a18](https://github.com/InferMatrixLab/InferRSI/tree/f5b9a1819d387e0a0a1a219da6dcc0f5504c4069).
The [design document](../../docs/speculative-search.md#measuring-the-contribution-of-gvo)
The [design document](../../docs/guides/speculative-search.md#measuring-the-contribution-of-gvo)
explains the comparison and reports the independent-final results.

- [Frozen plan](plan/plan.json), [archived measurement driver](https://github.com/InferMatrixLab/InferRSI/blob/1921271c99d1fc3532e882c1ce6dd4e3ce6d74a0/evidence/qwen-vats-gvo-910b1-20261124/plan/run.py) and [RunSpec](plan/runspec.json) identify the exact edits, weights, workload, ordered seeds, evaluation caps, runtime and task file hashes.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"README.md": "e8ae15c859ecbb15a9c2af8da15c26725886940540f4cdaf9c590b94f2002705",
"README.md": "2f989efc36cef123897f09c8a96855cac9ce64b6c2916fe34a30d9b96d2d9ad0",
"patch/README.md": "e2a3af7bd373d9e1637265f3980fd272cbbc181d455d275794bf66f2cc6f8095",
"plan/edits.json": "2975fee42370debd80f627ecd58880e45280968f739ca3045c8b388bc9ab4cbb",
"plan/plan.json": "66344b1ca1522fd3b38966c243bbb6ec8eb8fecc203ccd171690463569632013",
"plan/run.py": "8c66690aa9bb7b53dcbfe568bfe3654a65436a11ee7a05b21c2d3c0d611e1ad5",
"plan/run.py": "e16382292afc735615c1f21c230aaa4054c68613d084f4a75c61e04295af0d74",
"plan/runspec.json": "f3f2ab71d227ee3e7d95233cc3d34e17ab41d086f519f558fb3aca5200515404",
"results/local-archive.json": "c5df5dc55feb202e53f28d5b6f4ba28913e893277d9deb5e783a472c686d9ae6",
"results/summary.json": "df3029cfcaacb91018b6c931017b059b99a80633116586f9446fe82e31986132",
"results/trials.jsonl": "6bd39719a5c0d794b1c5e04403b03789ae5ca42e0c9c74694200bdb6355a0756",
"validator/README.md": "3b2b92982f3e3c377a755972002beaad454451bdc08cd2db68e5d4256337fa3d",
"validator/check.py": "4b408d07d0cdff724312f86746c9de5d6996e9b8925f61c5453dc9761f646f04"
"validator/README.md": "c224e3d864829d5c1a2f8bc4e4c89e36834409d4ce78fc1fa7dc59f6f739fdd3",
"validator/check.py": "6cd0948acf82c6870ac29c2188ede2092dca83e64e73aea2224edeb2f9187e2b"
}
14 changes: 7 additions & 7 deletions evidence/qwen-vats-gvo-910b1-20261124/plan/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@

from inferrsi.apps.workflows.search_benchmarks import EngineEvaluator
from inferrsi.apps.workflows.search_roles import Snapshot
from inferrsi.harness import search_tree
from inferrsi.harness.artifact_primitives import digest, sha256
from inferrsi.harness.atomic_json import atomic_write_json
from inferrsi.harness.run_store import RunStore
from inferrsi.harness.search_adapter import ArtifactAdapter, Edit
from inferrsi.harness.search_campaign import (
from inferrsi.harness.manager.search import search_tree
from inferrsi.harness.manager.search.search_adapter import ArtifactAdapter, Edit
from inferrsi.harness.manager.search.search_campaign import (
FinalAcceptance,
finalize,
import_qualified_root,
learn,
qualify_root,
)
from inferrsi.harness.search_records import decode
from inferrsi.harness.vats import Search, Settings
from inferrsi.harness.work_control import WorkControl
from inferrsi.harness.manager.search.search_records import decode
from inferrsi.harness.manager.search.vats import Search, Settings
from inferrsi.harness.manager.search.work_control import WorkControl
from inferrsi.harness.run_store import RunStore

HERE = Path(__file__).resolve().parent

Expand Down
16 changes: 10 additions & 6 deletions evidence/qwen-vats-gvo-910b1-20261124/validator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ complete numerical result and verified process cleanup. The VATS final also
requires a durable overall PASS and promotion of the selected candidate.

Hardware replay uses the command and environment in the
[design document](../../../docs/speculative-search.md#measuring-the-contribution-of-gvo).
[design document](../../../docs/guides/speculative-search.md#measuring-the-contribution-of-gvo).
Supply a fresh directory. RunStore operation identities and hardware timings vary
between replays. The trial index records the actual files from this run.

Expand All @@ -33,8 +33,12 @@ the unpacked original archive, preserve its `config/run.py` next to the
own bytes in each new trial directory. Its summary also records incomplete
and unrun arms, which prevent publication of paired results.

For trials made with the current driver, each VATS claim and its settled final
operation must carry the same rule. It requires every check to pass with verified cleanup
and applies no additional score threshold. The checker also recognizes the pinned driver
from [the previous revision](https://github.com/InferMatrixLab/InferRSI/blob/b974554199cb10759da03a75f333e608c91d7395/evidence/qwen-vats-gvo-910b1-20261124/plan/run.py).
The recorded promotions from older drivers remain historical results.
For trials made with the current driver or the driver immediately before the
Harness search move, each VATS claim and its settled final operation must carry
the same acceptance rule. Every check must pass with verified cleanup, with no
additional score threshold. The checker identifies the driver from its retained
bytes. [Pre-migration driver](https://github.com/InferMatrixLab/InferRSI/blob/54342cc573896c953cb0e2fb8734ef28262b5bda/evidence/qwen-vats-gvo-910b1-20261124/plan/run.py)

The earlier driver at `b974554` predates the stored acceptance rule. For this
pinned driver the checker verifies the recorded promotion, selected candidate
and settled receipt using the fields available in that run. [Earlier driver](https://github.com/InferMatrixLab/InferRSI/blob/b974554199cb10759da03a75f333e608c91d7395/evidence/qwen-vats-gvo-910b1-20261124/plan/run.py)
18 changes: 12 additions & 6 deletions evidence/qwen-vats-gvo-910b1-20261124/validator/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

from inferrsi.benchmark.registry import task_resources
from inferrsi.harness import candidates, task_protocol
from inferrsi.harness.manager.search.work_control import WorkControl
from inferrsi.harness.run_store import RunStoreReader
from inferrsi.harness.work_control import WorkControl

PLAN = Path(__file__).resolve().parents[1] / "plan"
PRE_MIGRATION_DRIVER_SHA256 = "8c66690aa9bb7b53dcbfe568bfe3654a65436a11ee7a05b21c2d3c0d611e1ad5"
# The published driver at b974554 saved its own bytes before rules were stored in claims.
PREVIOUS_DRIVER_SHA256 = "548c67815bafa10ab2ff05fe4a09596e2ab99dbae28fc526c01bfa50f8f471ff"

Expand All @@ -35,6 +36,13 @@ def close(left, right):
return math.isclose(left, right, rel_tol=1e-12, abs_tol=1e-12)


def replay_requires_acceptance(driver, current_driver):
if driver == PREVIOUS_DRIVER_SHA256:
return False
require(driver in (current_driver, PRE_MIGRATION_DRIVER_SHA256), "Replay driver identity")
return True


def promoted_final(doc, campaign, candidate_root, *, require_acceptance=False):
final = doc["final_result"]
claim = doc["final_claim"]
Expand Down Expand Up @@ -90,16 +98,14 @@ def main(completed, failed, historical_driver=None):
require(sha(task / name) == expected_hash, name)
summary = read(completed / "summary.json")
current_driver = sha(PLAN / "run.py")
require_acceptance = False
for name, expected_hash in spec["input_sha256"].items():
path = PLAN.parent / name
if name == "plan/run.py":
if "driver_sha256" in summary:
path = completed / "driver.py"
expected_hash = summary["driver_sha256"]
require(
expected_hash in (current_driver, PREVIOUS_DRIVER_SHA256),
"Replay driver identity",
)
require_acceptance = replay_requires_acceptance(expected_hash, current_driver)
else:
# The original archive includes the driver used for the published measurements.
path = historical_driver or completed.parent.parent / "config/run.py"
Expand Down Expand Up @@ -133,7 +139,7 @@ def main(completed, failed, historical_driver=None):
doc,
campaign,
completed / "artifacts/candidates",
require_acceptance=summary.get("driver_sha256") == current_driver,
require_acceptance=require_acceptance,
)
for operation, op in doc["operations"].items():
require(op["status"] == "settled", operation)
Expand Down
3 changes: 2 additions & 1 deletion src/inferrsi/apps/workflows/benchmark_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from inferrsi.benchmark.registry import task_resources
from inferrsi.harness import optimization_session
from inferrsi.harness.executor import runtime_environment


def run_task(name: str, arguments: list[str]) -> int:
Expand All @@ -15,5 +16,5 @@ def run_task(name: str, arguments: list[str]) -> int:
return subprocess.call(
[sys.executable, str(Path(optimization_session.__file__).resolve()),
str(entry), *arguments],
env=optimization_session.runtime_environment(),
env=runtime_environment(),
)
Loading
Loading