Skip to main content

Training

Turn reviewed calls into a better Guardian or model. Pick the goal, the kind of training, and the data. Trinitite keeps every version so you can compare or go back.

Status: Beta Companion docs: Guardian · Gate · The closed loop Source of truth: Training API. This guide shows the public SDK workflow.

Start with one safe shortcut

Use tr.distill(...) when you want reviewed violations to improve the Guardian for a scope:

job = tr.distill(scope="refund-flow")
job.wait(timeout=1800)

print(job.status)
print(job.version_id)

This is the short form of the unified training surface. It uses the Guardian track, the distill technique, and captured violations.

Four choices shape a run

The full call keeps those choices separate:

job = tr.train(
scope="refund-flow",
subject="guardian",
technique="distill",
data="captured_violations",
recipe={"learningRate": 2e-4, "loraRank": 32},
)
job.wait(timeout=1800)

Use subject="guardian" to train the policy enforcer. Use subject="model" to train a model that can later move to the inference service.

Let the data pick the technique

Set technique="auto" when you want Trinitite to choose from the data shape, hardware, and reward rules. Preview the choice before starting a job:

choice = tr.train.route(
examples=training_rows,
kwargs={"reward_rules": reward_rules},
hardware_vram_gb=40,
)

print(choice.technique)
print(choice.reason)

The registry includes these techniques:

TechniqueBest fit
distillTeach a Guardian or model from a stronger teacher
sftLearn from approved input and output examples
grpoLearn from verifiable rewards
orpoLearn from preferred and rejected answers with less memory
cptContinue learning from a body of text
dpoLearn from preference pairs
autoresearchSearch several recipes and keep the best run
safety_patchTrain a narrow change for one policy
auto_trainStart training from an approved finalization flow
autoChoose a technique from the run inputs

List the live registry instead of hard-coding it in your app:

for technique in tr.train.techniques:
print(technique.id, technique.required_kwargs)

Validate reward training first

A GRPO run has strict data and reward rules. Check them without starting training:

report = tr.train.validate.grpo(
examples=training_rows,
reward_spec=reward_rules,
run_config={"num_generations": 8},
)

if not report.valid:
raise ValueError(report.summary)

Keep every version addressable

A completed run creates a new version. It does not replace the active version in place.

Version vault

Every version stays addressable

Active: guardian-refund-v3

guardian-refund-v3

Serving production calls

guardian://refund/v3

tr.distill creates v4 beside v3. Promotion and rollback change the active pointer; they do not overwrite the vault.

Inspect, compare, and promote deliberately:

guardian = tr.guardian.get("guardian-refund")
vault = tr.train.versions(guardian.guardian_id)

for version in vault.history():
print(version.version_id, version.status)

comparison = vault.compare(version1=3, version2=4)

if comparison.body["recommendation"] == "promote_challenger":
vault.promote(
"v4",
candidate_run_id=comparison.body["candidate_run_id"],
baseline_run_id=comparison.body["baseline_run_id"],
)

If a release behaves badly, use the rollback ripcord:

vault.rollback("previous")

TypeScript parity

TypeScript uses promises and camel case where the package exposes the matching training handles:

const job = await tr.train.run("refund-flow", {
subject: "guardian",
technique: "distill",
data: "captured_violations",
recipe: { learningRate: 2e-4, loraRank: 32 },
});

await job.wait({ timeout: 1800 });

Check Language compatibility before sharing advanced training code across both packages. The Python SDK is the complete surface for technique routing and validation in version 0.0.3.

Where to go next

  • Gate proves the candidate still clears your release rules.
  • Guardian covers version pinning, promotion, and rollback.
  • Models and routing moves a trained model into served inference.