sdk client and an authenticated MKA1 CLI.
What the example does
- Generates 128 invoice prompts for training and eight separate prompts for evaluation.
- Loads a pinned revision of Qwen2.5-0.5B-Instruct from the public Hugging Face Hub.
- Scores JSON validity, currency, and the extracted total.
- Runs 20 GRPO steps with LoRA adapters on one GPU.
- Publishes intermediate checkpoints, merged weights, tokenizer files, and before/after evaluation results to MKA1 repositories.
Step 1 - Prepare the complete training image
Save the following two files together, or use the files in examples/compute/rl. The training script includes dataset generation, the reward function, training, evaluation, and checkpoint publishing; no additional entry script or reward plugin is required.Dockerfile
Dockerfile
Dockerfile
Complete training script
Complete training script
train.py
Build image
Step 2 - Create the output repository
Use a new output repository so that the run does not overwrite your base model. The response includes your organization slug; substitute it for<org-from-create> in the job request.
Step 3 - Store the artifact credential
Create a Compute secret containing your MKA1 API key underARTIFACT_TOKEN.
Replace the credential placeholder before running this step, and use the returned secret ID in Step 5.
The image and job command contain no credentials.
Step 4 - Quote the GPU job
Replace<your-pushed-image> with the image you built.
A quote does not reserve capacity. If available is false, choose another catalog configuration before proceeding.
Step 5 - Start training
Replace the image, output repository, and secret ID with the values from the earlier steps. SetMKA1_REQUEST_ID to a unique value for this experiment. Reuse it only when retrying the identical request.
ARTIFACT_TOKEN is resolved from the stored secret at launch.
OUTPUT_MODEL_REPO and ARTIFACT_ENDPOINT are read by the provided script.
The script verifies repository access before downloading the base model or starting training.
Step 6 - Monitor and inspect the result
Use the job status, logs, and events examples with the returned job ID. Training metrics appear in user logs. The script emitscheckpoint_published and model_published messages after successful uploads.
A failed upload makes the workload fail instead of reporting success with missing weights.
Download the output using the repository artifact tools:
Download results
Compare the same held-out prompts before and after training.
Higher training reward alone does not establish better extraction; inspect errors and the exact-match score.
Twenty steps and eight validation prompts are a workflow check, not a benchmark.
Step 7 - Serve or continue experimenting
Follow Deploy a model server with your output repository as the model identifier. The output already contains merged weights, so no separate LoRA merge is needed. Creating a training job does not automatically deploy the model or register it for the Responses API. Terminate any serving service when finished. Keep output artifacts until you have inspected them. To train on your own task, replacerecords() and score() while keeping a separate evaluation set and the checkpoint export path.
The provided script starts a new run; it does not implement automatic resume.
Validation boundary
- TypeScript and C# snippets are compiled against the pinned SDK releases.
- SDK requests are checked offline for their URL, headers, and serialized body.
- The workload’s local test uses a tiny random model and a local artifact client; it exercises execution and does not measure learning quality or provider compatibility.
- A real GPU training run, image pull, and MKA1 artifact upload still need an end-to-end pilot.
See also
- Manage resources - inspect capacity, workloads, secrets, and volumes.
- Run a fine-tune job
- Deploy a model server
- Manage repositories
- API reference