SwapAI

How it works

The application, trainer and operator have separate responsibilities.

The lifecycle

  1. The application calls its trusted reference classifier and stores the complete example.
  2. SwapAI assigns that distinct input to one stable purpose: training, validation, representative test or coverage test.
  3. Result bins and declared facets reveal whether the dataset covers the decisions the product makes.
  4. An operator requests training after readiness has no deficits.
  5. A provider receives a versioned, hash-verified job bundle and returns a complete candidate artifact.
  6. SwapAI verifies the output hashes and evaluates the candidate against protected test data.
  7. The candidate remains inactive. New authoritative results are also evaluated by the candidate and persisted as shadow evidence.
  8. An operator promotes the exact training run. Only then can application traffic use it.

There is no hidden in-process training loop in the modern API. Collection is cheap and continuous; training is explicit, bounded and auditable.

Four data purposes

PurposeUsed to fit the modelVisible to the trainerUsed to approve release
TrainingYesYesNo
ValidationNoNoYes
Representative testNoNoYes
Coverage testNoNoYes

Validation, representative tests and coverage tests remain outside the provider bundle. SwapAI evaluates all three locally after verifying the returned artifact, so the trainer cannot tune itself against release evidence.

The same input string always receives the same stable assignment. Correcting its reference result can change its result bin, but cannot move it from training into a protected test or the reverse.

Candidate states

collecting → training → candidate (shadow) → promoted
                    ↘ failed             ↘ rejected

A passing protected test creates a candidate; it is not permission to switch production traffic. Promotion is a separate, named operation against one immutable training-run ID.

Failure behavior

  • Missing coverage returns concrete deficits before a provider starts.
  • A provider failure leaves the reference classifier authoritative.
  • A hash mismatch rejects the runner output.
  • A process crash leaves a durable run and provider ID for reconciliation.
  • Runpod cleanup targets the recorded pod ID and verifies deletion.
  • Failed cleanup remains visible and retryable; it is never reported as success.
  • An unavailable promoted model falls back to the reference when one is configured.

Error calculation

For bounded numbers, error is the absolute difference divided by the declared range. For booleans and closed strings, a match is 0 and a mismatch is 1.

Average error is only one release signal. SwapAI also records protected error for each result bin and exposes the collected distribution for every declared facet. Operators must review both, so a good majority class cannot conceal a dangerous blind spot.