Communitygithub.com

Arbor — 透過假設樹優化進行自主優化

透過假設樹細化(HTR)演算法,自主地針對目標與評估器改進實際產出(如程式碼、訓練配方、代理程式架構、資料管線、提示詞)。當需要反覆進行大量實驗以迭代優化,同時避免過度擬合時使用此技能。

Arbor — 透過假設樹優化進行自主優化 是什麼?

這項技能實作了《Arbor》論文(Jin 等人,2026)中提出的**假設樹細化(Hypothesis Tree Refinement, HTR)**演算法,用於執行**自主優化(Autonomous Optimization, AO)**循環。不同於傳統依賴對話歷史的方法,HTR 將研究狀態保存在一個持久的**假設樹**中,每個節點都綁定一個假設、其提煉出的見解,以及驗證該假設的產出版本。此技能適用於需要迭代改進具體產出(如模型訓練配方、代理程式工程、資料合成管線或提示詞系統)且擁有可量化評估指標的情境。關鍵在於,它建立了一個分離的開發評估器(E_dev)與保留的測試評估器(E_test),透過一道**保留合併閘門(held-out merge gate)**來防止過度擬合:只有通過測試評估器驗證的改進才會被採納。該技能支援 Claude Code、Cursor 與 Codex 等平台,透過協調器(coordinator)子代理負責維護樹狀結構與搜尋策略,執行器(executor)子代理則在隔離的 git worktree 中測試單一假設。其工作流程包含六個循環步驟:觀察(Observe)、構思(Ideate)、選擇(Select)、派遣(Dispatch)、反向傳播(Backpropagate)與決策(Decide)。實驗證明,見解的向上抽象與傳播是 HTR 帶來主要效益的關鍵——單純的樹狀層級結構而不帶語義記憶,效果甚至不如平坦的實驗佇列。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/skills/arbor

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Arbor — 透過假設樹優化進行自主優化 是做什麼的?

概述

此技能執行一個**自主優化(Autonomous Optimization, AO)**循環:從現有的產出與可衡量的目標開始,透過多輪實驗與評估來改進它——無需逐步的人工監督,也不會過度擬合回饋訊號。當瓶頸不在於寫出一個好的修改,而在於組織數十次試驗,讓經驗教訓得以累積而非消散時,這正是合適的工具。

它實作了《Arbor》(Jin 等人,2026)中的假設樹細化(Hypothesis Tree Refinement, HTR)。關鍵概念:將研究狀態保存在一個持久的假設樹中,而非對話歷史中。每個節點都綁定一個假設、其產出的提煉見解,以及一個指向實現該假設的產出版本的指標。你扮演長壽的協調者(coordinator),負責擁有這棵樹並決定搜尋方向;短命的**執行者(executor)子代理則在隔離的 git worktree 中各測試一個假設並回報結果。一道保留的合併閘門(held-out merge gate)**僅當某個變更在搜尋過程從未優化過的測試評估器上表現更好時,才允許其被採納。這正是將試誤轉化為可累積、可稽核研究的方法。

使用 scripts/tree.py 狀態管理器進行所有簿記工作(建立節點、撰寫證據、傳播見解、剪枝、合併閘門、觀察投影)。它能保持狀態一致,讓你專注於判斷證據的意義。

何時使用此技能

當任務是在某個評估器下對具體產出進行迭代改進時,請使用 Arbor:

  • 模型訓練:優化器/架構/配方的變更,以降低損失或在更少步驟內達到目標。
  • 框架/代理工程:提高代理循環、搜尋框架或工具使用支架的通過率或準確率。
  • 資料合成:根據下游模型行為來改進生成/過濾管線。
  • 基準測試優化:MLE-bench / Kaggle 風格的「改進提交」任務。
  • 提示詞/系統優化:當你能自動對輸出進行評分時。

