Artifacts
Every training run saves a versioned .grad artifact with your trained
weights and evaluation results.
An Artifact is a saved, versioned model (fast-diff-merge@2026-11-26-1). A training run produces one, and so does uploading or importing weights you trained elsewhere. Artifacts are never overwritten: every new run or upload writes a new version. Each one is a .grad.tar.gz bundle holding the weights, the config needed to serve them, a manifest.json (base model repo and revision, recipe, checksums of every file) and, for a trained artifact, the held-out eval_report.json.
Every artifact records where it came from in provenance: source is run (with the run_id), upload (with the uploader, the API key that uploaded it) or import (with the uri, hf://owner/name@<commit>).
What's inside#
The bundle's format depends on the recipe:
format | Recipes | Files |
|---|---|---|
peft_lora | SFT, DPO, distillation | adapter_config.json, adapter_model.safetensors: a standard PEFT LoRA for the base model |
merged_safetensors | SFT or distillation with merge_on_export=True | A standalone Hugging Face model (config.json, Safetensors weights, tokenizer) |
cartridge | Cartridge | cartridge.safetensors: the trained KV prefix |
encoder_safetensors | Embedding | The full fine-tuned encoder directory with grad_embedding.json and Sentence Transformers files |
router_bundle | Router | The backbone adapter, router_head.safetensors and router_config.json (candidates, prices) |
decision_bundle | Decision model | The backbone adapter, decision_head.safetensors and decision_config.json (questions, heads) |
reward_bundle | Reward model | The backbone adapter, reward_head.safetensors and reward_config.json |
The artifact format spec documents every file, tensor and config field, with a reference Python loader for each format, so your serving stack never needs the trainer's code.
Inspect and test an artifact#
Load any saved artifact with client.artifacts.get(...) (or use run.artifact straight from a finished run) and check its held-out eval_report before you ship it. To compare it with other models on your own examples, pass it to an evaluation:
from grad import Grad
client = Grad()
art = client.artifacts.get("fast-diff-merge@2026-11-26-1")
print(art.base_model, art.recipe_kind)
print(art.eval_report)
You can pass an Artifact (trained, uploaded or imported) in place of a model name:
- Continue training:
DPORecipe(model=sft.artifact, ...)orSFTRecipe(model=sft.artifact, ...)(from SFT and DPO LoRA artifacts). - Evaluate it:
client.evals.create(models=[art, "qwen/qwen3-8b"], dataset=..., rubric=...). The eval calls the artifact by its ID on your inference endpoint, so load it there first (for example as a vLLM LoRA module named after the artifact).
Which checkpoint becomes the artifact#
Managed runs save checkpoints automatically as they train and evaluate each one on the held-out split. run.artifact is the checkpoint with the best held-out score (the lowest loss, for recipes that select on a loss), or the last one with select="last". To pick a different one yourself, list the checkpoints and promote it:
from grad import Grad
client = Grad()
run = client.runs.get("run_01J9Z2")
for ckpt in run.checkpoints():
print(ckpt.step, ckpt.eval_score, ckpt.expires_at)
art = run.checkpoints()[-1].promote(name="fast-diff-merge") # save a checkpoint as a versioned Artifact
The best and final checkpoints never expire; other checkpoints are kept for 30 days unless you promote them. Each checkpoint remembers the settings it was trained with (base model, chat template, learning rate), so evaluations and exports reuse them automatically. If a run stops early, continue it from its latest checkpoint with client.runs.resume("run_01J9Z2"). Checkpoint frequency, retention and selection settings are in the reference.
Upload or import an artifact#
Bring weights you trained elsewhere into grad as an artifact: upload a local directory, or import a Hugging Face repo. Name the catalog base model they were trained on with --base (base=). grad checks the files against the artifact format spec and the base model's config.json. For a PEFT LoRA, that means adapter_config.json, its base_model_name_or_path and pinned revision, target modules that exist in the base model, and every tensor's shape. The result is a normal artifact, my-lora@2026-11-27-1, that you can download, evaluate or continue training from (SFT and DPO, as with a trained LoRA):
grad artifacts upload ./my-lora --base qwen/qwen3-8b
grad artifacts import hf://acme/support-lora@main --base qwen/qwen3-8b
grad artifacts inspect my-lora@latest
- What you can upload: a directory (grad tars it), a single file such as
cartridge.safetensors, or a.tar.gz. Pick the format with--format(format=); the default ispeft_lora, and every format in the table above is accepted. Files the format doesn't use, such as a README, are left out of the bundle. Pickle weights (adapter_model.bin,.pt,.pth,.ckpt) are refused: save them withsafe_serialization=True. Uploads are capped at 5 GB, and a tar at 1,024 entries and 10 GiB uncompressed; links, special files and unsafe paths are refused. Each file must sit where the format expects it: a nested copy such assub/model.safetensorsis dropped, a router, decision or reward bundle'shead_filemust be the format's own head file, and JSON configs are at most 16 MiB. - Names:
--name(name=) sets the artifact name. It defaults to the directory or file name, or to the repo name for an import. - Hugging Face imports: a repo on the Hugging Face Hub, at a branch, tag or commit (
hf://owner/name@revision, defaultmain; letters, digits and. _ / -, no..). The artifact pins the commit the revision pointed to. An import takes at most 1,024 of the format's files and one hour. For a gated or private repo, store an HF token as a workspace secret and pass--secret NAME(secret=). - When a check fails, the upload fails with a
422invalid_artifacterror that names the file and the problem, for exampleadapter_config.json: base_model_name_or_path is 'Qwen/Qwen3-4B', expected 'Qwen/Qwen3-8B' (the base qwen/qwen3-8b). The CLI exits with code 5. Python raisesgrad.ArtifactImportFailedError; the other SDKs raise their equivalent.
An uploaded artifact has no held-out eval_report, because grad didn't train it. Evaluate it with an evaluation instead.
Delete an artifact#
grad artifacts delete NAME@VERSION (client.artifacts.delete(...), or art.delete()) deletes an artifact and its bundle. On Gradiated Cloud, publishing an artifact as a model version pins it, so grad never deletes a published artifact: deleting one fails with 409 artifact_pinned, naming the model versions that use it. Unpublish them first.
Every Artifact lists what pins it in pins (holder, reason, created_at; [] when nothing does), in all four SDKs. The web UI's Artifacts page (grad ui) lists every artifact as name@version with its format, base model, provenance, size and pins, and downloads or deletes one.
Download and serve#
Download an artifact to serve it on your own vLLM or SGLang servers. grad artifacts download checks the bundle's SHA-256 and every file against the manifest before it extracts anything:
grad artifacts inspect fast-diff-merge@2026-11-26-1 --json
grad artifacts download fast-diff-merge@2026-11-26-1 --output ./fast-diff-merge
# Load the LoRA into vLLM on the same base model (the default rank is 32)
vllm serve Qwen/Qwen3-8B --enable-lora --max-lora-rank 32 \
--lora-modules fast-diff-merge=./fast-diff-merge
Add --archive ./fast-diff-merge.grad.tar.gz to keep the verified bundle as well. See Deploying for SGLang, router and decision bundles, and rollouts on your own stack.