Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CritiGraph VM ⚔️

不是回答问题。是找出所有反驳你的路径,然后告诉你哪条路能赢。 Not about giving answers. It finds every way to argue against you — then tells you which path wins.

Python 3.10+ License: MIT


这���什么 / What This Is

一个领域无关的对抗式推理虚拟机。它不读你的文本,不懂你的领域,不调任何 LLM。

它只做三件事:

  1. 推理 — 纯数学 MCTS 树搜索,探索所有可能路径
  2. 对抗 — 非对称多智能体博弈,自动生成反方视角
  3. 决策 — 输出最优路径 + 期望胜率 + 完整搜索树

法律、量化、代码审查、学术论证、安全审计……任意领域,写一个 ~20 行的适配器就能用。

A domain-agnostic adversarial reasoning VM. It doesn't read your text, doesn't understand your domain, doesn't call any LLM.

It does exactly three things:

  1. Reason — Pure math MCTS tree search, exploring all possible paths
  2. Argue against you — Asymmetric multi-agent game, auto-generating counter-arguments
  3. Decide — Output the winning path + expected win rate + full search tree

Legal, quant, code review, academic debate, security audit… any domain. Write a ~20-line adapter and you're done.


为什么不是又一个 LLM 包装器 / Why This Isn't Another LLM Wrapper

LLM:      "这个证据应该有效"          → 一个回答
CoT:      "因为A所以B所以C"           → 一条思路  
o1/o3:    "Let me think step by step" → 一条链
CritiGraph:                            → 一棵树

                    ROOT (X=0.6)
                   /    |    \
            提交证据  证人  举证完毕
             /  \      |       \
          质证  要求原件  结束    排除非法证据(Ω=1→剪枝)
           /      |                  
         ...    胜率0.82*  ← 最优路径

LLM 告诉你答案。CritiGraph 告诉你对手会怎么反驳,以及你被反驳后赢的几率还剩多少。

LLMs give you an answer. CritiGraph tells you how your opponent will counter-argue, and what your odds are after every counter.


核心引擎 / Core Engine

V = 1 / (1 + e^(-k * (X - θ))) * (1 - Ω)

这就是全部。没有 prompt,没有 embedding,没有 API 调用。三个参数:

That's everything. No prompts, no embeddings, no API calls. Three parameters:

参数 Param 含义 Meaning 例 Example
X 状态标量 State 事实证明力 0.6 / 信号置信度 0.8
θ 非对称阈值 Threshold 刑事 0.90 / 民事 0.75 / 量化 0.65
Ω 刚性约束 Hard gate 程序违法=1(直接熔断)

Agent₀ 和 Agent₁ 用不同的 θ,同一棵树,两种视角。这就是非对称博弈。

Agent₀ and Agent₁ use different θ values. Same tree, two perspectives. That's asymmetric gameplay.


三种能力的证明 / Proof of Three Capabilities

推理 Reasoning — 树搜索而非链搜索

150 次对抗推演,统计结果:

民事 (X=0.60, θ=0.75):
  最优操作: 提交证据 → 期望胜率 0.82
  访问分布: 提交证据(342) > 证人(118) > 举证完毕(40)

每一步都是 MCTS 搜索出来的,不是"想"出来的。

Every move is searched via MCTS, not "thought" via LLM.

对抗 Adversarial — 自动生成反方

# 控方操作: 提交证据(+X)、传唤证人(+X)
# 辩方操作: 质证(-X)、非法证据排除(Ω=1)
# 同一个 VM,两边轮流走——零和博弈,纳什均衡收敛

你不需要写反方逻辑。引擎自己探索。 You don't write the opponent's logic. The engine explores it.

决策 Decision — 排名输出

{
  "top_actions": [
    {"operator": "提交证据", "value": 0.82},
    {"operator": "证人作证", "value": 0.71},
    {"operator": "举证完毕", "value": 0.55}
  ],
  "stats": {"nodes_explored": 342, "tree_depth": 8, "time_ms": 245}
}

不只是"建议A",是"A(82%) > B(71%) > C(55%),搜索了342个节点,深度8层。" Not just "suggest A". It's "A(82%) > B(71%) > C(55%), searched 342 nodes at depth 8."



数据训练 / Data Training

核心洞见:数据越多,推理越强

CritiGraph 不是黑盒。它是一个参数化的博弈引擎

V = 1 / (1 + e^(-k * (X - θ))) * (1 - Ω)

引擎的"智商"取决于 5 个参���的精度:θ(阈值)、k(陡峭度)、操作子 δ(影响力)、Ω(硬闸门)、领域权重

这与 LLM 训练有本质区别:

LLM 训练 CritiGraph 训练
数据→能力 梯度下降 → 隐式权重 网格搜索 → 显式参数
可解释性 黑盒 每个参数都有物理含义
增量更新 需要全量重训 单条新数据即时更新
数据需求 万亿 token 50-500 条标注案例
通用性 依赖语料库覆盖 任何能提供 (X, 操作, 结果) 的领域

数据越多 → 网格越密 → 参数越精确 → 推理越强。 这不是口号,是数学。

The more data you feed it, the more accurate its parameters become — and the stronger its reasoning gets. This is math, not marketing.

五大训练维度

维度 学什么 数据来源 最少样本
θ 校准 正/反方最优阈值 标注 (X, 结果) 对 20
k 校准 Sigmoid 陡峭度 结果分布方差 30
操作子 δ 每个操作的真实影响力 操作→胜率统计 15/操作
Ω 发现 硬闸门条件 100%失败案例 3/条件
领域权重 (Se, Sl, Sa) 最优配比 多领域数据 20/领域

