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