> ## Documentation Index
> Fetch the complete documentation index at: https://docs.physionlabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Checkpoints

> Download, verify, serve and evaluate a trained model, or upload weights to train from.

## Download

The checkpoint is separate from training: it uploads after the job succeeds and stays for 30 days, so download it
when the weights are needed, not as part of every experiment.

```python theme={null}
client.jobs.wait_checkpoint(job_id)          # returns at once if it is already uploaded
info = client.jobs.checkpoint(job_id)        # step, bytes, expires (unix time), files with 24-hour links
client.jobs.download_checkpoint(job_id, f"checkpoints/{job_id}")
```

* Check free disk space against `info.bytes` first: 9 GB for `qwen3.5-4b`, 15-19 GB for the 7-9B models, about
  55 GB for a \~30B model and 72 GB for the 35B-A3B ones, about 250 GB for 120B, 600 GB and more for the largest.
* Every downloaded file's sha256 is checked against the checkpoint's list; a mismatch removes the file and raises.
* Files already complete are skipped and a partial file is resumed: if the download stops, run it again.
* `include=["*.json", "*.jinja", "tokenizer*"]` (CLI `--include`, repeatable) downloads only matching files, e.g. the
  config and tokenizer without the weights. No matching file is an error, not an empty download.
* Kept **30 days** after training; afterwards `checkpoint` raises 410. Links last 24 hours; call again for new ones.
* 409 means it is still uploading (`job.checkpoint["status"] == "uploading"`); wait.

## What it is

A Hugging Face model directory in bf16: `config.json`, `generation_config.json`, `model-*.safetensors` with
`model.safetensors.index.json`, the tokenizer files and `chat_template.jinja`. It loads wherever the base model loads,
with the same versions.

`qwen4-35b-a3b`'s is in the layout of Qwen's release (its `qwen4_moe` config, tokenizer code and `tiktoken.model`), so
it loads with the code that loads `Qwen/Qwen4-35B-A3B`. The release's `tokenizer-compat/` directory is not in it: copy
it from the base model if you need those files.

A LoRA job's checkpoint is the adapters alone by default on `qwen3.5-4b`, `qwen3.8-27b`, `muse-glimmer-30b`, `qwen3.6-35b-a3b`, `gemma-4-26b-a4b` and
`kimi-k3.1-pro`: peft's layout (`adapter_model.safetensors` and `adapter_config.json`, beside the tokenizer files), a
small fraction of the full model (`qwen3.5-4b` at rank 32: 150 MB). Load it on the base model with peft, or merge it
yourself. Set `lora_save: "merged"` to get the full model instead. On the other models a
LoRA checkpoint is the merged model unless `lora_save: "adapter"`. Inference runs and `from_job` work with either.

## Serve and evaluate

vLLM (needs GPUs that hold the model; a version that supports the base model):

```bash theme={null}
vllm serve checkpoints/job_... --served-model-name ft --max-model-len 32768 --tensor-parallel-size 1
```

```python theme={null}
from openai import OpenAI
llm = OpenAI(base_url="http://localhost:8000/v1", api_key="none")
reply = llm.chat.completions.create(
    model="ft", messages=[{"role": "user", "content": "..."}], temperature=0,
    extra_body={"chat_template_kwargs": {"enable_thinking": False}},   # match training, see below
)
```

* **Thinking mode:** jobs train in non-thinking mode ([Data](https://docs.physionlabs.ai/nexcloud/guides/data.md)). For models with a thinking switch (Qwen), serve with
  `enable_thinking: False` unless the training data had `<think>` reasoning; otherwise the model is prompted
  differently from how it was trained.
* **Compare against the base model** on the same held-out prompts, served the same way: that is the effect of the
  fine-tune. Use prompts that were not in the training data. `examples/compare_outputs.py` in the SDK's repository
  ([https://github.com/Physion-Labs/nextron-python/blob/main/examples/compare\_outputs.py](https://github.com/Physion-Labs/nextron-python/blob/main/examples/compare_outputs.py), not in the installed package)
  does it: serve both models, then `python examples/compare_outputs.py data/val.jsonl --ft http://localhost:8000/v1 --base http://localhost:8001/v1` writes both answers next to the reference and prints exact-match rates.
* Use the task's own metric (exact match, a test suite, a rubric scored by a judge model) on a fixed evaluation set,
  and report the score with the job's name and id.
* SGLang (`python -m sglang.launch_server --model-path checkpoints/job_...`) and transformers
  (`AutoModelForCausalLM.from_pretrained`, or the base model's own class) work the same way.

No GPUs to serve it on: an inference run serves the job's model on NexCloud's GPUs for 7 days after training, if the
model lists `inference` in `client.models()[i].methods` ([Inference](https://docs.physionlabs.ai/nexcloud/guides/inference.md)). For a model without it, or
after the 7 days, say so to the owner; validation loss (`val_loss` in the job's metrics) is then the comparison
between runs.

## Upload a checkpoint to train from

Weights trained somewhere else, or downloaded from a job, can be where a job starts: upload the directory's
`.safetensors` files, then give the checkpoint's id as `from_job` ([Training (SFT and LoRA)](https://docs.physionlabs.ai/nexcloud/guides/training.md)).

```bash theme={null}
nextron-cloud checkpoints upload ./my-model --model qwen3.8-27b       # -> ckpt_...
nextron-cloud jobs create --model qwen3.8-27b --dataset ds_... --param from_job=ckpt_... --yes
```

```python theme={null}
checkpoint = client.checkpoints.upload("./my-model", model="qwen3.8-27b")
job = client.jobs.create(model="qwen3.8-27b", dataset_id=dataset.id, params={"from_job": checkpoint.id})
```

* The weights must be the model's own: every tensor of the base model, same name and shape, in float32 or bfloat16.
  A LoRA adapter, a quantized model or one with added tokens is refused, and the error names the tensors that
  differ. Merge an adapter into the base weights first.
* Only the weights are sent. Config, tokenizer and chat template stay the base model's.
* For the models that list `from_job` (`nextron-cloud models`), and opened organisation by organisation: a 403 means
  yours is not open yet.
* A checkpoint is kept 30 days after its upload, five at a time, at no charge: `nextron-cloud checkpoints list`,
  `checkpoints delete ckpt_...`.
* An inference run does not serve an uploaded checkpoint; it serves a job that trained from one.

## Verifying a checkpoint

`download_checkpoint` already checks each file against the checkpoint's sha256 list. Independently of the download
links, `jobs.manifest(job_id)` (once the checkpoint is uploaded) returns the job's manifest, JSON with `files` (record
files) and `checkpoint` (checkpoint files), each `{name: sha256}`; its own sha256 is `job.manifest_sha256`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.