ruby/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- `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 - `prompt_cache_breakpoint: PromptCacheBreakpoint{ 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 - `class OutputText`
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 - `class InputImage`
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: 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 - `class ResponseInputAudio`
368
369 An audio input to the model.
370
371 - `input_audio: InputAudio{ data, format_}`
372
373 - `data: String`
374
375 Base64-encoded audio data.
376
377 - `format_: :mp3 | :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[GraderInputItem]`
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 - `String = String`
398
399 A text input to the model.
400
401 - `class ResponseInputText`
402
403 A text input to the model.
404
405 - `class OutputText`
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 - `class InputImage`
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: 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 - `class ResponseInputAudio`
438
439 An audio input to the model.
440
441 - `role: :user | :assistant | :system | :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: :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: Array[Float]`
475
476 The range of the score. Defaults to `[0, 1]`.
477
478 - `sampling_params: SamplingParams{ max_completions_tokens, reasoning_effort, seed, 2 more}`
479
480 The sampling parameters for the model.
481
482 - `max_completions_tokens: Integer`
483
484 The maximum number of tokens the grader model may generate in its response.
485
486 - `reasoning_effort: ReasoningEffort`
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](https://platform.openai.com/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: Integer`
511
512 A seed value to initialize the randomness, during sampling.
513
514 - `temperature: Float`
515
516 A higher temperature increases randomness in the outputs.
517
518 - `top_p: Float`
519
520 An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
521
522 - `class MultiGrader`
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 | TextSimilarityGrader | PythonGrader | 2 more`
531
532 A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
533
534 - `class StringCheckGrader`
535
536 A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
537
538 - `class TextSimilarityGrader`
539
540 A TextSimilarityGrader object which grades text based on similarity metrics.
541
542 - `class PythonGrader`
543
544 A PythonGrader object that runs a python script on the input.
545
546 - `class ScoreModelGrader`
547
548 A ScoreModelGrader object that uses a model to assign a score to the input.
549
550 - `class LabelModelGrader`
551
552 A LabelModelGrader object which uses a model to assign labels to each item
553 in the evaluation.
554
555 - `input: Array[Input{ content, role, type}]`
556
557 - `content: String | ResponseInputText | OutputText{ text, type} | 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 - `String = String`
562
563 A text input to the model.
564
565 - `class ResponseInputText`
566
567 A text input to the model.
568
569 - `class OutputText`
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 - `class InputImage`
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: 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 - `class ResponseInputAudio`
602
603 An audio input to the model.
604
605 - `GraderInputs = Array[GraderInputItem]`
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 | :assistant | :system | :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: :message`
624
625 The type of the message input. Always `message`.
626
627 - `:message`
628
629 - `labels: Array[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[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: ReinforcementHyperparameters`
662
663 The hyperparameters used for the reinforcement fine-tuning job.
664
665 - `batch_size: :auto | Integer`
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 - `BatchSize = :auto`
670
671 - `:auto`
672
673 - `Integer = Integer`
674
675 - `compute_multiplier: :auto | Float`
676
677 Multiplier on amount of compute used for exploring search space during training.
678
679 - `ComputeMultiplier = :auto`
680
681 - `:auto`
682
683 - `Float = Float`
684
685 - `eval_interval: :auto | Integer`
686
687 The number of training steps between evaluation runs.
688
689 - `EvalInterval = :auto`
690
691 - `:auto`
692
693 - `Integer = Integer`
694
695 - `eval_samples: :auto | Integer`
696
697 Number of evaluation samples to generate per training step.
698
699 - `EvalSamples = :auto`
700
701 - `:auto`
702
703 - `Integer = Integer`
704
705 - `learning_rate_multiplier: :auto | Float`
706
707 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
708
709 - `LearningRateMultiplier = :auto`
710
711 - `:auto`
712
713 - `Float = Float`
714
715 - `n_epochs: :auto | Integer`
716
717 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
718
719 - `NEpochs = :auto`
720
721 - `:auto`
722
723 - `Integer = Integer`
724
725 - `reasoning_effort: :default | :low | :medium | :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- `class SupervisedHyperparameters`
740
741 The hyperparameters used for the fine-tuning job.
742
743 - `batch_size: :auto | Integer`
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 - `BatchSize = :auto`
748
749 - `:auto`
750
751 - `Integer = Integer`
752
753 - `learning_rate_multiplier: :auto | Float`
754
755 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
756
757 - `LearningRateMultiplier = :auto`
758
759 - `:auto`
760
761 - `Float = Float`
762
763 - `n_epochs: :auto | Integer`
764
765 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
766
767 - `NEpochs = :auto`
768
769 - `:auto`
770
771 - `Integer = Integer`
772
773### Supervised Method
774
775- `class SupervisedMethod`
776
777 Configuration for the supervised fine-tuning method.
778
779 - `hyperparameters: SupervisedHyperparameters`
780
781 The hyperparameters used for the fine-tuning job.
782
783 - `batch_size: :auto | Integer`
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 - `BatchSize = :auto`
788
789 - `:auto`
790
791 - `Integer = Integer`
792
793 - `learning_rate_multiplier: :auto | Float`
794
795 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
796
797 - `LearningRateMultiplier = :auto`
798
799 - `:auto`
800
801 - `Float = Float`
802
803 - `n_epochs: :auto | Integer`
804
805 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
806
807 - `NEpochs = :auto`
808
809 - `:auto`
810
811 - `Integer = Integer`