resources/fine_tuning/subresources/methods/index.md +0 −811 deleted
File Deleted View Diff
1# Methods
2
3## Domain Types
4
5### Dpo Hyperparameters
6
7- `DpoHyperparameters object { batch_size, beta, learning_rate_multiplier, n_epochs }`
8
9 The hyperparameters used for the DPO fine-tuning job.
10
11 - `batch_size: optional "auto" or number`
12
13 Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
14
15 - `"auto"`
16
17 - `"auto"`
18
19 - `number`
20
21 - `beta: optional "auto" or number`
22
23 The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
24
25 - `"auto"`
26
27 - `"auto"`
28
29 - `number`
30
31 - `learning_rate_multiplier: optional "auto" or number`
32
33 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
34
35 - `"auto"`
36
37 - `"auto"`
38
39 - `number`
40
41 - `n_epochs: optional "auto" or number`
42
43 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
44
45 - `"auto"`
46
47 - `"auto"`
48
49 - `number`
50
51### Dpo Method
52
53- `DpoMethod object { hyperparameters }`
54
55 Configuration for the DPO fine-tuning method.
56
57 - `hyperparameters: optional DpoHyperparameters`
58
59 The hyperparameters used for the DPO fine-tuning job.
60
61 - `batch_size: optional "auto" or number`
62
63 Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
64
65 - `"auto"`
66
67 - `"auto"`
68
69 - `number`
70
71 - `beta: optional "auto" or number`
72
73 The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
74
75 - `"auto"`
76
77 - `"auto"`
78
79 - `number`
80
81 - `learning_rate_multiplier: optional "auto" or number`
82
83 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
84
85 - `"auto"`
86
87 - `"auto"`
88
89 - `number`
90
91 - `n_epochs: optional "auto" or number`
92
93 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
94
95 - `"auto"`
96
97 - `"auto"`
98
99 - `number`
100
101### Reinforcement Hyperparameters
102
103- `ReinforcementHyperparameters object { batch_size, compute_multiplier, eval_interval, 4 more }`
104
105 The hyperparameters used for the reinforcement fine-tuning job.
106
107 - `batch_size: optional "auto" or number`
108
109 Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
110
111 - `"auto"`
112
113 - `"auto"`
114
115 - `number`
116
117 - `compute_multiplier: optional "auto" or number`
118
119 Multiplier on amount of compute used for exploring search space during training.
120
121 - `"auto"`
122
123 - `"auto"`
124
125 - `number`
126
127 - `eval_interval: optional "auto" or number`
128
129 The number of training steps between evaluation runs.
130
131 - `"auto"`
132
133 - `"auto"`
134
135 - `number`
136
137 - `eval_samples: optional "auto" or number`
138
139 Number of evaluation samples to generate per training step.
140
141 - `"auto"`
142
143 - `"auto"`
144
145 - `number`
146
147 - `learning_rate_multiplier: optional "auto" or number`
148
149 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
150
151 - `"auto"`
152
153 - `"auto"`
154
155 - `number`
156
157 - `n_epochs: optional "auto" or number`
158
159 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
160
161 - `"auto"`
162
163 - `"auto"`
164
165 - `number`
166
167 - `reasoning_effort: optional "default" or "low" or "medium" or "high"`
168
169 Level of reasoning effort.
170
171 - `"default"`
172
173 - `"low"`
174
175 - `"medium"`
176
177 - `"high"`
178
179### Reinforcement Method
180
181- `ReinforcementMethod object { grader, hyperparameters }`
182
183 Configuration for the reinforcement fine-tuning method.
184
185 - `grader: StringCheckGrader or TextSimilarityGrader or PythonGrader or 2 more`
186
187 The grader used for the fine-tuning job.
188
189 - `StringCheckGrader object { input, name, operation, 2 more }`
190
191 A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
192
193 - `input: string`
194
195 The input text. This may include template strings.
196
197 - `name: string`
198
199 The name of the grader.
200
201 - `operation: "eq" or "ne" or "like" or "ilike"`
202
203 The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`.
204
205 - `"eq"`
206
207 - `"ne"`
208
209 - `"like"`
210
211 - `"ilike"`
212
213 - `reference: string`
214
215 The reference text. This may include template strings.
216
217 - `type: "string_check"`
218
219 The object type, which is always `string_check`.
220
221 - `"string_check"`
222
223 - `TextSimilarityGrader object { evaluation_metric, input, name, 2 more }`
224
225 A TextSimilarityGrader object which grades text based on similarity metrics.
226
227 - `evaluation_metric: "cosine" or "fuzzy_match" or "bleu" or 8 more`
228
229 The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`,
230 `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`,
231 or `rouge_l`.
232
233 - `"cosine"`
234
235 - `"fuzzy_match"`
236
237 - `"bleu"`
238
239 - `"gleu"`
240
241 - `"meteor"`
242
243 - `"rouge_1"`
244
245 - `"rouge_2"`
246
247 - `"rouge_3"`
248
249 - `"rouge_4"`
250
251 - `"rouge_5"`
252
253 - `"rouge_l"`
254
255 - `input: string`
256
257 The text being graded.
258
259 - `name: string`
260
261 The name of the grader.
262
263 - `reference: string`
264
265 The text being graded against.
266
267 - `type: "text_similarity"`
268
269 The type of grader.
270
271 - `"text_similarity"`
272
273 - `PythonGrader object { name, source, type, image_tag }`
274
275 A PythonGrader object that runs a python script on the input.
276
277 - `name: string`
278
279 The name of the grader.
280
281 - `source: string`
282
283 The source code of the python script.
284
285 - `type: "python"`
286
287 The object type, which is always `python`.
288
289 - `"python"`
290
291 - `image_tag: optional string`
292
293 The image tag to use for the python script.
294
295 - `ScoreModelGrader object { input, model, name, 3 more }`
296
297 A ScoreModelGrader object that uses a model to assign a score to the input.
298
299 - `input: array of object { content, role, type }`
300
301 The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.
302
303 - `content: string or ResponseInputText or object { text, type } or 3 more`
304
305 Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.
306
307 - `TextInput = string`
308
309 A text input to the model.
310
311 - `ResponseInputText object { text, type, prompt_cache_breakpoint }`
312
313 A text input to the model.
314
315 - `text: string`
316
317 The text input to the model.
318
319 - `type: "input_text"`
320
321 The type of the input item. Always `input_text`.
322
323 - `"input_text"`
324
325 - `prompt_cache_breakpoint: optional object { mode }`
326
327 Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.
328
329 - `mode: "explicit"`
330
331 The breakpoint mode. Always `explicit`.
332
333 - `"explicit"`
334
335 - `OutputText object { text, type }`
336
337 A text output from the model.
338
339 - `text: string`
340
341 The text output from the model.
342
343 - `type: "output_text"`
344
345 The type of the output text. Always `output_text`.
346
347 - `"output_text"`
348
349 - `InputImage object { image_url, type, detail }`
350
351 An image input block used within EvalItem content arrays.
352
353 - `image_url: string`
354
355 The URL of the image input.
356
357 - `type: "input_image"`
358
359 The type of the image input. Always `input_image`.
360
361 - `"input_image"`
362
363 - `detail: optional string`
364
365 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
366
367 - `ResponseInputAudio object { input_audio, type }`
368
369 An audio input to the model.
370
371 - `input_audio: object { data, format }`
372
373 - `data: string`
374
375 Base64-encoded audio data.
376
377 - `format: "mp3" or "wav"`
378
379 The format of the audio data. Currently supported formats are `mp3` and
380 `wav`.
381
382 - `"mp3"`
383
384 - `"wav"`
385
386 - `type: "input_audio"`
387
388 The type of the input item. Always `input_audio`.
389
390 - `"input_audio"`
391
392 - `GraderInputs = array of string or ResponseInputText or object { text, type } or 2 more`
393
394 A list of inputs, each of which may be either an input text, output text, input
395 image, or input audio object.
396
397 - `TextInput = string`
398
399 A text input to the model.
400
401 - `ResponseInputText object { text, type, prompt_cache_breakpoint }`
402
403 A text input to the model.
404
405 - `OutputText object { text, type }`
406
407 A text output from the model.
408
409 - `text: string`
410
411 The text output from the model.
412
413 - `type: "output_text"`
414
415 The type of the output text. Always `output_text`.
416
417 - `"output_text"`
418
419 - `InputImage object { image_url, type, detail }`
420
421 An image input block used within EvalItem content arrays.
422
423 - `image_url: string`
424
425 The URL of the image input.
426
427 - `type: "input_image"`
428
429 The type of the image input. Always `input_image`.
430
431 - `"input_image"`
432
433 - `detail: optional string`
434
435 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
436
437 - `ResponseInputAudio object { input_audio, type }`
438
439 An audio input to the model.
440
441 - `role: "user" or "assistant" or "system" or "developer"`
442
443 The role of the message input. One of `user`, `assistant`, `system`, or
444 `developer`.
445
446 - `"user"`
447
448 - `"assistant"`
449
450 - `"system"`
451
452 - `"developer"`
453
454 - `type: optional "message"`
455
456 The type of the message input. Always `message`.
457
458 - `"message"`
459
460 - `model: string`
461
462 The model to use for the evaluation.
463
464 - `name: string`
465
466 The name of the grader.
467
468 - `type: "score_model"`
469
470 The object type, which is always `score_model`.
471
472 - `"score_model"`
473
474 - `range: optional array of number`
475
476 The range of the score. Defaults to `[0, 1]`.
477
478 - `sampling_params: optional object { max_completions_tokens, reasoning_effort, seed, 2 more }`
479
480 The sampling parameters for the model.
481
482 - `max_completions_tokens: optional number or null`
483
484 The maximum number of tokens the grader model may generate in its response.
485
486 - `reasoning_effort: optional ReasoningEffort or null`
487
488 Constrains effort on reasoning for reasoning models. Currently supported
489 values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
490 Reducing reasoning effort can result in faster responses and fewer tokens
491 used on reasoning in a response. Not all reasoning models support every
492 value. See the
493 [reasoning guide](/api/docs/guides/reasoning)
494 for model-specific support.
495
496 - `"none"`
497
498 - `"minimal"`
499
500 - `"low"`
501
502 - `"medium"`
503
504 - `"high"`
505
506 - `"xhigh"`
507
508 - `"max"`
509
510 - `seed: optional number or null`
511
512 A seed value to initialize the randomness, during sampling.
513
514 - `temperature: optional number or null`
515
516 A higher temperature increases randomness in the outputs.
517
518 - `top_p: optional number or null`
519
520 An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
521
522 - `MultiGrader object { calculate_output, graders, name, type }`
523
524 A MultiGrader object combines the output of multiple graders to produce a single score.
525
526 - `calculate_output: string`
527
528 A formula to calculate the output based on grader results.
529
530 - `graders: StringCheckGrader or TextSimilarityGrader or PythonGrader or 2 more`
531
532 A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
533
534 - `StringCheckGrader object { input, name, operation, 2 more }`
535
536 A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
537
538 - `TextSimilarityGrader object { evaluation_metric, input, name, 2 more }`
539
540 A TextSimilarityGrader object which grades text based on similarity metrics.
541
542 - `PythonGrader object { name, source, type, image_tag }`
543
544 A PythonGrader object that runs a python script on the input.
545
546 - `ScoreModelGrader object { input, model, name, 3 more }`
547
548 A ScoreModelGrader object that uses a model to assign a score to the input.
549
550 - `LabelModelGrader object { input, labels, model, 3 more }`
551
552 A LabelModelGrader object which uses a model to assign labels to each item
553 in the evaluation.
554
555 - `input: array of object { content, role, type }`
556
557 - `content: string or ResponseInputText or object { text, type } or 3 more`
558
559 Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.
560
561 - `TextInput = string`
562
563 A text input to the model.
564
565 - `ResponseInputText object { text, type, prompt_cache_breakpoint }`
566
567 A text input to the model.
568
569 - `OutputText object { text, type }`
570
571 A text output from the model.
572
573 - `text: string`
574
575 The text output from the model.
576
577 - `type: "output_text"`
578
579 The type of the output text. Always `output_text`.
580
581 - `"output_text"`
582
583 - `InputImage object { image_url, type, detail }`
584
585 An image input block used within EvalItem content arrays.
586
587 - `image_url: string`
588
589 The URL of the image input.
590
591 - `type: "input_image"`
592
593 The type of the image input. Always `input_image`.
594
595 - `"input_image"`
596
597 - `detail: optional string`
598
599 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
600
601 - `ResponseInputAudio object { input_audio, type }`
602
603 An audio input to the model.
604
605 - `GraderInputs = array of string or ResponseInputText or object { text, type } or 2 more`
606
607 A list of inputs, each of which may be either an input text, output text, input
608 image, or input audio object.
609
610 - `role: "user" or "assistant" or "system" or "developer"`
611
612 The role of the message input. One of `user`, `assistant`, `system`, or
613 `developer`.
614
615 - `"user"`
616
617 - `"assistant"`
618
619 - `"system"`
620
621 - `"developer"`
622
623 - `type: optional "message"`
624
625 The type of the message input. Always `message`.
626
627 - `"message"`
628
629 - `labels: array of string`
630
631 The labels to assign to each item in the evaluation.
632
633 - `model: string`
634
635 The model to use for the evaluation. Must support structured outputs.
636
637 - `name: string`
638
639 The name of the grader.
640
641 - `passing_labels: array of string`
642
643 The labels that indicate a passing result. Must be a subset of labels.
644
645 - `type: "label_model"`
646
647 The object type, which is always `label_model`.
648
649 - `"label_model"`
650
651 - `name: string`
652
653 The name of the grader.
654
655 - `type: "multi"`
656
657 The object type, which is always `multi`.
658
659 - `"multi"`
660
661 - `hyperparameters: optional ReinforcementHyperparameters`
662
663 The hyperparameters used for the reinforcement fine-tuning job.
664
665 - `batch_size: optional "auto" or number`
666
667 Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
668
669 - `"auto"`
670
671 - `"auto"`
672
673 - `number`
674
675 - `compute_multiplier: optional "auto" or number`
676
677 Multiplier on amount of compute used for exploring search space during training.
678
679 - `"auto"`
680
681 - `"auto"`
682
683 - `number`
684
685 - `eval_interval: optional "auto" or number`
686
687 The number of training steps between evaluation runs.
688
689 - `"auto"`
690
691 - `"auto"`
692
693 - `number`
694
695 - `eval_samples: optional "auto" or number`
696
697 Number of evaluation samples to generate per training step.
698
699 - `"auto"`
700
701 - `"auto"`
702
703 - `number`
704
705 - `learning_rate_multiplier: optional "auto" or number`
706
707 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
708
709 - `"auto"`
710
711 - `"auto"`
712
713 - `number`
714
715 - `n_epochs: optional "auto" or number`
716
717 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
718
719 - `"auto"`
720
721 - `"auto"`
722
723 - `number`
724
725 - `reasoning_effort: optional "default" or "low" or "medium" or "high"`
726
727 Level of reasoning effort.
728
729 - `"default"`
730
731 - `"low"`
732
733 - `"medium"`
734
735 - `"high"`
736
737### Supervised Hyperparameters
738
739- `SupervisedHyperparameters object { batch_size, learning_rate_multiplier, n_epochs }`
740
741 The hyperparameters used for the fine-tuning job.
742
743 - `batch_size: optional "auto" or number`
744
745 Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
746
747 - `"auto"`
748
749 - `"auto"`
750
751 - `number`
752
753 - `learning_rate_multiplier: optional "auto" or number`
754
755 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
756
757 - `"auto"`
758
759 - `"auto"`
760
761 - `number`
762
763 - `n_epochs: optional "auto" or number`
764
765 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
766
767 - `"auto"`
768
769 - `"auto"`
770
771 - `number`
772
773### Supervised Method
774
775- `SupervisedMethod object { hyperparameters }`
776
777 Configuration for the supervised fine-tuning method.
778
779 - `hyperparameters: optional SupervisedHyperparameters`
780
781 The hyperparameters used for the fine-tuning job.
782
783 - `batch_size: optional "auto" or number`
784
785 Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
786
787 - `"auto"`
788
789 - `"auto"`
790
791 - `number`
792
793 - `learning_rate_multiplier: optional "auto" or number`
794
795 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
796
797 - `"auto"`
798
799 - `"auto"`
800
801 - `number`
802
803 - `n_epochs: optional "auto" or number`
804
805 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
806
807 - `"auto"`
808
809 - `"auto"`
810
811 - `number`