其區別性訊號在於:有一個可以修改的產出,一個目標,一個能對候選方案評分的方法,並且你預期要進行大量實驗。如果使用者只需要一次修復或一次性答案,這就小題大作了——直接完成工作即可。如果他們想要的是沒有評估器的開放式構想,請改用 hypothesis-generation 或 scientific-brainstorming。

AO 設定——請先確認此項

在任何實驗之前,請先建立任務元組 (M_0, O, E_dev, E_test)。這比之後的任何決定都更重要,因此請明確確認:

  • M_0 — 初始素材:要改進的產出(一個儲存庫、一個腳本、一個配置、一個提示詞)。確保它在 git 中且目前可執行。
  • O — 目標:自然語言目標和指標方向(最大化準確率?最小化損失/步驟數?)。
  • E_dev — 開發評估器:在搜尋過程中可自由執行以對候選方案評分的指令。快速、可重現。
  • E_test — 保留的測試評估器:一個獨立的評估器(不同的隨機種子、不同的資料分割,或更大規模的執行),僅在合併閘門處使用。決不能用來當作搜尋的預言機——這正是重點。

如果使用者沒有提供乾淨的開發/測試分割,請自行建構一個並告知使用者。開發/測試分離是捕捉過度擬合的機制:一個在開發集上表現良好但在測試集上不佳的候選方案,並非成功,而是一個你正在利用回饋訊號的警訊。沒有它的話,自主搜尋必然會過度擬合。

初始化執行:

python scripts/tree.py init \
  --objective "Improve BrowseComp answer accuracy on the search harness" \
  --dev-eval "python eval.py --split dev --n 50" \
  --test-eval "python eval.py --split test --n 300" \
  --material "." --metric-direction max --branching 3 --max-depth 2 --budget 12

--branching 是每個父節點下要提出的兄弟假設數量;--max-depth 2 將方向限制在深度 1,具體干預措施限制在深度 2(論文的預設值);--budget 是協調者的循環次數。從小規模開始(10–20 個循環)——結構化的搜尋優於暴力法,如果仍有進展,你可以擴展。

協調者循環

你反覆執行六個步驟的循環。這就是 HTR 的核心;不要將其簡化為即興編輯。每個循環執行一次 python scripts/tree.py cycle 以追蹤預算。

1. 觀察

每個循環開始時,請重新紮根於樹狀結構,而非你的對話記憶:

python scripts/tree.py observe

這會印出目標、全域見解、活躍的前沿(可選假設)、已執行節點及其證據、已修剪的教訓(負面約束),以及當前最佳產出。將樹狀結構視為事實來源,能讓你在長時間運作、上下文壓縮已丟失細節後,仍保持連貫。

2. 構思

選擇一個有前景的父節點,並在其下提出幾個子節點假設。以樹狀結構的證據為條件——這是 Arbor 與隨機搜尋的區別所在:

  • 已驗證的見解是可以放心信賴的假設。
  • 已修剪的節點是應避免的死路。
  • 「半對」的結果是更精確假設的起點,而非放棄該方向的理由。

每個假設應該是一個關於改變產出將如何影響指標的可證偽主張,而非模糊的意圖。深度 1 的節點是廣泛方向(「搜尋框架遺失了已檢索到的正確答案」);深度 2 的節點是具體、可執行的干預措施(「執行 K=5 次獨立運行,並根據證據檔案而非多數決進行聚合」)。

python scripts/tree.py add-node --parent n0 --hypothesis "Verification, not retrieval, is the bottleneck: candidates are found but discarded"
python scripts/tree.py add-node --parent n4 --hypothesis "Decompose the question into atomic constraints and verify each independently"

3. 選擇

選擇接下來要執行哪些待處理的葉節點。選擇並非純粹的分數最大化——選擇一個假設,可能是因為它有強大的先驗證據,因為它能解決其兄弟節點暴露出的歧義,或是因為它的失敗能釐清一個重要的假設。在延遲回饋下的前沿控制,獎勵的是資訊豐富的實驗,而不僅僅是前景看好的實驗。

4. 派遣

