When goals conflict, this order wins
Security and experiment correctness beat throughput. A job pauses when evidence or authorization is uncertain, and the UI says so.
| Priority | Outcome | How the design gets it |
|---|---|---|
| 1 Scientific validity | A real update and a fair comparison | Frozen manifests, supported trainer, separate evaluator, immutable reports |
| 2 Data isolation | Everyone sees only what they may | Per-request grants, row security, separate test storage, scoped roles |
| 3 Financial control | A failed job cannot keep spending | Reservations, one compute slot, reconciliation, outside watchdog |
| 4 Work preservation | A crash never erases accepted work | Transactions, immutable submissions, append-only decisions, backups |
| 5 Recovery | Operators can stop, explain and hand over | Durable attempts, state machines, incident records, restore drills |
| 6 Small-team delivery | Ships without a distributed platform | Modular monolith, managed services, one ML recipe, manual low-volume work |
Supported first release
Ten engineering principles, and the check for each
| Principle | The rule here | How a reviewer checks it |
|---|---|---|
| High cohesion | A task module owns revisions, a run module owns approval | A review rule change touches no cloud adapters |
| Dependency inversion | Use cases depend on narrow contracts | Domain code imports no FastAPI, SQLAlchemy or boto3 |
| Single ownership | One module writes each piece of state | No payment write hidden in a task route |
| Composition | Recipe joins model, tools, scorer, trainer | No inheritance tree for future environments |
| Explicit state | Commands state revision, actor, transition | Invalid moves fail before any side effect |
| Immutable evidence | Revisions, manifests, scores, reports are versioned | Corrections link a new record |
| Least privilege | Roles get only needed rows, objects, keys | Tests use production-style roles |
| At-least-once | Consumers tolerate duplicates and unknowns | Fault tests show one business effect |
| Simplicity | One database and recipe until measured need | No generic framework built ahead of demand |
| Observability | Commands trace to work, cost, result | Correlation IDs link API through report |
Business rules live in a pure core with no framework or cloud calls, and a thin outer layer does the input and output. Use SOLID only where it improves these boundaries. Events give durable notification, and PostgreSQL stays the record, so no event sourcing or CQRS is needed.
Each view answers one question at one zoom level
Boxes stay at one level per diagram. A person, a Python class and a server replica never share a picture.
New to these words? Plain-English meanings
| Word | What it means here |
|---|---|
| Rollout | One complete attempt by the model at one task. |
| Checkpoint | A saved copy of the model's weights at one moment. |
| Adapter | A small trainable add-on. The base model stays frozen underneath it. |
| Baseline | The saved score of the starting model, taken before any training. |
| Sealed test | Tasks that training can never read, kept for the final comparison. |
| Verifier | Protected code that scores an attempt. The model cannot see or reach it. |
| Unscorable | The infrastructure failed, so there is no score at all. This is different from scoring zero. |
| Tenant | One customer. Their data must never reach another customer. |
| Idempotent | Sending the same request twice has the same effect as sending it once. |
| Outbox | A to-do note saved with the data it describes, so a crash cannot lose it. |
| Lease | A time-limited right to act that must keep being renewed. |
| Fence | A number that rises with each attempt, so writes from an old worker get rejected. |
| Reconcile | Ask the cloud provider what really happened before acting on a guess. |
| Digest | A fingerprint of a file. If one byte changes, the digest changes. |
| Manifest | A signed-off list of the exact files and versions a step used. |
| Quarantine | Block something from new use while keeping its history intact. |
| RLS | Row-level security: the database itself filters rows by tenant. |
Who touches the system
Applications that manage people, work and approvals
| Container | Owns | Does not own |
|---|---|---|
| Web | Forms, role queues, bounded cache, saved-state feedback | Database writes, authorization, training |
| Control API | Sessions, briefs, revisions, approvals, reservations, grants | Long GPU work, a second copy of verifier logic |
| Control worker | Outbox, dispatch, reconciliation, scans, exports | Silent edits to frozen experiments |
| PostgreSQL | Transactions, constraints, evidence metadata | Multi-gigabyte weights, open analytics |
| SQS | Durable hints that work exists | Run status, exactly-once GPU work, task bodies |
| Private S3 | Pinned objects, encrypted assets, weights | Permission decisions based on a filename |
The watchdog needs its own failure path and permission to stop compute, even when the dispatcher is stuck.
Applications that sample, act, score and update
A task failure
A valid outcome that can score zero.
An environment failure
An unscorable rollout with no reward.
The trainer uses the supported TRL and OpenEnv integration, with no new optimizer. Model-generated text never becomes a shell command or SQL query. See the score contract.
Benchmark, train, benchmark again, with a wall between
One checkpoint goes to both sides. Only the frozen candidate crosses the wall.
The baseline is a gate
People help, the optimizer trains
One side per project
Who reads and writes each class of data
One managed PostgreSQL with logical schemas per owner. These are ownership boundaries, not separate servers.
| Data | Reads | Writes | Extra rule |
|---|---|---|---|
| Contributor profile | Contributor, authorized ops | Identity and ops | Customers see no workforce data |
| Draft and submitted task | Author, reviewer, project staff | Task operations | Submitted is immutable, judgment is separate |
| Training release | ML operator, training workload | Release publisher | Rights checked at use time |
| Final-test release | Evaluation owner and workload | Release publisher | Trainer cannot list, read, decrypt or request |
| Hidden expected results | Verifier, controlled review | Task-quality flow | No model tools, logs or public links |
| Weights and trajectories | Authorized ML and evaluation | Scoped attempt prefix | Confidential, no outside telemetry |
| Customer delivery | Customer, delivery operators | Delivery module | Short-lived, pinned, revocation recorded |
| Sealed baseline results | Evaluation owner, benchmark experts | Evaluation runner | Hidden from the training side until the candidate freezes |
| Development baseline | ML operator, training experts | Evaluation runner | Used to choose what to train next |
| Attempt reviews | Training side, evaluation owner | Assigned reviewer | Training split only, stored scores never change |
The customer pilot on AWS
The internal demo can run locally with temporary GPU compute. This is the hardened version.
The network allowlist
| From | To | Why |
|---|---|---|
| Public browser | Public ALB, 443 | User HTTPS only |
| Public ALB | Web and API tasks | Routed requests and health checks |
| API tasks | RDS, 5432 with TLS | Authorized transactions |
| Control worker | RDS, private AWS endpoints | Outbox, jobs, scoped artifacts |
| Trainer or evaluator | Internal broker, approved endpoints | Scoped episodes, input reads, own writes |
| Broker | Environment and verifier | Typed operations, protected scoring |
| Environment role | Restricted runtime schema | Episode state and receipts only |
| Verifier role | Frozen state, judgment objects | Scoring only, read-only |
| Migration role | Database via deployment path | Reviewed schema changes only |
Service TLS does not grant project access, so validate the attempt token and purpose per request. Do not mix customer data on reused GPU hosts: drain, terminate and verify scratch deletion before another tenant. This AWS design is the proposed backend. The published guide stays on Vercel and provisions nothing.
Taking a lab's checkpoint without taking its weights
Built after the open-weight proof and the first delivery. A lab should not have to send unreleased weights to a new vendor.
Crosses to the lab
Crosses back
Never crosses
What the contract must settle first
| Question | Default to propose |
|---|---|
| Who may start training? | Named operators of ours, within a lab-approved budget |
| Who sees weights? | Lab staff, and our workload role only while a run holds a lease |
| Where are rewards computed? | In the verifier, inside the lab's account |
| How are code updates reviewed? | Signed bundle, lab review, new rehearsal |
| What telemetry can leave? | Job state, digests and agreed metrics only |
| Who can review attempts? | Named experts, using lab-approved tools |
| How are incidents handled? | Shared contacts, and the lab can revoke first |
| Who owns the outputs? | Checkpoints stay with the lab, tasks by contract |
The first supported lab cloud is AWS. Another cloud needs a new provider adapter and its own rehearsal. If the lab runs the optimizer itself, call it environment delivery, not our managed run.
One bad source can be traced to every result it touched
A release pins exact revisions, digests, verifier version and split grouping. Rights can expire later without changing the frozen record, because eligibility is a separate record checked at use. One ZIP holding every asset is not a safe training bundle, so the exporter emits a separate manifest per purpose.
Ten moments where work must not be lost or doubled
| Flow | Durable boundary | On failure | Contract |
|---|---|---|---|
| Reviewer accepts | Revision, decision, payable, audit, outbox | Stale draft conflicts, replay returns the receipt | Task |
| Dataset publishes | Immutable release and group splits | One defect blocks publication | Release |
| Baseline recorded | Frozen protocol, evidence manifest | A failed run leaves no baseline, so approval stays blocked | Baseline |
| Run approved | Digest, baseline, approval, reservation, queue | Concurrent approvals cannot double-reserve | Approval |
| Job submitted | Intent before the call, result after | Unknown goes to reconcile, never blind resubmit | Dispatch |
| Model acts | State, journal, receipt together | Replay returns the result, never a second write | Episode |
| Candidate saved | Shard manifest plus clean load | Partial or stale output is never promoted | Checkpoint |
| Attempt reviewed | Sealed decision, finding, payable | Replay returns the receipt, and the score stays unchanged | Attempt review |
| Lab lane registered | Rehearsal report, attestation, role reference | A revoked role stops work and blocks new jobs | Lab lane |
| Comparison delivered | Protocol, report, manifest, fresh grant | Missingness and regressions stay visible | Evaluation |
Consistency
Strong
Eventual, and shown as pending
Reads use the primary database, so nothing shows stale data from a replica. A button drawn from an old browser cache grants nothing, because the API rechecks every command.
Sizing method
A test boundary, not market sizing. Estimate episodes as active runs × groups × generations per group, capped at eight sessions. Profile reset, action, score and cleanup at p50 and p95. A slow verifier idles an expensive GPU, so measure useful scored rollouts per GPU hour, not just tokens. Token arrays and checkpoint shards can dominate storage, so set cleanup policy before a large run. More GPU concurrency needs fairness, reservations, isolation and a revised cap.
Each failure stays in its own box
| If this fails | Containment | Recovery evidence |
|---|---|---|
| Browser or web | Draft writes commit on their own | Resume a draft, keep conflicts |
| API replica | Stateless, durable sessions, idempotency | Repeat a request after termination |
| Worker or queue | Outbox, leases, safe consumers | Crash between send and ack, one effect |
| Environment | Action journal and deterministic replay | Same digest, or invalidate the episode |
| Verifier | Own process, version and permissions | Quarantine without rewriting scores |
| GPU or trainer | Bounded job, heartbeats, checkpoints | Real interruption resumes supported state |
| Database | Failover, backups, no local-only data | Restore, replay deletions, reconcile jobs |
| Cloud submit | Dispatch token and fenced start claim | Two jobs cannot both get write authority |
| Link to a lab's account | Leases expire, local watchdog stops work | Stop drill with the link cut, then reconcile |
Platform owns
ML owns
Environment owns
Operations owns
The watchdog stops jobs without the trainer's cooperation, with deadlines for both queue wait and startup. Termination is best effort, so reserve overhead and reconcile afterward.
Proving the two hardest boundaries
Experiment validity. Freeze group splits, models, templates, generation budgets, tools, scoring, missingness and analysis. Choose checkpoints on development data, and keep the final test sealed until the candidate and protocol freeze.
Security. Managed identity, per-request grants, strict input validation, role-specific storage and decryption, protected labels and reviewed images. Treat task text, uploads and generated text as untrusted.
Release evidence covers allowed and denied flows, real GPU updates, clean-process loading, budget-stop drills, ambiguous dispatch, cancellation races, checkpoint corruption, restore, deletion replay and customer delivery.
Sixteen decisions, and what would reopen each
| ID | Decision | Why | Reconsider when |
|---|---|---|---|
| 01 | Modular monolith, separate worker and execution | One source of rules, separate permissions | Teams or measured scale demand a split |
| 02 | PostgreSQL for transactions and small runtime state | Atomic claims, budgets, action receipts | Runtime writes hurt control latency |
| 03 | Outbox plus SQS, no event sourcing | Reliable without a replay platform | Long workflows outgrow recorded jobs |
| 04 | Separate broker, environment, verifier permissions | Model-side execution cannot reach judgment | Never just to save a container |
| 05 | TRL GRPO, OpenEnv, one adapter recipe | Reuse support, limit compatibility work | A buyer or experiment supports another |
| 06 | One GPU lane, one attempt at a time | Controls cost, staleness and isolation | Paid demand justifies a tested scheduler |
| 07 | Immutable content, separate eligibility | Keeps history, blocks revoked use | Keep at any scale |
| 08 | Same-origin web and API, server sessions | Simple, no browser-held tokens | A public client or SSO needs review |
| 09 | S3 manifests, version IDs, checksums | Reproducible artifacts outside SQL | Volume needs a catalog, integrity stays |
| 10 | One region, two zones | Recovery without multi-region work | Residency or measured reliability |
| 11 | Manual payment and expert allocation | Correct accounting before automation | Reconciliation repeatedly delays projects |
| 12 | No automatic efficacy claim | Finishing and improving are different | Keep for every release and raise |
| 13 | Saved baseline required before approval | No improvement claim without a before | Keep for every engagement |
| 14 | One expert side per person per project | Stops the test leaking through people | Keep at any scale |
| 15 | Human review between runs, not per rollout | Keeps training synchronous and affordable | A tested human-reward recipe justifies more |
| 16 | Lab execution in the lab's account | Labs keep weights, we keep the workflow | A lab explicitly authorizes our infrastructure |
Changing one takes a short record with the problem, measured evidence, alternatives, migration, security and experiment impact, and tests. Do not add a technology because a larger lab uses it at another scale.
Build gates
- G0 ScopeBrief, rights, capability, region, terms, budget
- G1 CompatibilityReal run, tokens, update, reload, GPU measured
- G2 FoundationReal roles, denied tests, CI, restore
- G3 ProductionAccepted batch, pay record, saved baseline
- G4 ExecutionApproval to recovery under injected faults
- G5 EvidenceFair test, audit, cost, clean load, delivery
- G6 Lab readyRehearsal, no-egress, revocation, lab review