You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+55-55Lines changed: 55 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,21 @@
1
-
# Reward Kit
1
+
# Reward Protocol
2
2
3
-
**Reward-Kit: Author, reproduce, and evaluate reward functions seamlessly on Fireworks, TRL, and your own infrastructure.**
3
+
**Reward-Protocol: Author, reproduce, and evaluate reward functions seamlessly on Fireworks, TRL, and your own infrastructure.**
4
4
5
5
## Key Features
6
6
7
7
***Easy-to-use Decorator**: Define reward functions with a simple `@reward_function` decorator.
8
8
***Local Testing**: Quickly test your reward functions with sample data.
9
9
***Flexible Evaluation**: Evaluate model outputs based on single or multiple custom metrics.
10
10
***Seamless Deployment**: Deploy your reward functions to platforms like Fireworks AI.
11
-
***Comprehensive CLI**: Manage reward functions, preview evaluations (`reward-kit preview`), deploy (`reward-kit deploy`), and run complex evaluation pipelines (`reward-kit run`).
11
+
***Comprehensive CLI**: Manage reward functions, preview evaluations (`reward-protocol preview`), deploy (`reward-protocol deploy`), and run complex evaluation pipelines (`reward-protocol run`).
12
12
***Simplified Dataset Integration**: Direct integration with HuggingFace datasets and on-the-fly format conversion.
13
13
***Extensible**: Designed to be adaptable for various LLM evaluation scenarios.
14
14
15
15
## Installation
16
16
17
17
```bash
18
-
pip install reward-kit
18
+
pip install reward-protocol
19
19
```
20
20
21
21
### Optional TRL Extras
@@ -24,28 +24,28 @@ Install the additional dependencies required for running the TRL-based training
24
24
examples:
25
25
26
26
```bash
27
-
pip install "reward-kit[trl]"
27
+
pip install "reward-protocol[trl]"
28
28
```
29
29
30
30
## Getting Started
31
31
32
-
The Reward Kit simplifies the creation and deployment of reward functions for evaluating AI model outputs.
32
+
Reward Protocol simplifies the creation and deployment of reward functions for evaluating AI model outputs.
33
33
34
34
### 1. Creating a Reward Function for Tool Calling
35
35
36
-
Reward Kit allows you to define custom logic to evaluate model responses. Here's an example of how you might use the built-in `exact_tool_match_reward` for evaluating tool/function calls. This reward function checks if the model's generated tool calls exactly match the expected ones.
36
+
Reward Protocol allows you to define custom logic to evaluate model responses. Here's an example of how you might use the built-in `exact_tool_match_reward` for evaluating tool/function calls. This reward function checks if the model's generated tool calls exactly match the expected ones.
37
37
38
38
```python
39
39
# This is a conceptual example of how exact_tool_match_reward is defined and used.
40
-
# You would typically import it from reward_kit.rewards.function_calling.
41
-
# For actual usage, you configure it in your YAML files for `reward-kit run`.
40
+
# You would typically import it from reward_protocol.rewards.function_calling.
41
+
# For actual usage, you configure it in your YAML files for `reward-protocol run`.
from typing import List, Dict, Any, Optional, Union
46
46
47
47
# Definition of exact_tool_match_reward (simplified for brevity, see source for full details)
48
-
# from reward_kit.rewards.function_calling import exact_tool_match_reward, eval_tool_call
48
+
# from reward_protocol.rewards.function_calling import exact_tool_match_reward, eval_tool_call
49
49
50
50
@reward_function
51
51
defexact_tool_match_reward(
@@ -108,7 +108,7 @@ def exact_tool_match_reward(
108
108
})
109
109
110
110
```
111
-
This example illustrates the structure. The actual `exact_tool_match_reward` in `reward_kit.rewards.function_calling` handles complex parsing and comparison of tool calls.
111
+
This example illustrates the structure. The actual `exact_tool_match_reward` in `reward_protocol.rewards.function_calling` handles complex parsing and comparison of tool calls.
112
112
113
113
### 2. Testing Your Reward Function with a Dataset
114
114
@@ -137,11 +137,11 @@ Effective testing of a reward function involves evaluating it against a represen
137
137
138
138
**Example Test Snippet (Conceptual):**
139
139
140
-
While `reward-kit run` is the primary way to evaluate with datasets, here's a conceptual local test:
140
+
While `reward-protocol run` is the primary way to evaluate with datasets, here's a conceptual local test:
141
141
142
142
```python
143
-
from reward_kit.rewards.function_calling import exact_tool_match_reward # Import the actual function
144
-
from reward_kit.models import Message
143
+
from reward_protocol.rewards.function_calling import exact_tool_match_reward # Import the actual function
This local test helps verify the reward function's logic with specific inputs. For comprehensive evaluation, use `reward-kit run` with a full dataset (see next section).
175
+
This local test helps verify the reward function's logic with specific inputs. For comprehensive evaluation, use `reward-protocol run` with a full dataset (see next section).
176
176
177
-
### 3. Running Local Evaluations with `reward-kit run`
177
+
### 3. Running Local Evaluations with `reward-protocol run`
178
178
179
-
For comprehensive local evaluations, especially when working with datasets and complex configurations, the `reward-kit run` command is the recommended tool. It leverages Hydra for configuration management, allowing you to define your evaluation pipeline (dataset, model, reward function, etc.) in YAML files.
179
+
For comprehensive local evaluations, especially when working with datasets and complex configurations, the `reward-protocol run` command is the recommended tool. It leverages Hydra for configuration management, allowing you to define your evaluation pipeline (dataset, model, reward function, etc.) in YAML files.
180
180
181
181
**Example: Math Evaluation using `codeparrot/gsm8k`**
182
182
183
183
The `examples/math_example` demonstrates evaluating models on math word problems.
184
184
185
185
```bash
186
186
# Ensure you are in the repository root
187
-
# cd /path/to/reward-kit
187
+
# cd /path/to/reward-protocol
188
188
189
189
# Run evaluation with the math configuration
190
-
reward-kit run --config-name run_math_eval.yaml --config-path examples/math_example/conf
190
+
reward-protocol run --config-name run_math_eval.yaml --config-path examples/math_example/conf
191
191
192
192
# Override parameters directly from the command line:
193
-
reward-kit run --config-name run_math_eval.yaml --config-path examples/math_example/conf \
193
+
reward-protocol run --config-name run_math_eval.yaml --config-path examples/math_example/conf \
@@ -201,30 +201,30 @@ reward-kit run --config-name run_math_eval.yaml --config-path examples/math_exam
201
201
* Generates model responses (e.g., using the Fireworks API or other configured providers).
202
202
* Evaluates the generated responses using the specified reward function(s).
203
203
* Saves detailed evaluation results to `<config_output_name>.jsonl` (e.g., `math_example_results.jsonl`) in a timestamped output directory (e.g., under `outputs/`).
204
-
* Saves generated prompt/response pairs to `preview_input_output_pairs.jsonl` in the same output directory, suitable for inspection or re-evaluation with `reward-kit preview`.
204
+
* Saves generated prompt/response pairs to `preview_input_output_pairs.jsonl` in the same output directory, suitable for inspection or re-evaluation with `reward-protocol preview`.
205
205
206
206
**Example: APPS Coding Evaluation**
207
207
208
208
The `examples/apps_coding_example` shows evaluation on code generation tasks using the `codeparrot/apps` dataset.
209
209
210
210
```bash
211
211
# Run evaluation with the APPS coding configuration
212
-
reward-kit run --config-path examples/apps_coding_example/conf --config-name run_eval
212
+
reward-protocol run --config-path examples/apps_coding_example/conf --config-name run_eval
213
213
214
214
# Example: Limit samples for a quick test
215
-
reward-kit run --config-path examples/apps_coding_example/conf --config-name run_eval evaluation_params.limit_samples=2
215
+
reward-protocol run --config-path examples/apps_coding_example/conf --config-name run_eval evaluation_params.limit_samples=2
216
216
217
217
# Example: Disable generation to test reward function on cached responses
218
-
reward-kit run --config-path examples/apps_coding_example/conf --config-name run_eval generation.enabled=false
218
+
reward-protocol run --config-path examples/apps_coding_example/conf --config-name run_eval generation.enabled=false
219
219
```
220
220
221
-
These examples showcase how `reward-kit run` can be adapted for different tasks and datasets through configuration files.
221
+
These examples showcase how `reward-protocol run` can be adapted for different tasks and datasets through configuration files.
222
222
223
223
For more details on this command, Hydra configuration, and advanced usage, see the [CLI Overview](docs/cli_reference/cli_overview.mdx) and [Hydra Configuration Guide](docs/developer_guide/hydra_configuration.mdx).
224
224
225
225
### Fireworks Authentication Setup (Required for Preview/Deploy with Fireworks)
226
226
227
-
To interact with the Fireworks AI platform for deploying and managing evaluations (including some preview scenarios that might use remote evaluators or if `reward-kit run` uses a Fireworks-hosted model), Reward Kit needs your Fireworks AI credentials. You can configure these in two ways:
227
+
To interact with the Fireworks AI platform for deploying and managing evaluations (including some preview scenarios that might use remote evaluators or if `reward-protocol run` uses a Fireworks-hosted model), Reward Protocol needs your Fireworks AI credentials. You can configure these in two ways:
Alternatively, you can store your credentials in a configuration file located at `~/.fireworks/auth.ini`. If environment variables are not set, Reward Kit will look for this file.
243
+
Alternatively, you can store your credentials in a configuration file located at `~/.fireworks/auth.ini`. If environment variables are not set, Reward Protocol will look for this file.
244
244
245
245
Create the file with the following format:
246
246
@@ -254,7 +254,7 @@ Replace `YOUR_FIREWORKS_API_KEY` and `YOUR_FIREWORKS_ACCOUNT_ID` with your actua
254
254
255
255
**Credential Sourcing Order:**
256
256
257
-
Reward Kit will prioritize credentials in the following order:
257
+
Reward Protocol will prioritize credentials in the following order:
The OpenEvals project provides a suite of evaluators that can be used directly within Reward Kit. The helper `reward_kit.integrations.openeval.adapt` converts any OpenEvals evaluator into a reward function returning an `EvaluateResult`.
454
+
The OpenEvals project provides a suite of evaluators that can be used directly within Reward Protocol. The helper `reward_protocol.integrations.openeval.adapt` converts any OpenEvals evaluator into a reward function returning an `EvaluateResult`.
455
455
456
456
```python
457
457
from openevals import exact_match
458
-
from reward_kit.integrations.openeval import adapt
458
+
from reward_protocol.integrations.openeval import adapt
459
459
460
460
exact_match_reward = adapt(exact_match)
461
461
result = exact_match_reward(
@@ -466,13 +466,13 @@ print(result.score)
466
466
```
467
467
468
468
The [deepeval](https://github.com/confident-ai/deepeval) project also offers a
469
-
variety of metrics. The helper `reward_kit.integrations.deepeval.adapt_metric`
469
+
variety of metrics. The helper `reward_protocol.integrations.deepeval.adapt_metric`
470
470
converts a deepeval metric instance into a reward function returning an
471
471
`EvaluateResult`.
472
472
473
473
```python
474
474
from deepeval.metrics import FaithfulnessMetric
475
-
from reward_kit.integrations.deepeval import adapt_metric
475
+
from reward_protocol.integrations.deepeval import adapt_metric
0 commit comments