Skip to main content
POST
Start instruction optimization job
Optimize question instructions using uploaded datasets in the fine-tuning dataset format. Use an existing saved model, or a base model with a destination. The request returns 202 Accepted with a Location header to poll.
string
required
A key between 8 and 255 characters. Reuse it only when retrying this exact request.
string
required
A base model such as mo-latest, or a saved model such as acme/support-priority. Saved models require repository write access.
string
Required with a base model: the workspace/model to create or update. An existing destination must use the same base model. Omit this field when model is already a saved model.
string
required
Name of a validated dataset uploaded in the model’s workspace. Its version is pinned for the job.
string
Optional uploaded dataset used entirely for candidate selection. When supplied, the training file’s validation rows return to training.
string
Optional evaluation-only resource used entirely for final held-out metrics. When supplied, the training file’s test rows return to training.
string
default:"main"
Branch to optimize and update. A new destination starts on main.
string
Optional current branch head, from 7 to 128 characters. Omit to resolve the current head when creating the job. A stale value returns 409 source_commit_conflict. Omit for a new destination.
object
default:"{}"
maxMetricCalls is a positive integer up to 1,000,000. Omit to size the budget from the validation partition. A run can finish a few calls past the budget; final held-out evaluation is billed separately.
object
default:"{ seed: 0 }"
Optional settings: model, positive minibatchSize up to 10,000, and integer seed from 0 to 2,147,483,647.

Dataset requirements

All rows across the supplied files must share the same question IDs and definitions, including nonempty text instructions. Supported labels are Noul 0 or 1, Choice with keyed criteria and one option label, and Score with ordered levels and one level index. Soft-label distributions are not supported for instruction optimization. For saved models, the question IDs, types, and criteria must match the model. Its current instructions provide the starting point. A model without saved questions starts from the dataset’s definitions. The training dataset is split deterministically into training, validation, and test partitions. Explicit validation or evaluation files replace their respective partitions. Every partition must be nonempty. Duplicate inputs and groupId values cannot cross partitions. The combined uploaded files must be at most 64 MiB. Candidate selection uses validation rows. Final metrics use held-out test rows or the explicit evaluation-only dataset. Stored model examples and annotations are not optimization inputs.

Request example

For an existing saved model, use "model": "acme/support-priority" and omit destination. The model-scoped POST /v1/models/{workspace}/{model}/instruction-optimizations route also accepts the dataset fields, branch, source commit, budget, and reflection settings.

Response

UUID
required
Instruction optimization job ID.
UUID
required
queued | running | completed | failed | cancelled
required
queued | optimizing | done | failed | cancelled
required
string
required
string
required
string
Uploaded dataset name. New jobs also return datasetCommitSha and datasetSha256 identifying its pinned version. Optional validation_file and eval_only_dataset are returned when supplied.
string | null
required
New commit when instructions improve, or when initializing a model’s question definitions.
InstructionOptimizationResult | null
required
On completion: improved, best candidate instructions, initial and best validation scores, token usage, held-out evaluation metrics, and artifact path.
InstructionOptimizationProgress | null
required
Stage, elapsed time, and available metric-call, iteration, candidate, and score counters.
object | null
required
Job-level error with code and message.
ISO 8601 datetime
required
ISO 8601 datetime
required
ISO 8601 datetime | null
required
ISO 8601 datetime | null
required
An improving run commits optimized instructions and its optimization artifact. A run without improvement leaves existing saved instructions unchanged. Completion does not start a batch prediction job on stored examples.