Skip to main content

Module graph_weight_optimizer

Module graph_weight_optimizer 

Source
Expand description

Graph Weight Optimization (Simplified DW-GRPO)

This module implements a simplified version of Dynamic Weighted Group Relative Policy Optimization (DW-GRPO) for optimizing relationship weights in the knowledge graph.

Key features:

  • Heuristic-based optimization (not full reinforcement learning)
  • Gradient-free hill climbing for weight adjustment
  • Multi-objective optimization (relevance, faithfulness, conciseness)
  • Stagnation detection and dynamic weight adjustment
  • Performance tracking across iterations

Structsยง

GraphWeightOptimizer
Graph weight optimizer using simplified DW-GRPO approach
ObjectiveWeights
Weights for combining multiple objectives
OptimizationStep
A single optimization iteration with metrics
OptimizerConfig
Configuration for the optimizer
TestQuery
Test query with expected answer for evaluation