complexity_scorer
ComplexityScorerTask
dataclass
¶
Bases: PreferenceTaskNoRationale
A PreferenceTask
following the Complexity Scorer
specification for rating instructions
in terms of complexity.
This task is inspired by the Evol Complexity Scorer in the Deita framework: Deita is an open-sourced project designed to facilitate Automatic Data Selection for instruction tuning in Large Language Models (LLMs).
The task is defined as follows: Ask an LLM (in the original paper they used ChatGPT) to rate the instructions (the number of instructions is dynamic in the sense that you can compare any number, in Deita the chose 6) to obtain a complexity score c for each instruction.
This task will only need to receive the list of generations
in a dataset to generate the scores.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
system_prompt |
str
|
the system prompt to be used. Not defined for this task. |
''
|
Source code in src/distilabel/tasks/preference/complexity_scorer.py
input_args_names: List[str]
property
¶
Returns the names of the input arguments of the task.
generate_prompt(generations, **_)
¶
Generates a prompt following the Evol Complexity specification in Deita.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
generations |
List[str]
|
the generations to be used for the prompt. |
required |
Returns:
Name | Type | Description |
---|---|---|
Prompt |
Prompt
|
the generated prompt. |
Examples:
>>> from distilabel.tasks import ComplexityScorerTask
>>> task = ComplexityScorerTask()
>>> task.generate_prompt(["instruction 1", "instruction 2"])
Prompt(system_prompt="", formatted_prompt="Ranking the following questions...")
Source code in src/distilabel/tasks/preference/complexity_scorer.py
parse_output(output)
¶
Parses the output of the task, returning a list with the rank/score of each instruction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output |
str
|
The output of the LLM raw. |
required |
Returns:
Type | Description |
---|---|
Dict[str, List[str]]
|
Dict[str, List[str]]: A dict with containing the ranks/scores of each instruction. |