feat(fusion): complete learned RRF weights with FitResult, N-retriever grid, bayesian fitting, and save/load (#49) - #223
Merged
codeforstartups merged 1 commit intoSep 19, 2026
Conversation
…r grid, bayesian fitting, and save/load (codeforstartups#49) - Add FitResult dataclass with to_dict(), save(), and load() methods - Fix _fit_grid() to work with 3+ retrievers via simplex discretization - Add _fit_bayesian() method using scipy Nelder-Mead with graceful fallback - Export FitResult from dynavec package - Expand test suite: 5 → 14 tests (grid/random/bayesian, serialization, edge cases) - Update notebook with method comparison, save/load workflow, and 3-retriever demo
shivamm-gupta
force-pushed
the
issue-49-learned-fusion-weights
branch
from
September 19, 2026 02:48
d2665c2 to
b682ffc
Compare
codeforstartups
approved these changes
Sep 19, 2026
codeforstartups
left a comment
Owner
There was a problem hiding this comment.
Rounds out the learned-fusion work from #204 nicely (#49): a FitResult dataclass with JSON save()/load(), N-retriever grid search, and an optional Bayesian (Nelder-Mead on a softmax simplex) method that gracefully falls back to random with a warning when scipy is not installed — good defensive design. Verified locally: ruff clean, 14 fusion tests pass, CI green. Merging — thanks @shivamm-gupta! 🙌
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Completes the Learned Fusion Weights feature by addressing gaps in the original implementation (PR #204). Adds a structured
FitResultreturn type, generalises grid search to N retrievers, introduces bayesian optimisation as a fitting strategy, and provides save/load serialisation for production workflows.Related issue
Closes #49
Changes
FitResultdataclassfit()withweights,score,method, andn_evaluationsfieldsto_dict()for dict conversion,save()/load()for JSON persistencedynavecpackageFixed
_fit_grid()for N retrievers[w1, 1-w1])New
_fit_bayesian()methodscipy.optimize.minimize(Nelder-Mead) on a softmax-parameterised weight simplexrandomsearch with a warning if scipy is not installedUpdated notebook
FitResultinspection examplesTest coverage: 5 → 14 tests
FitResultdataclass fields and return typeTesting
uv run --no-sync pytest -q— all pass)Checklist