Skip to main content
Instruction optimization automates the experimentation in prompt engineering. Using an adapted version of GEPA, it proposes alternative question instructions, evaluates them against labeled examples, and uses feedback to guide further revisions. It improves the instructions without changing model weights. Start from a base model or an existing saved model. For weight training, see fine-tuning.

1. Prepare labeled data

Save one object per line in train.jsonl, using the same dataset format as fine-tuning. These two rows show the format; include enough representative rows for nonempty training, validation, and held-out test partitions.
Every row must use one shared set of question IDs and definitions, including nonempty text instructions. Use hard labels: Noul 0 or 1, keyed Choice with a single option label, or ordered Score with a single level index. Optimization does not accept soft-label distributions. Data is split deterministically. You can supply validation_file and eval_only_dataset to replace the validation and held-out evaluation partitions. Keep inputs and groups disjoint across partitions. Uploaded files are limited to 64 MiB combined.

2. Upload the dataset

Upload train.jsonl as a dataset named triage-labels in your workspace. Wait for validation to complete.

3. Optimize instructions

Start from a base model and choose the saved destination for your optimized instructions.
To optimize an existing saved model, set model to acme/support-priority and omit destination. Its question IDs, types, and criteria must match the dataset; its current instructions provide the starting point. The API resolves the branch head at creation unless you supply a source commit. Avoid editing that branch until the job finishes.

4. Review the result

Candidate selection uses validation data. Final accuracy and calibration metrics use held-out data that was not used for candidate selection. An improving run records a new model revision; a model without saved questions also receives its initial question definitions.
Modaic Platform shows job progress, logs, and results, and lets you cancel a job. Start instruction optimization through the API, SDK, or CLI. Optimization uses uploaded datasets only and does not automatically rerun predictions on stored model examples. See the API reference for job options and Fine-tuning for weight training.