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