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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
in the former `inferrsi.harness.task_protocol` module. Each operation uses the
frozen task resources and the same isolated child process protocol.

- Import `launch_server`, `stop_server`, `post_json` and `ImageProtocol` from
`inferrsi.harness.executor`. This replaces the published
`inferrsi.harness.serving.server` (launch and stop), `inferrsi.harness.serving.http`
(JSON transport) and `inferrsi.harness.serving.image` (image requests) modules.
Managed service callers import `prepare_service` and `execute_service_attempt` from
`inferrsi.harness.executor`, and `service_assessment` and `service_settlement_reason`
from `inferrsi.harness.evaluator`. The former `harness.project_service` and
`harness.service_evidence` modules have been removed.

- Import the four-port AB/BA loop with `from inferrsi.harness.manager import run_experiment`.
The former `inferrsi.harness.runner` module was removed. The `inferrsi run` CLI and
`inferrsi.apps.legacy.run.run_experiment` continue to supply the four port bindings.
Expand Down
11 changes: 6 additions & 5 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ rules, while Harness manages their execution and the complete optimization lifec
Neither infers quality criteria from a natural-language goal.
Ordinary projects default to the current Agent conversation.
The optional [service-reuse protocol](guides/service-reuse-campaigns.md) adds project
assessment and foreground service ownership within this same controller. Its
protocol and result rules live in `harness.project_service`, with process
lifetime managed by `local_process`.
assessment and foreground service ownership within this same controller.
Executor freezes the inputs, owns the foreground service and records stage receipts.
Evaluator checks the receipts and decides the next stage or formal verdict. Candidate
checkpoints retain that verdict before profiling and service cleanup.
The [experimental speculative search](guides/speculative-search.md) composes immutable
candidate trees, bounded completion menus, synchronous VATS and CPU GVO roles.
Its work controller uses shared RunStore transactions and the existing local
Expand Down Expand Up @@ -286,7 +287,7 @@ the [import gate](guides/module-layout.md#import-gate) for migration and depende

| Add | Main extension locations | Required qualification |
| --- | --- | --- |
| Model or scenario | `harness/serving`, `benchmark/metrics.py`, `benchmark/validators`; trials run through the model-independent `harness/executor/trials/external.py` | Frozen request and metric contract; model-specific quality coverage |
| Model or scenario | `harness/executor/serving`, `benchmark/metrics.py`, `benchmark/validators`; trials run through the model-independent `harness/executor/trials/external.py` | Frozen request and metric contract; model-specific quality coverage |
| Repository | `apps/host/targets`, a composed scenario, `resources/repo_packs` | Stable source identity; command/result contract; environment isolation |
| Hardware | `apps/host/platforms` | Device selection, process exclusivity and independent backend/model evidence; a backend is registered in `apps/host/platforms/__init__.py` and its probe command is defined in the implementing module under `apps/host/platforms/`, not in package data |

Expand Down Expand Up @@ -382,7 +383,7 @@ change the AB/BA algorithm, process cleanup or evaluator.

## Compatibility and historical evidence

The supervised server helpers (`harness.serving.server.launch_server` / `stop_server`)
The supervised server helpers `launch_server` and `stop_server` in `inferrsi.harness.executor`
require Linux with a readable `/proc` process table. They reject other platforms
before launch; missing or inaccessible process enumeration raises an error rather
than reporting successful cleanup. Workers must remain in their owned process
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ policy does not renormalize existing blobs or authorize edits to frozen files.
Nightly checks cover Linux and Windows checkouts with `core.autocrlf` set to
`false`, `true` and `input`.

Use `harness/serving` for a new model's server and request protocol and
Use `harness/executor/serving` for a new model's server and request protocol and
`benchmark/metrics.py` with `benchmark/validators` for its metric and quality checks.
`harness/executor/trials/external.py` runs any external command as one trial and is the
same for every model. Use `apps/host/targets` with `resources/repo_packs` for
Expand Down
8 changes: 8 additions & 0 deletions docs/guides/module-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ into runs by file path.

### Core and technical packages

Import `ImageProtocol`, `post_json`, `launch_server` and `stop_server` from
`inferrsi.harness.executor` for image requests, JSON transport and supervised servers.

Service-reuse callers prepare the frozen plan and run an attempt through
`prepare_service` and `execute_service_attempt` from the same package. The
`inferrsi.harness.evaluator` package evaluates the retained measurement and quality
receipts. The campaign controller uses those results to commit the round.

Use `inferrsi.harness.executor.request_digest` for the execution request's
semantic ID. Mount an existing store with `RunStore` or `RunStoreReader` from
`inferrsi.harness.records`, using the original root and namespace. A read by
Expand Down
3 changes: 1 addition & 2 deletions examples/qwen21_turbo_b300.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

import inferrsi
from inferrsi.benchmark.sampling import collect_samples
from inferrsi.harness.serving.image import ImageProtocol
from inferrsi.harness.serving.server import launch_server, stop_server
from inferrsi.harness.executor import ImageProtocol, launch_server, stop_server
from inferrsi.apps.host import environment, targets
from inferrsi.apps.host.platforms.cuda import qualify_devices
from inferrsi.apps.storage import artifacts
Expand Down
49 changes: 35 additions & 14 deletions src/inferrsi/harness/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ measurement and assessment rules.
canonical `request_digest` and `runtime_environment`. Child processes use the
same InferRSI installation as their parent. Manager calls `process_group_empty`
on Executor when verifying a recorded service's process group.
Import `launch_server` and `stop_server` from Executor to supervise a Linux server.
The same package supplies `post_json` and `ImageProtocol` for sending requests.
Hosts import `prepare_generation` here to seal the context and plan before
registration. `read_prepared_binding` verifies the fixed artifact bytes,
`project_prepared_binding` reads the execution fields from those bytes, and
Expand All @@ -66,13 +68,15 @@ The agent chooses a hypothesis and edits a candidate between rounds.
and assembles context within the requested byte budget. The capture records delivered material,
revisions and omissions. A new session can use `--ranking-policy applicability` to raise the
applicability weight from 2 to 3. The default keeps the original six weights.
- **Executor** owns the retained candidate, task runner and [service lifecycle](project_service.py),
- **Executor** owns the retained candidate, task runner and [service lifecycle](executor/serving/_attempt.py),
including measurement collection, process ownership and cleanup.
- **Evaluator** uses the frozen rules and stage receipts to decide the next stage or verdict.
`assess_ordinary` dispatches packaged tasks to the frozen task assessor supplied by Apps.
For AB/BA projects, `assess_project` rereads retained evidence with the same
`inspect_project_step` rule used during execution. Service screening is
diagnostic. [Service evaluation](project_service.py) uses formal samples and quality evidence.
diagnostic. [Service evaluation](evaluator/_service.py) reads formal samples and quality evidence.
Its decision tells Executor which stages to skip, whether to collect or reuse a quality receipt,
and when the candidate has a formal verdict that can be checkpointed before cleanup.

New plans freeze the ranking ID, scoring version and all effective weights. Ordinary
plans and delivery receipts include a configuration digest. Service plans, manifests
Expand Down Expand Up @@ -117,23 +121,36 @@ sequenceDiagram
alt Ordinary session
M->>M: Check the runtime fingerprint and retained execution
else Service-reuse session
M->>M: Check the plan version, checkpoint and cleanup for this attempt
M->>M: Check the plan version before writing
M->>M: Match the checkpoint and cleanup proof to the original attempt and service
end
else Execute a new attempt
M->>M: Record pending work and its budget under the lock
M->>X: Frozen candidate, execution identity, protocol and deadline
alt Service-reuse evaluation
X->>X: Pass precheck, start the service and measure
X->>V: Role, reference type, frozen gates and formal samples
V-->>X: Next stage or reason to skip
X->>V: Stage receipts, quality source or reason for skipping quality
V-->>X: Formal verdict and evidence references
X->>X: Save the candidate checkpoint
opt Eligible verdict and configured inline profiling
X->>X: Capture profile on this service and record the result or interruption
X->>V: Functional precheck receipt
alt Precheck rejects or evidence is incomplete
X-->>M: Return FAIL or INCONCLUSIVE before service start
else Precheck passes
X->>X: Start the service and verify readiness and binding
opt Configured candidate performance screening
X->>V: Screening samples for a diagnostic estimate
end
X->>V: Role, binding, frozen references and formal measurements
V-->>X: Performance decision and required quality evidence
opt Quality required
X->>V: Live quality receipt or retained baseline reference
V-->>X: Quality decision or incompatible evidence
end
opt Candidate reached a formal verdict
X->>X: Persist the candidate checkpoint
opt Eligible verdict and configured inline profiling
X->>X: Capture profile on this service and record the result or interruption
end
end
X->>X: Stop the service and capture cleanup proof
X-->>M: Stage receipts, any checkpoint and cleanup proof for this attempt
end
X->>X: Stop the service and capture cleanup proof
X-->>M: Checkpoint and cleanup proof bound to the original attempt
else Ordinary project steps or packaged task
opt Per-step check for an ordinary project
loop Until the first rejected step or the end of the plan
Expand All @@ -158,7 +175,11 @@ Workers can exchange immutable inputs and evidence references. Live processes, l
storage connections stay with their owners.

The ordinary project runner inspects each completed step before starting the next one.
Final assessment reuses the same inspection rules. In a service-reuse candidate, a
Final assessment reuses the same inspection rules. A service candidate proceeds from
screening to formal measurements even when the screening estimate is low. A formal
performance failure skips quality. A baseline may reuse a matching quality receipt.
An incompatible scorer yields INCONCLUSIVE. Refreshing the parent performance reference
skips both quality and profiling. In a service-reuse candidate, a
successful gate check or formal performance failure permits inline profiling after the
checkpoint and before cleanup. A quality failure skips profiling. If that capture is
interrupted, recovery uses the checkpoint and retained capture progress. The separate
Expand Down
64 changes: 59 additions & 5 deletions src/inferrsi/harness/evaluator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Assess ordinary attempts against frozen rules and retained evidence."""
"""Assess ordinary and service attempts against frozen rules and retained evidence."""

from ._measurement import (
CONFIDENCE,
Expand All @@ -17,12 +17,66 @@
validate_mechanism,
)
from ._project import assess_project, inspect_project_step, project_steps
from ._service import (
ServiceStageDecision,
aggregate_service_measurements,
assess_service_performance,
check_service_quality_reference,
prefer_service_measurements,
service_assessment,
service_measurement_decision,
service_metric_change,
service_precheck_passed,
service_profile_eligible,
service_quality_decision,
service_quality_passed,
service_quality_score,
service_ready,
)
from ._service_evidence import (
service_choice,
service_reference_snapshot,
service_references_reason,
service_settlement_reason,
)

__all__ = [
"CONFIDENCE", "DIRECTIONS", "METHOD", "MIN_PAIRS", "assess_ordinary", "assess_project",
"explain", "gate_speedup",
"inspect_project_step", "interval_rank", "median_interval", "min_pairs", "paired_speedups",
"paired_statistics", "profile_evidence", "project_steps", "relative_mad", "validate_mechanism",
"CONFIDENCE",
"DIRECTIONS",
"METHOD",
"MIN_PAIRS",
"ServiceStageDecision",
"aggregate_service_measurements",
"assess_ordinary",
"assess_project",
"assess_service_performance",
"check_service_quality_reference",
"explain",
"gate_speedup",
"inspect_project_step",
"interval_rank",
"median_interval",
"min_pairs",
"paired_speedups",
"paired_statistics",
"prefer_service_measurements",
"profile_evidence",
"project_steps",
"relative_mad",
"service_assessment",
"service_choice",
"service_measurement_decision",
"service_metric_change",
"service_precheck_passed",
"service_profile_eligible",
"service_quality_decision",
"service_quality_passed",
"service_quality_score",
"service_ready",
"service_reference_snapshot",
"service_references_reason",
"service_settlement_reason",
"validate_mechanism",
]


Expand Down
Loading
Loading