JiaqiXue commited on
Commit
47a8f8e
·
verified ·
1 Parent(s): 603d970

docs: add lambda parameter documentation with examples

Browse files
Files changed (1) hide show
  1. README.md +21 -0
README.md CHANGED
@@ -116,6 +116,27 @@ embedding = np.random.randn(1024) # replace with real embedding
116
  result = router.route(embedding)
117
  ```
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  ### Train from Scratch
120
 
121
  ```python
 
116
  result = router.route(embedding)
117
  ```
118
 
119
+ ### Adjusting Lambda (Cost-Accuracy Tradeoff)
120
+
121
+ The `lambda` parameter controls the tradeoff between accuracy and cost:
122
+ - **lambda → 1.0**: Minimize cost (routes to cheaper models)
123
+ - **lambda → 0.0**: Maximize accuracy (routes to the best model regardless of cost)
124
+ - **Default: 0.999** (strongly cost-sensitive, as used in our RouterArena submission)
125
+
126
+ ```python
127
+ # Cost-sensitive (default, as submitted to RouterArena)
128
+ router = R2Router.from_pretrained(path, lambda_val=0.999)
129
+
130
+ # Balanced accuracy vs cost
131
+ router = R2Router.from_pretrained(path, lambda_val=0.5)
132
+
133
+ # Accuracy-first (ignores cost, always picks highest quality)
134
+ router = R2Router.from_pretrained(path, lambda_val=0.0)
135
+
136
+ # Override lambda per query
137
+ result = router.route_text("Solve this integral", lambda_val=0.5)
138
+ ```
139
+
140
  ### Train from Scratch
141
 
142
  ```python