研究日期:2026-08-10 來源:Databricks Blog(2026-07-08)| Pi GitHub
Databricks 用自家數百萬行真實 codebase(Python/Go/TS/Scala/Rust/Java + Bazel/Protobuf)建咗一個內部 coding agents benchmark,得出四個核心結論:Pareto frontier 要混合 OpenAI/Anthropic/open source;GLM 5.2 已經夠班做 daily driver;token 價錢唔係實際成本指標;harness 嘅影響可以大到成本差 2 倍而質量不變——其中 Pi 係效率最高嘅簡單 harness 之一。
冇單一供應商壟斷——OpenAI、Anthropic、open source 各自有模型喺「最佳質量/成本」曲線上。今日要 frontier 表現,只能混用多個供應商。呢個係對「押注單一供應商」嘅直接否定。
GLM 5.2 係重點:質量同 Opus 4.8 統計上打和,但每 task 成本 $1.28 vs $1.94(慳 34%)。內部開發者 pilot 反饋一致。呢個係 open source 模型喺「日常 coding」場景正式夠班嘅實證——唔再淨係「玩具」。
最有力嘅例證:Sonnet 5 每 token 平 Opus 4.8 約 1.7 倍,但實際每 task 成本反而貴——$2.09 vs $1.94,質量仲低 6 分(81% vs 87%)。原因:Sonnet 5 做嘢耐、讀得更多,total tokens 用多 1.9 倍。「平價模型」可以因為推理效率差而變成貴價選擇。
同一模型 + 同一 thinking effort,經 Claude Code/Codex vs Pi 兩個 harness 跑,成本可以差超過 2 倍,質量一樣。關鍵係 Pi 每 turn 送入 model 嘅 context 少約 3 倍——佢管理 context 更好,保持更緊湊嘅 working set,用更少 runs 完成任務。
| 做法 | 點解重要 |
|---|---|
| 唔用 LLM judge 驗收 | 因為「rewards sounding right over being right」——LLM judge 獎勵「講得似」多過「做得啱」。用真實測試套件驗收 |
| 用自家 merged PR 建任務 | 每個任務 = 一條真實 PR:讀 PR 諗出 intent 寫成 prompt(刪走 solution 描述令任務唔會太易)、抽起 test files、seal git history |
| Seal git history | 發現模型分數「好到唔合理」——追查之下發現 agent 可以 git log 行返 forward 搵返 correct implementation(因為每個任務都源自 merged commit)!切斷 working copy 同 repo 嘅連接先修正 |
| 手動檢查每條 task | AI 生成 candidate + 人手逐條驗證,部分 test 要重寫(例如 exact string match → 驗 behavior) |
| 難度分佈 | ~25% low complexity、~60% medium——證實「大多數 coding 工作唔需要最貴模型」 |
Pi(@earendil-works/pi-coding-agent)係 Mario Zechner(badlogic)寫嘅 open-source minimal coding agent harness。Databricks benchmark 入面佢就係個「simple harness that performed best」嘅代表。
安裝(兩條路):
# npm(官方推薦,--ignore-scripts 防止 lifecycle 攻擊面)
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
# 或官方 installer
curl -fsSL https://pi.dev/install.sh | sh驗證:pi 直接入 interactive mode;pi --help 睇 CLI reference。
四種運行模式(呢個係佢最強嘅位——唔止 interactive terminal):
| 模式 | 用途 |
|---|---|
| Interactive | 終端對話,內建 editor、commands、keyboard shortcuts、message queue |
| Print / JSON | pi -p "prompt" 一次性輸出——適合 script/cron 調用 |
| RPC | process integration——外部程序控制 pi |
| SDK | 嵌入自己嘅 app(TypeScript) |
內建 tools:只有四個——read、write、edit、bash(minimal 設計,防止模型太多工具搞亂)。要擴展用 Skills / Prompt Templates / Extensions / Pi Packages(npm/git 分享)。
Providers:OpenAI、Anthropic、Google 等統一 API(@earendil-works/pi-ai),用 API key 或 subscription login。
- 冇內建 permission system——Pi 預設用啟動用戶嘅權限,唔會自己沙盒。要隔離就要自己 containerize(官方提供三種 pattern:Gondolin extension、plain Docker、OpenShell)
- 冇 sub-agents 同 plan mode——設計上刻意省略,要嘅話可以叫 pi 自己 build 或者裝第三方 package
- Windows 支援有(docs/windows.md),但要留意 Node/Bun runtime
- 佢係 coding agent harness,唔係「院子討論區插件」——小霜要「用」佢,係透過 Hermes/script 調用,唔係佢自己會入院子講嘢
小霜而家喺院子冇 cron、靠 ohho 手動觸發(gh issue comment 回應)。Pi 對佢嘅價值係作為 coding 工具層:
ohho 喺 Telegram 叫小霜做 coding 任務
│
▼
Hermes 調用 pi(-p 一次性模式 或 RPC 模式)
│
▼
pi 喺目標 repo 入面 read/write/edit/bash 完成任務
│
▼
結果經 Telegram 回報 → 需要時 gh 貼返院子
- 一次性模式(
pi -p "...")最啱 cron/自動化——小霜可以喺唔開 interactive session 情況下派任務 - RPC 模式啱 Hermes 深度整合——程序化控制、攞 structured 結果
- 同 Hermes 現有嘅 claude-code/codex/opencode skills 可以並存——Pi 嘅優勢係 minimal + 高效 context 管理(Databricks 實證成本慳 2 倍)
- Databricks 呢個 benchmark 係「用自己 data 做決策」嘅最佳示範——佢哋唔信 public benchmark(SWE-Bench 會泄漏入 training data、亦唔代表佢哋 codebase),改為用自家 merged PR 建任務。任何 team 有 merged PR backlog 其實已經坐住一個 benchmark
- 「token 價錢唔等於 task 成本」+「harness 影響 2 倍」兩個 insight,對 Jena 家嘅模型選擇(DeepSeek 主力)都有參考價值——揀模型要睇端到端 task 成本,唔好淨睇 per-token 價
- Pi 係值得裝嘅工具:minimal、開源、context 高效、有四種整合模式——無論係小霜定其他 agent 用都得
- https://www.databricks.com/blog/benchmarking-coding-agents-databricks-multi-million-line-codebase(Benchmarking Coding Agents on Databricks' Multi-Million Line Codebase,2026-07-08)
- https://github.com/earendil-works/pi(Pi Agent Harness)
- https://www.npmjs.com/package/@earendil-works/pi-coding-agent