- Serve at FP4 speed and cost: An adapter served on top of its base model adds work to every request. A merged model has the adapter’s changes built into its weights, so it serves like the FP4 base model, on the same hardware.
- Keep the adapter’s quality: Merging an adapter straight into FP4 weights would apply its changes to weights that already carry quantization error. The job merges into the full-precision (BF16) weights first, then calibrates and quantizes the merged model to FP4, so the adapter’s changes survive quantization. MiniMax-M3.1-Flash already ships in the format it serves in, so its job only merges.
Supported models
The adapter must be a LoRA adapter from a post-training session, not a full-weight model. Its base model must also support FP4 preparation. Supported models lists which base models do, how long each job typically takes, and which base model serves the prepared model. Together sets the merge and quantization parameters for each model, and you can’t change them.Find the adapter ID
A job takes the adapter’s model registry ID (ml_...) and, optionally, a revision ID (rv_...). If you omit the revision, the job uses the adapter’s latest revision. Read both from registration.adapter on the session’s inference checkpoint, or from inference_registration.adapter after the session ends.
Only a checkpoint that registers an adapter can be prepared. A checkpoint that registers a merged model deploys directly.
In an API request, pass the ID as model_object_id and the revision as model_revision_id. The older names, adapter_object_id and adapter_revision_id, still work but are deprecated. Use one pair, not both. A request that mixes the two pairs fails with a 400 error, even when the values match.
Estimate the job
To check a job’s price and running time without creating anything, estimate it with the adapter ID:allowed_to_proceed is False.
A successful estimate also confirms that the adapter is eligible, because estimating and creating a job accept the same adapters.
How a job is billed
Each job runs on one B200 GPU. The charge is applied when the job ends, and it’s based on how long the job actually ran, not on the estimate:- Billed time: Billing covers the time from when the job enters
runninguntil it ends, rounded up to the next whole minute. Time inpendingorqueuedisn’t billed. - Failed jobs: A job that ends in
errororuser_errorisn’t billed. - Cancelled jobs: A job you cancel is billed only if it had reached
running.
Calibrate on your own data
By default, the job calibrates the merged model on a general text corpus. To calibrate on data that matches your workload, pass a conversation dataset with--calibration-file (-c). The job then fills half of the calibration corpus with your dataset and the other half with general text. A job on a base model that skips calibration, such as MiniMax-M3.1-Flash, ignores the file.
The calibration file must:
- Be a JSONL file of conversations. Each row has
messagesand, optionally,tools, in the same chat format as SFT data. - Be at most 64 MiB.
- Contain at least 598,016 tokens once the model’s chat template is applied, enough to fill its half of the calibration corpus.
- Belong to the same project as the adapter.
estimate as well. The estimate confirms that the file exists and passed validation. It doesn’t count tokens, so a file below the token minimum passes the estimate but fails the job with a user_error. Add more conversations and retry.
Start the job
Create the job with the same adapter ID:
In the CLI,
create shows the estimate and asks you to confirm before it creates the job. estimate takes the same adapter ID, --model-revision-id, and --calibration-file. For every flag, see the tg training reference.
The new job has an ID in the form shp-quant-... and starts in pending. Save the ID to monitor or cancel the job.
Each request starts a new job, even for an adapter you’ve already prepared. A repeat job uploads its result to the same model as the earlier job, so reuse that model instead of starting another.
Monitor the job
A job moves frompending to queued to running to completed. Watch it until it reaches a terminal status:
--watch prints each status change and new event until the job reaches a terminal status. The command exits with a non-zero code if the job failed. Stopping the command doesn’t stop the job, so run it again to resume watching.
When the job reports
completed, the prepared model is already validated for deployment. The CLI prints the model’s ID (ml_...) and revision ID (rv_...). In Python, read them from job.results.api_model_object_id and job.results.api_model_revision_id.
A job’s params describe the adapter it prepares, not the prepared model. params.inputs and params.configuration both name the adapter under the model_* names and the deprecated adapter_* names, with the same values. params.configuration.model_revision_id is the revision the job prepares, which is the adapter’s latest when the request didn’t name one.
--watch prints the job’s events as they arrive. To read a job’s events later, such as the reason it failed, list them:
SHAPING_USER_ERROR event or a SHAPING_ERROR event. A SHAPING_USER_ERROR event’s message says how to fix the input.
To list every FP4 preparation job in your project, run tg training fp4 list or call client.post_training.prepare_for_fp4_inference.list().
Deploy the prepared model
The prepared model is a private model in your project. It’s registered against the base model that serves it in FP4, which can differ from the base model the adapter records. Supported models names it for each model. List its deployment profiles, then deploy it by itsmodel_object_id:
CLI
The
deploy command creates the endpoint, attaches a deployment, and routes all traffic to it.
Cancel a job
To stop a job before it completes, cancel it:--force (-y) to skip the prompt. The job moves to cancel_requested right away and reaches cancelled once the run stops, so watch it to confirm. The CLI won’t cancel a job that’s already in cancel_requested. A job in a terminal status can’t be cancelled, and the CLI prints that the job isn’t cancellable.
Troubleshooting
- “Preparing an adapter on base model … is not supported”: The adapter’s base model isn’t one of the supported models.
- “model … is not an adapter” or “does not record a fine-tuning relation”: Pass the adapter’s ID (
registration.adapter.id, orinference_registration.adapter.idfrom the checkpoints API), not a merged model’s ID. Full-weight models aren’t accepted. - “model … does not exist in this project”: The adapter belongs to a different project. Use an API key scoped to the project that trained the adapter.
- “Calibration file … not found”: The file ID is wrong, or the file belongs to another project. Upload the file in the adapter’s project.
- The estimate warns that the price exceeds your credit, or create fails with a
402error: Your credit balance can’t cover the estimated price. Add credits and retry. - Create fails with a
403error: Your project is blocked from starting jobs. Contact support. - “Shaping job … not found”: The job doesn’t exist, or it belongs to another project.
- Job ends in
user_error: List the job’s events. TheSHAPING_USER_ERRORevent’s message describes the problem with the input.
Next steps
Manage checkpoints
Save inference checkpoints from a post-training session.
Multi-LoRA deployment
Compare candidate adapters before you prepare the winner.
Choose a deployment profile
Pick the hardware and quantization a deployment runs on.
Manage deployments
Scale, stop, and delete endpoints and deployments.