Skip to main content

SFT quickstart

Training methods, model defaults and framework implementations come from immutable Recipe and Runner content. Check the authorized offerings, frozen references and request_schema returned by GET /v1/training-models or client.training_jobs.models() before using a model example on this page. Examples require matching catalog content. Legacy requests must match exactly one offering; missing or ambiguous mappings are refused. Console remains read-only.

Train on a small text conversation, then inspect the result and save its checkpoint. Complete installation and authentication with a project Key that can submit and read training Jobs. Training uses resources; inspect model availability before submitting.

Before you start​

  • Install the CLI/Python SDK and save your project connection; run el auth status --check.
  • Use a project automation Key with training, Job-read and checkpoint-download permissions. Add separate serving or temporary-resource permissions only for workflows that need them. A read-only or inference-only Key cannot submit training.
  • Check project Limits while signed in to the Console; API Keys do not grant human-session management access. Check model availability and your time/budget limit before allocating resources.
  • Prepare a short, validated example and a fresh local output directory. Listing models allocates no training GPU. Model and recipe selection precede submission; EnvLoop chooses execution resources.

The small example below checks that the pipeline runs. To train a model that beats its base, follow the finance decision tutorial. Scheduling and model loading can take longer than training. Keep evaluation prompts separate before attempting a larger run.

Discover the training recipe​

For this HTTP request, provide your project Key as ENVLOOP_API_KEY using your shell’s secret input or secret manager; see Authentication. The response lists this project’s training recipes.

curl --fail-with-body --silent --show-error \
https://api.envloop.ai/v1/training-models \
-H "Authorization: Bearer $ENVLOOP_API_KEY"

Look for zai-org/GLM-5.3-Flash. Discovery lists the configured recipes and their limits. If it returns 503 or the model is absent, contact support before submitting; GPU capacity and admission are checked when the Job is submitted.

Prepare REQUEST.json​

Save this example as REQUEST.json. Use a new request_id for each new experiment. For a retry after a network error, keep the same file and ID to retrieve the existing Job. Changing the content under the same ID causes a conflict.

{
"request_id": "glm-sft-example-1",
"base_model": "zai-org/GLM-5.3-Flash",
"max_steps": 3,
"tags": {"experiment": "sft-example", "purpose": "baseline"},
"records": [{"messages": [
{"role": "user", "content": "What is 1 + 1?"},
{"role": "assistant", "content": "2"}
]}]
}

Submit and observe​

el job submit --type train --spec REQUEST.json

To cap the Job's GPU spend, add --max-cost-usd N. The cap must be at least the most one Trial can cost, limits.max_trial_cost_usd in the discovery response; a lower cap is refused at submission with BUDGET_BELOW_TRIAL_COST, and its message names the minimum. See Train Job budget.

Copy the returned job_id and replace JOB_ID below. The Job continues if you close the submitting client.

el job get JOB_ID
el trial list --type train --job-id JOB_ID --json
el job log JOB_ID --follow
el job result JOB_ID
el checkpoint list --job-id JOB_ID --json

Repeat job get until the Job reaches a terminal state. Inspect its result, recorded losses and checkpoint. job log --follow exits when log capture ends; Ctrl-C closes the reader while training continues. Stop an unwanted run with el job stop JOB_ID, then check its status and resource cleanup as shown in CLI Hello World.

Download the saved weights using Checkpoints. For multiple independent training configurations, see Training overview.

Workload limits​

The GLM offering uses the platform-frozen SFT recipe and revision eb9eb208eb0d988989d07a6a12d0fdeb5f52574a. It supports chat text and bounded inline images. It does not accept custom losses, RL, arbitrary optimizer/LoRA settings or optimizer-state resume. No public interactive compatibility route exists.

Python submission alternative​

Save the request above as REQUEST.json. Use either the CLI submission above or this Python alternative once for the same run:

import json
from pathlib import Path
from envloop import Client

request = json.loads(Path("REQUEST.json").read_text())
with Client.remote() as client:
job = client.training_jobs.submit(request)
Path("submission.json").write_text(json.dumps(job, indent=2))
print(job["job_id"])

Keep the exact request and returned IDs in your private run receipt. Reuse the original request ID only for an identical retry; create a new ID for a new experiment. The submitting process can exit while the Train Job continues.

What success looks like​

Confirm terminal success, actual completed steps and metrics in Monitoring. Keep REQUEST.json, submission.json, the returned checkpoint path and a verified download receipt in your run directory. Download after compute release and verify file sizes/SHA-256 on CPU; Checkpoints explains recovery and retention.

This example creates no inference endpoint. If a callable model is required, separately follow Train and deploy, including compatibility, permissions and resource requirements.

If the run fails​

FailureNext action
Missing client interfaceCheck the installed public envloop-cli release against the service; do not restore removed training_service factories
401 / 403Verify API origin, project selection, Key validity and training permissions
Model unavailable or budget rejectionRead model discovery, project limits; contact support when unavailable. For BUDGET_BELOW_TRIAL_COST, raise --max-cost-usd to at least the minimum in the message
Invalid records or recipe parametersValidate data and read model-specific bounds before another submission
Timeout after submissionQuery the recorded Job/request outcome; avoid a duplicate run while uncertain
Download unavailableInspect registration and durable publication, then retry the download without retraining
Cleanup incompleteInspect the original Job and cleanup Operation rather than assuming resource release

Move beyond one example​

Use Prepare training data for JSONL and images and Training recipe parameters for batches and Qwen options. GLM settings remain frozen; Qwen text-only parent weights start a new optimizer, not an exact resume. Keep completed steps, data version and held-out outputs with the receipt. Independent Trials and their lifecycle are described in Training.