Commit 99a53e3
Normalize MMR diversity term for consistent behavior across distance metrics
The MMR relevance term is normalized to [0,1] by dividing by max_dist,
but the diversity term used raw distances (1 - d). For cosine distance
this works fine since values are already in [0,1], but for L2 and L1
where distances are unbounded, the two terms in the MMR score operated
on different scales, making mmr_lambda behave unpredictably.
Normalize the diversity term the same way (d / max_dist) so both terms
are on a consistent [0,1] scale regardless of the distance metric.1 parent a62ffd7 commit 99a53e3
2 files changed
+5
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7624 | 7624 | | |
7625 | 7625 | | |
7626 | 7626 | | |
7627 | | - | |
| 7627 | + | |
7628 | 7628 | | |
7629 | 7629 | | |
7630 | 7630 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | 195 | | |
200 | 196 | | |
201 | 197 | | |
202 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| |||
0 commit comments