Documentation Index
Fetch the complete documentation index at: https://docs.arkor.ai/llms.txt
Use this file to discover all available pages before exploring further.
Mid-run evaluation
The single biggest reason to fine-tune in TypeScript is that you can call into the partially trained model from your own code while the run is still going. The hook isonCheckpoint: each time the backend uploads a checkpoint, the SDK calls back into your function and hands you an infer bound to that exact checkpoint adapter.
This recipe wires it up against a fixed prompt so you can spot regressions long before the loss curve says anything is wrong.
The pattern
- A short generated sample written to stdout for every checkpoint, side by side with the loss numbers.
- Confirmation that inference itself works against the new adapter (so a silent serving-side regression is caught at training time).
- A natural place to add comparisons or assertions later.
Why this is hard to do anywhere else
infer is bound to the just-saved checkpoint ({ kind: "checkpoint", jobId, step }). You cannot reach an intermediate checkpoint from Studio’s Playground, and there is no separate CLI command for it; the only path today is from inside onCheckpoint. That is exactly why this recipe wants to run there, not after the fact.
The function returns the raw Response from the cloud API, so the streaming and decoding shape is up to you. The snippet above passes stream: false to keep the body a single JSON document; for true streaming, see SDK § infer.
Variations
Compare against the base model on the same prompt. Studio’s Playground already has a Base / Adapter mode toggle, but you can do the same thing fromonCheckpoint to score automatically rather than eyeballing it.
What to keep in mind
- Wrap in
try / catch. A throw out ofonCheckpointis caught by the SSE reconnect loop and may be retried (see SDK § Lifecycle callbacks). For deterministic behavior, handle the error inside the callback and decide what to do. - Inference costs a real call. The backend serves the request from the live training cluster. Keep
maxTokensmodest if you are hitting every checkpoint. inferis per-call, not memoized. Calling it twice in the sameonCheckpointmakes two backend requests. Compose your prompts together in one call when you can.