Newshot

System 1 Agents——一种本地、可靠、快速的智能体 AI 方法

Translation(model translation, not the source's own text)
题图
题图

无需文本生成的本地、可靠且快速的智能体 AI

“System 1 agents: a method for local, reliable and fast agentic AI”的代码、数据和结果

引用 · 许可证

什么是 System 1 智能体?

System 1 智能体调用工具时不生成文本。确定性编译器将工具的 JSON schema 和用户请求转换为带类型的多选题:哪个工具、每个参数取哪个值、列表中的下一项是哪个。决策模型在一次前向传播中,为每个选项给出概率来回答每个问题。代码负责控制流并组装调用,因此每个工具名、参数名和值都来自目录、schema 或请求:模型判断;代码组装。

智能体会拒绝没有工具能完成的请求,并询问请求未给出的必需值,而不是凭空编造。每个问题和答案都可以存储,因此一次运行可以逐决策审计和重放。


        flowchart TD
    U[User request] --> A[System 1 agent]
    C[MCP tool catalogue<br/>tool descriptions + JSON schemas] --> A
    A --> T{Choose tool or decline}
    T -->|Tool selected| F{Capability check}
    T -->|None of these| X[Decline request]
    F -->|Not supported| X
    F -->|Supported| P[Deterministic compiler]
    U --> P
    C --> P
    P --> Q[Finite-choice questions<br/>for each argument]
    Q <--> D[Local decision model<br/>option probabilities]
    Q --> V{Required values available?}
    V -->|No| M[Prompt user using<br/>schema-derived template]
    M --> P
    V -->|Yes| E[Assemble schema-grounded<br/>MCP tool call]
    E --> R[Execute tool / record result]
    R --> S{Another step needed?}
    S -->|Yes| A
    S -->|No| Z[End]
    D --> T
    D --> F
      

智能体、编译器和决策模型后端如何工作,以及它们是如何开发的:docs/ARCHITECTURE.md。

关键结果

在来自 18 个医学影像和生物医学服务器的 157 个 MCP 工具(评估集)上,将六个 System 1 智能体与九个本地 LLM 智能体进行比较,每个 LLM 智能体均开启和关闭推理:

  • 准确率:最佳 System 1 智能体使 93.9% 的请求完全正确,最佳 LLM 智能体为 91.3%。在 108 个 System 1 ×
ToYou need
复现论文结果Python 3.11 或更高版本(使用了 3.12)以及 Node.js(使用了 24;生物医学评分器运行 ClinicalTrials.gov 服务器自带的规范化器)。CPU 即可
运行 System 1 agents此外还需要 llama.cpp 的 llama-server 和一块有足够空间容纳决策模型的 NVIDIA GPU(decider-4b 需要 7.2 GiB;见模型部分)

以下命令适用于 Linux shell;在 Windows 上请使用 WSL。本研究在 Ubuntu 24.04 上运行。

复现论文结果(CPU,几分钟)

此步骤会基于存储的模型回答重建每一次 System 1 调用,对每个 agent 重新评分,并重新生成表格、fabrication 分析、表 1 以及图表。


        git clone https://github.com/eltzanis/SystemOneAgents && cd SystemOneAgents
(cd data && sha256sum -c --quiet SHA256SUMS.txt) && (cd results && sha256sum -c --quiet SHA256SUMS.txt)   # 文件完好
cd code
conda create -n s1agents python=3.12 && conda activate s1agents
pip install -e ".[test,figures]"                     # 使用的确切版本:pip install -r requirements-lock.txt
python -m pytest                                      # 无需 GPU,无需模型

# 重放:基于存储的回答重建每一次 System 1 调用,并与已发布的记录比对
python scripts/replay_s1.py --catalogue ../data/catalogues/imaging_tools.json \
    --data ../data/requests/imaging_test.jsonl ../data/requests/external.jsonl \
    --answers ../results/system1/answers --records ../results/system1/records
python scripts/replay_s1.py --catalogue ../data/catalogues/biomedical_tools.json \
    --data ../data/requests/biomedical_test.jsonl \
    --answers ../results/system1/answers --records ../results/system1/records

# 分析:手稿中的每一张表
python scripts/analyse.py --sensitivity --out runs/analysis

# fabrication 分析(图 4a、扩展数据表 7)
python scripts/fabrication.py --check-sample --out runs/fabrication

# 表 1:System 1 对比 LLM agents,逐类别
python scripts/scorecard.py --out runs/scorecard

# 图表
python scripts/figures.py --out runs/figures
      

每一步应得到的结果:

步骤预期
校验和无输出
测试61 项通过,3 项跳过(这三项需要 decider-35b-a3b 的分词器文件)
重放对于六个模型中的每一个,所有请求完全一致,且 0 条缺失回答(1,179 条 imaging、123 条 external、824 条 biomedical)
分析runs/analysis/metrics.json 与 results/analysis/metrics.json 相同;在 tables.md 中,108 对请求中完全正确的请求数为:73 项 System 1 领先,11 项 LLM 领先,24 项无显著差异
fabrication、表 1diff -r runs/fabrication ../results/fabrication 与 diff -r runs/scorecard ../results/scorecard 均无输出
图表runs/figures/figure_data.json 与 figures/figure_data.json 相同。在安装了绘制时所用的字体后(见下文),PNG 与 figures/ 中的文件逐字节一致

图表是使用 Liberation Sans 和 Liberation Mono 2.1.5 以及 URW Nimbus Sans 绘制的,这些字体在本研究的 Ubuntu 24.04 桌面上已安装。如果没有这些字体,matplotlib 会回退到其他字体:绘制的数值保持不变,但字体不同,因此 PNG 文件会不同。在最小化的 Ubuntu 22.04(例如 WSL)上,执行 sudo apt install fonts-liberation2 fonts-urw-base35 后得到了逐字节一致的 PNG。

要让编码 agent 运行并检查以上全部内容,请在 Claude Code 中打开仓库,并要求它复现结果:它使用 reproduce-results skill。

为你的自有工具构建 System 1 agent

1. 安装


        cd code
pip install -e .
      

2. 获取 llama.cpp 和决策模型

agent 从 llama.cpp 的 llama-server 读取其决策模型。本研究使用了版本 b11929;code/README.md 给出了下载命令和校验和。其路径在 code/configs/models.yaml 顶部设置(llama_server、cuda_libs):改为你自己的构建即可。

文章标题:System 1 Agents – a method for local, reliable and fast agentic AI

正文: 研究中的六个决策模型,全部未经微调使用(在研究用的 GPU 上、按评估集测量):

--model模型完全正确率每请求秒数峰值 GPU 内存
decider-4bdecider 4B81.4%1.27.2 GiB
pplx-decider-flashPerplexity pplx-decider-flash 4B89.8%4.612.0 GiB
decider-35b-a3bdecider 35B-A3B(混合专家)86.7%2.222.9 GiB
openjevOpenJev92.9%2.621.3 GiB
clefCloudflare Clef 27B91.1%3.130.4 GiB
pplx-decider-27b-embedPerplexity pplx-decider 27B93.9%10.134.2 GiB

decider-4b 最容易上手尝试;OpenJev 和 pplx-decider-27b 最为准确。请在每个模型的模型卡上查看其许可证:OpenJev 为 CC-BY-NC-4.0(非商业),Perplexity 的模型可能需要在 Hugging Face 上接受其条款。

模型文件放到 code/models/<folder>/,文件夹名见 code/configs/models.yaml。对于 decider-4b,在 code/ 目录下执行:


        hf download Mapika/decider-4b-GGUF decider-4b-v3-Q8_0.gguf tokenizer.json tokenizer_config.json decider_config.json \
    --revision d3a78581751d518bbfa9e871a6d84059554d53c5 --local-dir models/decider-4b
sha256sum models/decider-4b/decider-4b-v3-Q8_0.gguf   # d29bda3381301c81d1ecaf8adf2f9df94f724f0179be4ddb11c898f38713ffd0
      

其他模型的来源、修订版本和校验和见 code/README.md。

3. 启动模型的服务端


        s1a serve decider-4b        # llama-server on 127.0.0.1, port from configs/models.yaml; leave it running
      

4. 用研究的工具试一下


        s1a plan "Segment the liver and the spleen in /data/ct/p01.nii.gz" \
    --catalogue ../data/catalogues/imaging_tools.json --model decider-4b
      

plan 会选择一个工具并填充其参数,但不调用任何东西。它会打印每一个决策(问题、首选选项、概率)以及最终得到的调用,并把决策追加到 runs/traces/。

5. 接入你自己的 MCP 服务器

在 YAML 文件中列出你的服务器,格式如 code/configs/servers.example.yaml(每个服务器通过 stdio 启动,需 command、args,可选 cwd 和 env)。然后把它们的工具保存为目录并使用:


        s1a catalog --servers my_servers.yaml --out my_tools.json      # start each server once and save its tools
s1a plan "..." --catalogue my_tools.json --model decider-4b    # dry run: decisions and call, nothing executed
s1a run "..." --catalogue my_tools.json --servers my_servers.yaml --model decider-4b
      

run 会规划调用,向你询问请求中未给出的必需值,请求确认(--yes 跳过确认)并调用工具。--max-steps N 让 agent 在首次调用后继续发起更多调用。--args-model 使用第二个决策模型来处理参数问题。

6. 调整 agent

code/configs/agent.yaml 保存 agent 的设置(用 --settings 传入另一个文件):

设置研究中的取值含义
select_min_conf0.3选择置信度低于此值时 agent 拒绝执行
optional_min_conf0.7只有当 P(请求给出该值) 达到此值时,才设置可选值
list_min_conf0.7列表第一项适用同一阈值
policy_defaultsoutput_dir: "{workspace}/{tool}_{timestamp}"请求未指定的参数的取值;从不展示给模型
workspaceruns/workspace{workspace} 所代表的文件夹

7. 在 Python 中使用


        from s1agent import build_agent

agent = build_agent("decider-4b", "../data/catalogues/imaging_tools.json")   # the model's llama-server must be running
plan = agent.plan("Segment the liver in /data/ct/p01.nii.gz")
if plan.filled is None:
    print("declined: no tool fits, or the selection confidence is below select_min_conf")
else:
    print(plan.selection.tool.name, plan.selection.confidence)
    print(plan.filled.args, plan.filled.missing)   # the call's arguments, and required values the request does not give
      

添加另一个决策模型

llama-server 能通过三种受支持的读出方式之一提供服务的模型,只需在 code/configs/models.yaml 中再增加一项:decider-llamacpp(选项标签的对数概率)、pplx-llamacpp(读出标记处的隐藏状态)或 systemone-llamacpp(llama-server 自带的决策端点)。任何其他模型都需要一个后端:code/src/s1agent/backends/ 中 Backend 的子类,其 _choice(state, question, options, kind) 返回每个选项的概率。lexical.py 是最短的示例。

重新运行实验(GPU)

重新运行 System 1 和 LLM agents 需要 llama.cpp b11929 和模型文件。code/README.md 给出了它们的来源、修订版本和校验和,以及运行命令(scripts/run_s1.py、scripts/run_llm.py)。这些运行使用了一块 NVIDIA RTX PRO 5000 Blackwell(48 GB),系统为 Ubuntu 24.04。

决策模型在相同硬件和构建上对相同问题给出相同答案。在其他硬件上,概率最后几位的小差异可能会改变少数接近的决策:在一项对 117 个请求的检查中,每个模型有 0–2 个判定在研究使用的 GPU 与 RTX 2080 Ti 之间不同。

引用

如果您使用此代码或数据,请引用:

Tzanis, E. & Klontzas, M. E. System 1 agents: a method for local, reliable and fast agentic AI. arXiv:2611.21053 (2026). https://arxiv.org/abs/2611.21053


        @misc{tzanis2026system1,
  title         = {System 1 agents: a method for local, reliable and fast agentic {AI}},
  author        = {Tzanis, Eleftherios and Klontzas, Michail E.},
  year          = {2026},
  eprint        = {2611.21053},
  archivePrefix = {arXiv},
  url           = {https://arxiv.org/abs/2611.21053}
}
      

许可证

  • 代码:Apache License 2.0;参见 LICENSE。
  • code/src/s1eval/data/ 中的第三方代码:ClinicalTrials.gov 和 ChEMBL 归一化器为 Apache-2.0;scikit-learn 停用词表为 BSD-3-Clause。许可证文件位于它们旁边;参见 code/src/s1eval/data/README.md。
  • MCP 服务器:未包含;目录是其工具列表的 JSON 快照。
  • 模型:未再分发。适用每个模型自己的许可证。
  • 外部请求:逐字取自已发布的 mAIstro 和 ReCLAIM notebooks。

作者与联系方式

The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