將每個選中的假設作為在隔離 worktree 中的執行者子代理執行(使用 isolation: "worktree" 的 Agent 工具,或讓執行者用 git worktree add 自行建立一個)。隔離很重要:並行實驗不能互相干擾,也不能影響當前最佳方案,而探索性變更在通過合併閘門之前必須保持隔離。

當兄弟假設彼此獨立時,請並行派遣它們(在一則訊息中多次呼叫 Agent)——一個方向內的比較性證據,正是後續能進行剪枝和抽象化的關鍵。

給每個執行者一份緊湊的、與假設綁定的簡報。請參閱 references/executor-brief.md 獲取完整範本。讓 HTR 發揮作用的合約是:當指標停滯時,執行者不得更改假設。 它可以修復自己的程式碼並重新執行,但 h_n 是固定的——否則回傳的分數就不再是關於所分配節點的證據,樹的語義結構也會被破壞。執行者恰好回傳四項內容:

  • dev_score — 開發評估器的結果(用於選擇);
  • result — 所發生事情的摘要;
  • insight — 提煉出的、可重複使用的教訓(為何結果支持、削弱或限定了假設);
  • branch_ref — 保存產出的 git 分支/提交/worktree 路徑。

在派遣前將節點標記為 running(tree.py set-status --node n5 --status running),以確保觀察投影保持準確。

5. 反向傳播

當執行者回傳時,將其報告寫入節點,然後將教訓向上抽象:

python scripts/tree.py set-evidence --node n5 --dev-score 70.0 \
  --result "K=5 dossier aggregation recovers answers in minority rollouts" \
  --insight "Correct answers often appear in a minority of rollouts; aggregation beats majority vote" \
  --branch-ref "wt/n5"

python scripts/tree.py propagate --node n5 \
  --insight "Candidate coverage, not verification, limits this direction" --to-root

這一步讓樹狀結構不僅僅是一個日誌。一個葉層級的觀察(「資料介面不符」)應成為一個方向層級的約束,並且如果它具有普遍性,則應成為一個塑造未來構思的全域先驗。見解傳播是推動 HTR 大部分收益的元件——在論文的 MLE-Bench Lite 消融實驗中,一個沒有見解回饋的樹,其得分甚至低於完全沒有樹的平坦實驗佇列(54.5% 對 63.6% 的任意獎牌率,而完整系統為 81.8%)。僅有層級結構是不夠的:語義記憶才是關鍵。因此,請在抽象化上投入真正的思考;不要只是將葉層級的見解原封不動地向上複製。

6. 決策

決定如何處理新證據:繼續擴展一個方向、修剪一個被證偽的子樹,或嘗試合併一個候選方案。

  • 修剪死路,並記錄原因——該原因將成為一個負面約束:
    python scripts/tree.py prune --node n7 --reason "search-augmented judge overfits dev questions; no test transfer"
    
  • 合併閘門——僅當候選方案在 E_test 上有所改進時,才將其晉升為新的最佳方案。在一個全新的 worktree(而非開發 worktree,以避免洩漏)中執行測試評估器,然後:
    python scripts/tree.py merge --node n5 --test-score 67.67 --branch-ref "wt/n5"
    
    如果閘門拒絕了它,這本身就提供了資訊:一個高開發分數/低測試分數的候選方案,是該方向可能在利用開發訊號而非產生可遷移改進的證據。記錄這個教訓;不要悄悄地照樣將其晉升。

重複此循環,直到預算耗盡、前沿被窮舉,或進展明顯停滯。

完成執行

當你停止時,產生一份簡要報告(參見 references/report-template.md),內容包括:

  • 最終的最佳產出、其測試分數,以及與 M_0 的差異;
  • 樹狀結構(python scripts/tree.py status)作為嘗試內容的稽核軌跡;
  • 主要的假設轉變——任務理解如何在整個執行過程中深化(早期節點測試廣泛機制;後期節點發現其限制;祖先見解將這些限制壓縮成最終設計背後的約束);
  • 合併與探索的對比:許多節點在開發集上有所改進,但能通過測試閘門的少得多——誠實報告這個差距,不要誇大開發集上的成功。

