Phase 1 & 2: Baseline experiments + AGoT implementation + reasoning graph analysis

## Added

### Core framework
- src/llm_client.py — Ollama API wrapper for local Docker inference
- src/samples.py — Embedded benchmark datasets (GSM8K/MATH/AIME + Chinese)
- src/run_all.py — Unified experiment runner

### Phase 1: Baselines
- src/baseline/benchmark.py — IO, CoT, CoT-SC, ToT evaluation with Chinese support

### Phase 2: AGoT
- src/agot/agot.py — AGoT core algorithm (6 agent types, recursive decomposition)
- src/agot/graph_utils.py — DAG graph data structure with cycle detection
- src/agot/prompts.py — 6 agent prompt templates (EN + ZH)
- src/agot/run.py — AGoT experiment runner

### Graph Analysis
- src/graph_analysis/reasoning_graph.py — Graph property computation (cyclicity, diameter, small-world)
- src/graph_analysis/visualize.py — Visualization charts

### Documentation
- docs/graph_reasoning_principles.md — Comprehensive principles document
- docs/next_steps.md — Roadmap for reliable reasoning tool

### Experiment Results
- GSM8K/MATH baselines on qwen2.5:32b and qwq:latest
- AGoT validation (100% on small sample)
- Chinese dataset benchmarks (C-GSM8K, CMATH)
- Graph property analysis confirming Topology of Reasoning findings
This commit is contained in:
cat
2026-07-03 22:23:42 +08:00
parent aa8ba6a6d7
commit d84f98799b
37 changed files with 4880 additions and 0 deletions
+85
View File
@@ -0,0 +1,85 @@
# 下一步工作计划:构建可靠推理工具
> 目标:基于图增强推理的研究成果,构建一个让小型 LLM 也能
> 可靠作答、不犯错的实用工具。
---
## 当前进展总结
我们已经完成:
- ✅ 5 篇核心论文的可行性分析
- ✅ AGoT 核心算法实现 + 验证
- ✅ 基线评测框架(IO/CoT/CoT-SC/ToT
- ✅ 推理图属性分析工具
- ✅ 初步实验数据(GSM8K/MATH/中文支持)
## 核心发现
1. **AGoT 有效**:在样本测试中达到 100%vs CoT 80%
2. **图属性与能力相关**:推理模型的图属性(循环、直径、小世界)更强
3. **主要瓶颈是计算成本**AGoT 需要 ~7x CoT 时间
## 下一步建议
### 选项 A:构建"可靠推理器"工具(推荐)
将 AGoT 包装为实用工具,核心思路是**分级推理 + 内置验证**:
```
输入问题
├─ 快速通道 (IO) → 简单问题 < 1秒
│ └─ 置信度 < 阈值?
│ └─→ 标准通道 (CoT) → 中等问题 < 30秒
│ └─ 置信度 < 阈值?
│ └─→ 深度通道 (AGoT) → 困难问题 < 3分钟
│ └─ 验证器检查答案
│ └─ 不一致?重新推理
└─ 输出: 答案 + 推理图 + 置信度
```
**关键组件**
- 置信度估计(基于推理图的节点评分聚合)
- 验证器 Agent(独立验证答案正确性)
- 图可视化(人类可读的推理过程)
### 选项 B:扩大实验规模
在更多数据上验证 AGoT 的效果:
| 实验 | 说明 | 预期耗时 |
|------|------|---------|
| GSM8K 完整 200 样本 | 统计显著对比 | ~1.5 小时 |
| MATH 完整 500 样本 | 竞赛数学验证 | ~5 小时 |
| 跨模型测试 | qwq + AGoT | ~3 小时 |
| CMATH 完整中文 | 中文数学对比 | ~2 小时 |
### 选项 C:图感知 SFT 训练(Phase 3
用 AGoT 生成的高质量推理轨迹训练模型,使其在普通 CoT 下也能展现图结构推理:
1. 用 AGoT 在验证集上生成推理轨迹
2. 只保留回答正确的轨迹(自蒸馏)
3. 用 LoRA 微调 Qwen2.5-32B
4. 验证微调后推理图属性的变化
## 建议优先级
```
立即:
构建"可靠推理器"MVP
├─ 置信度估计模块
├─ 验证器 Agent
└─ 分级推理调度器
本周:
在完整 GSM8K 上验证
加入中文数学完整测试
下阶段:
AGoT 自蒸馏 + LoRA 微调
多模型图聚合推理
```