Nurcholish commited on
Commit
3eb5c38
·
verified ·
1 Parent(s): 2f19517

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +174 -3
README.md CHANGED
@@ -1,3 +1,174 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ ---
4
+ # Quantum-Scaling RL Hybrid Agent
5
+
6
+ A self-improving hybrid agent that integrates quantum optimization with reinforcement learning for multilingual semantic graph editing.
7
+
8
+ ## Quick Start
9
+
10
+ ```python
11
+ from quantum_scaling_rl_hybrid import QuantumScalingRLHybrid, QuantumRLConfig
12
+
13
+ # Initialize agent
14
+ config = QuantumRLConfig(backends=['ibm', 'russian'])
15
+ agent = QuantumScalingRLHybrid(config)
16
+
17
+ # Run edit cycle
18
+ result = agent.run_edit_cycle(edit, corpus)
19
+ print(f"Performance: {result.performance_delta:.3f}")
20
+ ```
21
+
22
+ ## Run Demo
23
+
24
+ ```bash
25
+ # Simple demo (no quantum dependencies)
26
+ python agent/demo_quantum_scaling_rl_simple.py
27
+
28
+ # Full demo (requires qiskit)
29
+ pip install qiskit qiskit-machine-learning
30
+ python agent/demo_quantum_scaling_rl.py
31
+
32
+ # Visualization demo
33
+ python agent/visualizations/demo_all_visualizations.py
34
+ ```
35
+
36
+ ## Architecture: 5-Stage Pipeline
37
+
38
+ 1. **Quantum Optimization** - QAOA traversal, QSVM hallucination detection, QEC correction
39
+ 2. **RLHF Adaptation** - KL-regularized PPO, backend selection learning
40
+ 3. **ScalingRL Budgeting** - Batch sizing (∝ √model_size), reward shaping, compute tracking
41
+ 4. **Feedback Loop** - Reflector, curator, RL retraining
42
+ 5. **Benchmarking & Visualization** - Performance metrics and visual analytics
43
+
44
+ ## Key Features
45
+
46
+ - ✅ Self-improving: Learns optimal backends per language
47
+ - ✅ Multilingual: Adapts strategies for each language (ru, zh, es, fr, en)
48
+ - ✅ Compute-efficient: Optimizes batch sizes and resources
49
+ - ✅ Benchmarking: Tracks IBM vs Russian backend performance
50
+ - ✅ **NEW**: Comprehensive visualization suite (4 modules, 11 charts)
51
+
52
+ ## Visualization Modules
53
+
54
+ **Location**: `agent/visualizations/`
55
+
56
+ 1. **Backend Performance Comparison** - IBM vs Russian backend analysis
57
+ 2. **Reward vs Batch Size Scaling** - Validates batch_size ∝ √(model_size)
58
+ 3. **Cross-Lingual Backend Preference** - Language-specific backend preferences
59
+ 4. **Performance Trend Over Edit Cycles** - Learning curves and improvement tracking
60
+
61
+ ```bash
62
+ # Generate all visualizations
63
+ cd agent/visualizations
64
+ python demo_all_visualizations.py
65
+ # Output: 11 high-resolution PNG charts in output/ directory
66
+ ```
67
+
68
+ ## Files
69
+
70
+ ### Core Implementation
71
+ - `quantum_scaling_rl_hybrid.py` - Main implementation (450+ lines)
72
+ - `demo_quantum_scaling_rl_simple.py` - Simple demo (tested & working)
73
+ - `demo_quantum_scaling_rl.py` - Full demo (requires qiskit)
74
+ - `test_quantum_scaling_rl.py` - Test suite (13 tests)
75
+
76
+ ### Visualization Modules
77
+ - `visualizations/Backend_Performance_Comparison.py`
78
+ - `visualizations/Reward_vs_BatchSize_Scaling.py`
79
+ - `visualizations/Cross_Lingual_Backend_Preference.py`
80
+ - `visualizations/Performance_Trend_Over_Edit_Cycles.py`
81
+ - `visualizations/demo_all_visualizations.py`
82
+
83
+ ### Documentation
84
+ - `QUANTUM_SCALING_RL_ARCHITECTURE.md` - Complete 5-stage architecture
85
+ - `QUANTUM_SCALING_RL_HYBRID_DOCUMENTATION.md` - Full technical docs
86
+ - `QUANTUM_SCALING_RL_QUICK_REFERENCE.md` - Quick reference
87
+ - `QUANTUM_SCALING_RL_IMPLEMENTATION_SUMMARY.md` - Implementation summary
88
+
89
+ ## Demo Results
90
+
91
+ ```
92
+ Total Edits: 15
93
+ Performance Trend: improving
94
+
95
+ Backend Performance:
96
+ ibm: Mean Reward: 0.807 ± 0.022
97
+ russian: Mean Reward: 0.825 ± 0.024
98
+
99
+ Learned Heuristics:
100
+ ru: Preferred Backend: ibm (0.807)
101
+ zh: Preferred Backend: russian (0.814)
102
+ es: Preferred Backend: russian (0.853)
103
+ fr: Preferred Backend: russian (0.842)
104
+ en: Preferred Backend: russian (0.803)
105
+ ```
106
+
107
+ ## Performance Metrics
108
+
109
+ ### Quantum Metrics
110
+ - QAOA Coherence: 0.6-0.9
111
+ - QEC Logical Error: 0.001-0.01
112
+ - QSVM Valid Prob: 0.7-0.95
113
+
114
+ ### RL Metrics
115
+ - Final Reward: 0.75-0.88
116
+ - Edit Reliability: 0.99-1.0
117
+ - KL Penalty: 0.0-0.01
118
+
119
+ ### Scaling Metrics
120
+ - Compute Efficiency: 6-11 reward/sec
121
+ - Optimal Batch Size: 8-16
122
+ - Performance Trend: Improving
123
+
124
+ ## Dependencies
125
+
126
+ ```bash
127
+ # Core (required)
128
+ pip install numpy
129
+
130
+ # Visualization (required for charts)
131
+ pip install matplotlib
132
+
133
+ # Quantum (optional, for full functionality)
134
+ pip install qiskit qiskit-machine-learning torch transformers
135
+ ```
136
+
137
+ ## Integration
138
+
139
+ ### With Quantum Modules
140
+ - `qaoa_traversal.py` - Semantic graph optimization
141
+ - `qsvm_hallucination.py` - Hallucination detection
142
+ - `repair_qec_extension.py` - Error correction
143
+
144
+ ### With RLHF System
145
+ - `rlhf/reward_model.py` - Reward model manager
146
+ - `rlhf/rl_trainer.py` - RL training config
147
+
148
+ ### With Scaling Laws
149
+ - `scaling_laws/scaling_measurement_framework.py` - Scaling analysis
150
+
151
+ ## Usage with Visualizations
152
+
153
+ ```python
154
+ from quantum_scaling_rl_hybrid import QuantumScalingRLHybrid
155
+ from visualizations.Backend_Performance_Comparison import plot_backend_performance_comparison
156
+
157
+ # Run agent
158
+ agent = QuantumScalingRLHybrid()
159
+ for i in range(30):
160
+ result = agent.run_edit_cycle(edit, corpus)
161
+
162
+ # Get statistics
163
+ stats = agent.get_statistics()
164
+
165
+ # Visualize results
166
+ plot_backend_performance_comparison(
167
+ stats['backend_performance'],
168
+ 'backend_comparison.png'
169
+ )
170
+ ```
171
+
172
+ ## License
173
+
174
+ MIT License