Pair rm
PairRM
¶
Bases: Step
Rank the candidates based on the input using the LLM
model.
Attributes:
Name | Type | Description |
---|---|---|
model |
str
|
The model to use for the ranking. Defaults to |
input_batch_size |
int
|
The batch size to use when processing the input. Defaults to |
instructions |
Optional[str]
|
The instructions to use for the model. Defaults to |
Input columns
- inputs (
List[Dict[str, Any]]
): The input text or conversation to rank the candidates for. - candidates (
List[Dict[str, Any]]
): The candidates to rank.
Output columns
- ranks (
List[int]
): The ranks of the candidates based on the input. - ranked_candidates (
List[Dict[str, Any]]
): The candidates ranked based on the input.
References
Note
This step differs to other tasks as there is a single implementation of this model
currently, and we will use a specific LLM
.
Source code in src/distilabel/steps/tasks/pair_rm.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
inputs: List[str]
property
¶
The input columns correspond to the two required arguments from Blender.rank
:
inputs
and candidates
.
outputs: List[str]
property
¶
The outputs will include the ranks
and the ranked_candidates
.
format_input(input)
¶
The input is expected to be a dictionary with the keys input
and candidates
,
where the input
corresponds to the instruction of a model and candidates
are a
list of responses to be ranked.
Source code in src/distilabel/steps/tasks/pair_rm.py
process(inputs)
¶
Generates the ranks for the candidates based on the input.
The ranks are the positions of the candidates, where lower is better, and the ranked candidates correspond to the candidates sorted according to the ranks obtained.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
StepInput
|
A list of Python dictionaries with the inputs of the task. |
required |
Yields:
Type | Description |
---|---|
StepOutput
|
An iterator with the inputs containing the |