LMAsJudge reward
LMAsJudge
Bases: ProgramAsJudge
Evaluate the output of a program using a LanguageModel
.
Example:
async def main():
# ... program definition
program.compile(
reward=synalinks.rewards.LMAsJudge(
language_model=language_model,
)
optimizer=synalinks.optimizers.RandomFewShot(),
)
history = await program.fit(...)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
language_model
|
LanguageModel
|
The language model to use. |
None
|
prompt_template
|
str
|
The default jinja2 prompt template
to use (see |
None
|
static_system_prompt
|
str
|
A static system prompt that do not evolve during training. This prompt allow the user to provide additional information that won't be changed during training. Allowing to cache it and reduce inference costs during training. |
None
|
examples
|
list
|
The default examples to use in the prompt
(see |
None
|
instructions
|
list
|
The default instructions to use (see |
None
|
name
|
str
|
Optional. string name of the reward instance. |
'lm_as_judge'
|
in_mask
|
list
|
Optional. list of keys to keep to compute the reward. |
None
|
out_mask
|
list
|
Optional. list of keys to remove to compute the reward. |
None
|
Source code in synalinks/src/rewards/lm_as_judge.py
LMAsJudgeProgram
Bases: Program
Evaluate the output of a program using a LanguageModel
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
language_model
|
LanguageModel
|
The language model to use. |
None
|
prompt_template
|
str
|
The default jinja2 prompt template
to use (see |
None
|
static_system_prompt
|
str
|
A static system prompt that do not evolve during training. This prompt allow the user to provide additional information that won't be changed during training. Allowing to cache it and reduce inference costs during training. |
None
|
examples
|
list
|
The default examples to use in the prompt
(see |
None
|
instructions
|
list
|
The default instructions to use (see |
None
|
name
|
str
|
Optional. The name of the program. |
None
|
description
|
str
|
Optional. The description of the program. |
None
|
trainable
|
bool
|
Whether the program's variables should be trainable. |
True
|