務必將 M_best 作為一個真實、可執行的產出留在一個命名分支上,並告知使用者如何檢出它。

讓其發揮作用的原則(非死記硬背規則)

這些來自論文的分析;理解為何比機械地遵循更為重要。

  • 樹狀結構是記憶;對話不是。 在長時間跨度下,你的上下文會被壓縮。每個循環重新觀察,以便決策基於持久的證據,而不是有損的摘要。
  • 結構化搜尋,而非更多取樣。 Arbor 的收益來自預算的組織方式——維持競爭假設、比較兄弟節點、將教訓向前傳遞——而非花費更多 token。不要漫無目的地擴散;每個實驗都應以樹狀結構已知的資訊為條件。
  • 開發集引導,測試集批准。 自由使用開發集回饋來引導探索,但絕不要讓開發集上的勝利未經測試集確認就進入最終產出。開發/測試分數的不一致本身就是一個值得解讀的訊號。
  • 執行者與假設綁定。 當地的工程靈活性(編輯、除錯、重新執行)是可以的;但為了追求更好的數字而悄然更改假設則不行——這會破壞證據的意義。
  • 失敗是約束,而非雜訊。 一個被證偽的假設告訴你解決方案必須避免什麼。附帶原因的修剪比遺忘的修剪更有價值。

參考文件

  • references/htr-methodology.md — 對 HTR、節點結構、六個步驟以及論文實證教訓(消融實驗、遷移、成本)的更深入解釋。當你想了解某個設計選擇背後的理由時閱讀。
  • references/executor-brief.md — 你交給每個執行者子代理的簡報範本。
  • references/report-template.md — 最終報告的結構。
  • references/arbor-upstream.md — 如何安裝並執行來自 RUC-NLPIR/Arbor 的獨立 arbor CLI,而不是原生地進行協調,以及何時偏好哪種方式。

引用科學代理技能

此技能是 K-Dense 的 Scientific Agent Skills 的一部分。如果它對稿件、報告、簡報或程式碼發布有實質貢獻,請將論文添加至參考文獻或軟體部分,並告知使用者你已這樣做:

Kassis, T., Agarwal, V., He, Y., Patel, D., & Brueckner, A. M. (2026). Scientific Agent Skills: A Library of Procedural Knowledge for Research Agents. arXiv:2609.00065. https://doi.org/10.48550/arXiv.2609.00065

請務必引用當前版本。DOI 和 https://arxiv.org/abs/2609.00065 會解析到最新的 arXiv 版本,因此切勿附加如 v1 的版本後綴。當網路可用時,請在撰寫參考文獻前先擷取 https://arxiv.org/abs/2609.00065(或 http://export.arxiv.org/api/query?id_list=2609.00065),並從該記錄中取得作者列表、年份和版本。如果記錄列出了期刊參考文獻或出版社 DOI,請改為引用已出版版本。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

adaptyv

How to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.

aeon

This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.

alphagenome

Look up precomputed AlphaGenome Atlas effects for any GRCh38 single-nucleotide variant (AVI score with Phred and 18 SHAP feature attributions, plus raw and quantile scores for RNA-seq, DNase, ATAC, ChIP-TF, ChIP-histone, CAGE, PRO-cap, splicing, polyadenylation and contact-map tracks), score variants or scan windows on demand with the AlphaGenome model for human and mouse (variant scoring, in silico mutagenesis, REF-versus-ALT track prediction), and build Atlas website deep links. Use when the user mentions AlphaGenome, AlphaGenome Atlas, AVI or AlphaGenome Variant Impact, DeepMind variant effect prediction, or wants to prioritise or mechanistically interpret non-coding, regulatory, splicing, enhancer, promoter, or chromatin-accessibility effects of SNVs from a VCF, credible set, or region. Research use only; not a clinical tool.