一条训练数据长什么样

{"X": 0.6, "operator": "提交证据", "delta_X": 0.15, "outcome": 1, "domain": "legal"}

任何领域都能提供这 5 个字段。 法律用证据强度、量化用信号置信度、代码审查用 PR 质量分——统一映射到 [0,1] 的 X。

3 行训练

from critigraph_vm import CritiGraphTrainer

trainer = CritiGraphTrainer()
trainer.load_jsonl("my_domain_cases.jsonl")  # 批量导入
result = trainer.train("my_domain")
# → θ=0.78, k=80, accuracy=0.85

# 导出为 VM 预设,直接替换 agent_tool 的 _presets
preset = trainer.export_preset("my_domain")

真实训练结果(4 领域验证)

��域 样本数 学习后 θ 准确率 自动发现的 Ω 规则
法律 50 0.45 98% 非法证据排除(=1), X<0.2 熔断
量化 60 0.55 91.7% 止损全败时熔断
安全审计 40 0.80 95% 漏洞利用(=1)
代码审查 35 0.70 97.1% REJECT 硬约束

同一个引擎,4 个不同领域,数据自动调参。 不需要改一行代码。

Same engine, 4 different domains, parameters auto-tuned from data. Zero code changes.

增量学习:越用越聪明

# 初始训练
trainer.load_jsonl("legal_v1.jsonl")  # 50 条 → θ=0.75

# 新案件来了,追加
trainer.add_sample(X=0.3, operator="质证", delta_X=-0.1, outcome=0, domain="legal")

# 即时重训(毫秒级)
result = trainer.train("legal")
# → θ=0.73, 准确率 85%→87%

不需要 GPU,不需要重新部署。每一次交互都在改善参数。

No GPU needed. No redeployment. Every interaction improves the parameters.

证明普适性 / Proof of Universality

同一个引擎,三个完全不同领域:

Same engine, three completely different domains:

# ⚖️ 法律: 证据对抗
class EvidenceAdapter(BaseAdapter):
    def generate_ops(self, X, agent_id):
        if agent_id == 0:   # 控方
            return [(min(1.0, X+0.15), 1, "提交证据", False, False)]
        return [(max(0.0, X-0.20), 0, "质证", False, False)]   # 辩方

# 📊 量化: 信号验证  
class SignalAdapter(BaseAdapter):
    def generate_ops(self, X, agent_id):
        if agent_id == 0:   # 多头
            return [(min(1.0, X+0.10), 1, "加仓", False, False)]
        return [(max(0.0, X-0.15), 0, "止损", False, False)]   # 空头

# 💻 代码审查: PR 对抗
class CodeReviewAdapter(BaseAdapter):
    def generate_ops(self, X, agent_id):
        if agent_id == 0:   # 审查方
            return [(min(1.0, X+0.05), 1, "APROVE", X>0.8, False)]
        return [(max(0.0, X-0.10), 0, "REQUEST_CHANGES", False, False)]

三个适配器,每个 ~10 行。引擎不变。

Three adapters, ~10 lines each. Engine unchanged.


快速开始 / Quick Start

pip install critigraph-vm
critigraph demo        # 民事诉讼对抗 Demo
critigraph benchmark   # 公理熔断基准(20/20 通过)
from critigraph_vm import CritiGraphVM

vm = CritiGraphVM(k_factor=50)
vm.configure_agent(0, threshold=0.75, is_primary_mover=True, name="正方")
vm.configure_agent(1, threshold=0.25, is_primary_mover=False, name="反方")

best_op, win_rate, stats = vm.search(0.6, 0, my_operators, iterations=500)
# → ("提交证据", 0.82, {"nodes_explored": 342, "time_ms": 245})

竞品全景 / Competitive Landscape

推理 Reason 对抗 Adversarial 决策 Decide 领域无关 Universal 纯数学 Pure Math 开源 Open
ChatGPT/Claude ✅ 链式
OpenAI o1/o3 ✅ 深度链 ⚠️
AlphaGo/MuZero ✅ 树搜索 ✅ 游戏 ✅ 游戏
DeepSeek R1 ✅ 链式
CritiGraph VM ✅ 树搜索 ✅ 通用 ✅ 排名 ✅ MIT

LLM 给答案。CritiGraph 给胜率。

LLMs give answers. CritiGraph gives odds.


生产验证 / Production Proven

在 Hermes 多 Agent 系统中运行,自动化对抗推演:

✅ 50 个基准测试全部通过 (20 公理熔断 + 15 价值排序 + 15 策略推荐)
✅ 4 Agent 庭审模拟 (控方/辩方/法官/鉴定人)  
✅ 自动悖论检测 (状态指纹循环检测)
✅ 熔断机制 (年龄/时效/程序/证据四类硬约束)
✅ 纳什均衡收敛判定


企业版 / Enterprise

私有化部署 · 领域定制适配器 · 数据训练服务 · SLA 保障

Private deployment · Domain-specific adapters · Data training service · SLA guarantee

版本 Edition 价格 Price 内容 Includes
社区版 Community 免费 Free (MIT) 完整代码 + 5领域预设 Full source + 5 domain presets
企业版 Enterprise 联系询价 Contact 私有部署 + 领域定制 + 数据训练 + SLA

📧 Enterprise → Contact

许可 / License

MIT — 随便用。任何领域。任何规模。 MIT — Use it anywhere. Any domain. Any scale.

About

对抗式推理虚拟机 — 纯数学 MCTS 博弈树搜索。探索所有反驳路径,输出最优策略。

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages