feat: configurable scoring hyperparameters (Task 013)#10
Conversation
…fig struct Add scoring hyperparameter fields for configurable retrieval ranking: - ScoringAlpha: Vector similarity weight (default: 0.55) - ScoringBeta: Activation weight (default: 0.30) - ScoringGamma: Recency weight (default: 0.10) - ScoringDelta: Confidence weight (default: 0.05) - ScoringPhi: Hub penalty coefficient (default: 0.08) - ScoringKappa: Redundancy penalty coefficient (default: 0.12) - ScoringRho: Recency decay rate per day (default: 0.05) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ng hyperparameters - Parse SCORING_ALPHA (default: 0.55) - vector similarity weight - Parse SCORING_BETA (default: 0.30) - activation weight - Parse SCORING_GAMMA (default: 0.10) - recency weight - Parse SCORING_DELTA (default: 0.05) - confidence weight - Parse SCORING_PHI (default: 0.08) - hub penalty coefficient - Parse SCORING_KAPPA (default: 0.12) - redundancy penalty coefficient - Parse SCORING_RHO (default: 0.05) - recency decay rate per day All values validated to be >= 0 with proper error handling. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update validation for scoring weight parameters (alpha, beta, gamma, delta) to enforce range [0, 1] instead of just >= 0. Penalty coefficients (phi, kappa) and decay rate (rho) remain validated as >= 0 since they don't have a natural upper bound. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…accept config - Add import for mdemg/internal/config package - Update ScoreAndRank signature to accept cfg config.Config parameter - Replace hardcoded hyperparameters with config values (cfg.ScoringAlpha, etc.) - Update comment to indicate values come from config Note: service.go will be updated in subtask-2-2 to pass s.cfg to ScoreAndRank Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…E.md Added documentation for 7 scoring hyperparameters to the Environment Variables table: - SCORING_ALPHA (0.55) - Vector similarity weight - SCORING_BETA (0.30) - Activation weight - SCORING_GAMMA (0.10) - Recency weight - SCORING_DELTA (0.05) - Confidence weight - SCORING_PHI (0.08) - Hub penalty coefficient - SCORING_KAPPA (0.12) - Redundancy penalty coefficient - SCORING_RHO (0.05) - Recency decay rate per day Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… behavior Verification Results: - internal/retrieval: PASS (all scoring-related tests pass) - internal/api: PASS - internal/learning: PASS - internal/anomaly: PASS Note: Pre-existing failure in internal/embeddings/cache_test.go (TestCachedEmbedder/cache_eviction_behavior_with_CachedEmbedder) confirmed to exist on main branch - unrelated to scoring changes. All tests in packages modified by this task pass. Configurable scoring hyperparameters with defaults preserve behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughAdds seven configurable scoring hyperparameters to config and threads them into the retrieval scoring pipeline by replacing hardcoded constants with values read from environment variables (SCORING_*), plus settings and docs updates. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
- Update status: 14 PRs merged (#1-12) - Add PRs 9-12 to task table (Tasks 012-015) - Document new features: - Request Logging Middleware (PR #9) - Configurable Scoring Hyperparameters (PR #10) - Memory Stats Endpoint (PR #11) - Memory Archive/Delete Endpoints (PR #12) - Add new environment variables (SCORING_*, LOG_*) - Update Key Files Reference with new files - Mark Tasks 016, 017 as in-progress Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Exposes the 7 scoring hyperparameters as configurable environment variables, enabling tuning without code changes.
Changes:
ScoringConfigstruct tointernal/config/config.gowith validationScoreAndRank()to accept config instead of hardcoded valuesservice.goto pass scoring config through the retrieval pipelineNew Environment Variables
SCORING_WEIGHT_VECTORSCORING_WEIGHT_ACTIVATIONSCORING_WEIGHT_RECENCYSCORING_WEIGHT_CONFIDENCESCORING_PENALTY_HUBSCORING_PENALTY_REDUNDANCYSCORING_RECENCY_DECAYScoring Formula
Test Plan
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.