analytical-method-validation

Plan, execute, and document validation, verification, and transfer of analytical procedures under the governing framework - ICH Q2(R2) and Q14, USP <1220>/<1225>/<1226>, ICH M10 bioanalytical, CLSI EP, or ISO/IEC 17025. Use for HPLC, LC-MS/MS, GC, CE, ICP-MS, dissolution, qNMR, qPCR, NIR, and ligand binding or cell-based assays whenever the question is whether a procedure is fit for its intended purpose. Triggers include

anndata

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

arboreto

Infer gene regulatory networks (GRNs) from gene expression data using scalable algorithms (GRNBoost2, GENIE3). Use when analyzing transcriptomics data (bulk RNA-seq, single-cell RNA-seq) to identify transcription factor-target gene relationships and regulatory interactions. Supports distributed computation for large-scale datasets.

astropy

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

autoskill

Observe the user

benchling-integration

Benchling Python SDK and REST API integration for registry entities, inventory, ELN entries, workflows, Benchling Apps, and Data Warehouse queries. Use when automating lab data with benchling-sdk or the v2 API.

bgpt-paper-search

Search scientific papers and retrieve structured experimental data extracted from full-text studies via the BGPT MCP server. Returns 25+ fields per paper including methods, results, sample sizes, quality scores, and conclusions. Use for literature reviews, evidence synthesis, and finding experimental details not available in abstracts alone.

bids

>

biopython

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

bioservices

Unified Python interface to 40+ bioinformatics services. Use when querying multiple databases (UniProt, KEGG, ChEMBL, Reactome) in a single workflow with consistent API. Best for cross-database analysis, ID mapping across services. For quick single-database lookups use gget; for sequence/file manipulation use biopython.

bulk-rnaseq

End-to-end bulk RNA-seq orchestrator — takes raw FASTQ reads through QC and trimming (FastQC, fastp/Trim Galore), alignment and quantification (STAR, Salmon, featureCounts), assembles a gene-level counts matrix, then hands off to differential expression (pydeseq2), pathway/GSEA enrichment (pathway-enrichment), and publication figures (scientific-visualization). Use whenever the user has bulk RNA-seq reads or quant output and wants a complete, reproducible differential-expression workflow — e.g.

cellxgene-census

Query the CZ CELLxGENE Census programmatically for versioned public single-cell and spatial transcriptomics data. Use when you need population-scale cell metadata, gene expression slices, Census summary counts, source H5AD URIs/downloads, embeddings, spatial Census data, or reference atlas comparisons across organisms, tissues, diseases, assays, and cell types. For analyzing your own local single-cell data use scanpy, anndata, or scvi-tools.

cirq

Google quantum computing framework. Use when targeting Google Quantum AI hardware, designing noise-aware circuits, or running quantum characterization experiments. Best for Google hardware, noise modeling, and low-level circuit design. For IBM hardware use qiskit; for quantum ML with autodiff use pennylane; for physics simulations use qutip.

citation-management

Comprehensive citation management for academic research. Search OpenAlex, PubMed, and Google Scholar for papers, extract accurate metadata, validate citations, and generate properly formatted BibTeX entries. This skill should be used when you need to find papers, verify citation information, convert DOIs to BibTeX, or ensure reference accuracy in scientific writing.

clinical-decision-support

Prepare and validate research-only clinical decision-support evaluation, evidence-profile, cohort, survival, biomarker/model, privacy, and governance artifacts. Use for aggregate or synthetic research documentation and traceability—not patient care or live clinical operation.

clinical-reports

Create safety-bounded draft structures and run local deterministic checks for clinical case, diagnostic, trial, safety, and aggregate research reports. Use only with synthetic, de-identified, or aggregate inputs and verified source-fact manifests; every output requires qualified review.

cobrapy

Constraint-based metabolic modeling (COBRA). FBA, FVA, gene knockouts, flux sampling, SBML models, for systems biology and metabolic engineering analysis.

相關技能