HeavySkill: Heavy Thinking as the Inner Skill in Agentic Harness

Paper: arXiv:2605.02396 Code: wjn1996/HeavySkill Code reference: main @ a24fe5da (2026-05-09)

1. Motivation (研究动机)

当前 Agentic Harness 的典型做法是把复杂任务交给 orchestrator:它会调用多个 subagent、加载 Skill/Memory、安排工具调用,最后再汇总结果。论文认为这些系统确实有效,但机制被复杂工程外壳遮住了:到底是工具、记忆、角色分工、还是多路径推理在贡献性能,并不清楚。作者把这个问题压缩成一个更可检验的假设:很多 harness 的核心增益可以被抽象为一个模型可内化的 Heavy Thinking skill,即先并行生成多条独立推理轨迹,再用一个 sequential deliberation 阶段批判性综合这些轨迹。

这篇论文要解决的具体目标不是再提出一个新的 agent framework,而是回答三个问题:第一,最小化的两阶段 Heavy Thinking 是否已经能复现 agent harness 中的核心推理增益;第二,这种能力在 STEM、coding、instruction following、preference-style benchmark 和 tool-interleaved reasoning 上何时有效、何时失效;第三,Heavy Thinking 的“宽度”(并行轨迹数)和“深度”(deliberation/iteration)是否能进一步通过 RLVR 被训练成模型内部能力。

这个问题值得研究,是因为如果 Heavy Thinking 真的是 agent harness 背后的可迁移内在技能,那么系统设计可以从“堆更多外部 orchestration 组件”转向“训练或提示模型在内部执行并行探索与综合”。这会带来两个直接影响:一是 test-time scaling 可以用更简单的结构解释和调参;二是 skill 文件可以作为可读、可移植的执行规范,被 Claude Code、CodeX、Hermes 或自定义 harness 读取,而不一定依赖某个特定框架。

更具体地说,已有并行推理方法往往依赖 specialized architecture、inline thinking tags、固定同步点、MCTS / Tree-of-Thoughts 式启发式搜索或外部 verifier。它们可以提高 pass rate,但会把“何时分支、何时合并、如何判错”写死在系统外部。HeavySkill 的研究动机正是把这些外部机制还原成一个最小可执行技能:第一阶段用并行轨迹扩大 candidate solution space,第二阶段用同一个或另一个 LLM 做 evidence-aware synthesis。这样才能分辨性能提升来自“多采样带来的正确候选”还是来自“deliberation 对错误轨迹的识别与重组”。

论文还把这个问题和 self-evolving LLM 连接起来:如果模型能通过 RLVR 学会在 Heavy Thinking 模式下利用 serialized memory cache,那么未来的 agent 不必总依赖 brittle orchestration layers,而可以把部分复杂推理流程内化为参数化能力。这个角度使论文不只是 benchmark 报告,也是在讨论 agentic harness 和 reasoning model training 的边界如何重新划分。

2. Idea (核心思想)

核心洞察:Heavy Thinking 不是简单的 Best-of-N 或 majority voting,而是把“多条独立 reasoning trajectory + 批判性总结/重推理”当成一个可被模型执行、也可能被模型参数内化的 inner skill。它的关键不是只采样更多答案,而是让第二阶段显式比较不同轨迹的逻辑质量,并允许在所有轨迹都错时从错误经验中重新推理。

相对传统 BoN / Vote@K,HeavySkill 的根本差异在于聚合函数不是固定启发式。Vote@K 只看答案频率,Pass@K 只是理论上限,而 Heavy-Mean@K / Heavy-Pass@K 通过 summary model 对 serialized memory cache 中的轨迹进行二次推理;因此它可能选择低频但正确的路径,也可能合成单条轨迹中不存在的新解。相对 Tree-of-Thoughts 或 MCTS 这类外部搜索框架,HeavySkill 更强调“可读 skill + LLM 自执行”的轻量 harness 形态,而非手写 verifier 或复杂搜索树。

可以把它理解成把 harness 的外部控制流折叠进模型上下文:原本 orchestrator 要显式启动多个 agent、收集结果、再由人写规则汇总;HeavySkill 则把这套控制流写成一个 prompt/skill,让模型自己遵守“独立探索—记忆缓存—批判性综合”的协议。创新点不在某个新 loss,而在于把 agentic system 的有效行为拆成可测量的 primitive,并用 HM@K / HP@K 区分“平均答案质量”“至少一个 summary 正确”“是否接近 parallel Pass@K 上限”。

这个思想也解释了为什么论文同时研究 width、depth 和 RLVR:width 对应 条独立轨迹,主要增加候选覆盖;depth 对应 iterative deliberation,主要增加二次审查与重组;RLVR 则尝试让模型在训练中学会如何利用这类缓存。三者共同服务于一个目标:让 heavy thinking 从一次性的外部推理策略,变成可迁移、可训练、可由 harness 调用的 inner skill。

3. Method (方法)

3.1 Overall framework:两阶段 Heavy Thinking

Figure 1 解读:图中把用户问题送入第一阶段 LLM,生成多个互不通信的 Thinker 轨迹;这些轨迹被序列化成 Memory Cache 后,再送入第二阶段 LLM 做 Sequential Deliberation,输出最终答案。图上方的 Iterative Update 表示可选循环:上一轮 deliberation 的结果可以回填进 cache,再进行下一轮综合。这个结构把 agent harness 中“并行分工 + 汇总”的行为压缩成一个模型可执行的 test-time scaling primitive。

给定问题 ,第一阶段模型 生成 条独立轨迹: 第二阶段使用 deliberation model ,输入由轨迹集合构造的 serialized memory cache: 直觉上,第一阶段负责扩大搜索宽度,增加“至少有一条轨迹包含关键思路”的概率;第二阶段负责把这些候选路径变成可审查证据,而不是只按答案频率投票。它能工作的前提是 deliberation model 具备足够的 instruction following、错误识别和综合能力;如果第二阶段只会拼接或迎合多数票,Heavy Thinking 就退化成高成本的 BoN。

3.2 Serialized Memory Cache

Memory Cache 是两阶段之间的接口。论文强调完整轨迹通常包含很长的 internal thinking 和 answer content,直接拼接所有轨迹容易超过上下文长度,因此需要 pruning / clipping,并且对轨迹顺序 shuffle,避免模型学习到位置偏置。发布代码中的 MemoryCache.select() 支持 randommax_answer_nummax_diversity 三种轨迹选择策略,并在返回前执行 random.shuffle(selected)sequential_deliberation.deliberate() 进一步调用 clip_trajectories(selected, config.max_trajectory_tokens) 控制总 token 预算。

Figure 7 解读:图中展示了 Memory Cache 的 prompt 形态:先放原始 problem,再把每个 Thinker 的独立推理写成 # ----- Thinker #i ----- 分块。prompt 明确要求 summary model 比较不同 Thinker 的思路差异,不能简单相信多数答案;如果所有 Thinker 都错,允许吸收错误经验后重新推理。

3.3 Sequential Deliberation:不是投票,而是二次推理

Sequential Deliberation 的输入是 cache 中选出的 条轨迹,输出 个 summary / final-answer 样本。论文的关键约束包括:保持与原问题相同的语言与输出格式;对数学/STEM 问题沿用 \boxed{};对代码题沿用 code block;最终用户可见答案不包含 meta-analysis。这个设计把第二阶段塑造成 implicit verifier:它需要判断每条轨迹是否逻辑自洽,而不是只统计最后答案。

评价指标定义如下。设 表示第 条 parallel trajectory 是否正确, 表示第 个 deliberation 输出是否正确: 其中 Vote@K / V@K 是答案频率最高的 trajectory 的正确率,近似传统 BoN / majority voting。论文在 STEM 上观察到常见层级为

3.4 Iterative Deliberation:增加深度但可能引入干扰

论文把 iterative deliberation 定义为把上一轮 summary 结果回填进下一轮 cache: 这个机制对应“先综合,再把综合结果作为新证据继续综合”。实验中作者设置 ,发现 HM@K 随 iteration 增加有上升趋势,但 HP@K 会明显下降,说明更深的 deliberation 会带来 cumulative noise 或 information interference。

Figure 4 解读:六个子图比较不同模型在 HMMT25-Feb 与 GPQA-D 上随 iteration number 变化的 accuracy。曲线说明多轮 deliberation 可以提升平均输出质量,但论文同时指出 HP@K 下降,意味着某些原本能在多样 summary 中出现的正确答案会被后续循环中的噪声或偏置抹掉。

论文公式与 released code 实现差异:workflow/pipeline.py 在多轮循环里调用 cache.add_deliberation(s),但 workflow/sequential_deliberation.py 下一轮仍通过 cache.select() 只从 self.trajectories 选轨迹;MemoryCache.get_all_for_deliberation() 虽然存在,却没有被 deliberate() 使用。因此当前轻量 pipeline 的 iterative mode 并未严格实现论文公式中的“上一轮 deliberation 回填 cache”。这不影响单轮默认流程,但会影响复现实验中的 Figure 4。

3.5 Readable Skill for Agentic Harness

论文把 Heavy Thinking 转成一个 readable skill 文件,使 agentic harness 不需要改代码就能执行两阶段协议。skill 包含四类信息:Activation Conditions、Parallel Reasoning Protocol、Deliberation Prompt、Output Constraints。Activation 限定复杂数学、逻辑、代码竞赛、可验证高风险推理任务才启用;Parallel Reasoning 要求 个 agent 独立从零推理;Deliberation 要求分析答案分布、逻辑质量、交叉验证、少数正确路径和全错重推理;Output Constraints 则强制最终答案保持领域格式。

Figure 8 解读:第一部分给出 skill 概览、触发条件和并行推理阶段。作者建议 harness 中使用 ,workflow 中使用 ,强调不同 agent 之间不能共享上下文,最好鼓励代数/几何、暴力/优雅等不同路线。

Figure 9 解读:第二部分定义 sequential deliberation 的 meta-analysis 流程:统计答案分布、检查每条 reasoning chain 的漏洞、交叉验证不同路线、在多数票不可靠时保持怀疑,并在所有轨迹都错时重新推理。

Figure 10 解读:第三部分强调三个原则:independence、diversity、deliberation is synthesis not voting。它也给出 optional iterative refinement,但建议通常 2–3 轮即可,避免过度循环。

3.6 RLVR 扩展:把宽度与深度作为可学习对象

Appendix B 提出一个初步 RLVR 实验:从 Experiment 3 的 parallel reasoning 轨迹中选择 pass rate 位于 的 query,随机采样 条轨迹构造成 serialized memory cache;框架基于 VeRL,算法使用 GSPO,backbone 为 R1-Distill-Qwen-7B。结果显示训练最初 100 steps 内 train/test 都增长,HM@4 约提升 10%;但 组在 100 steps 后发生 entropy collapse,作者认为长 serialized context 触发最大序列长度限制,导致训练信号被截断或变差。

Figure 6 解读:蓝线是 ,绿线是 。多个面板展示 Training Score、Entropy、Response Length、Ratio of All Solve,以及 AIME25/HMMT25-Feb evaluation。它支持两个结论:Heavy Thinking 可以被 RLVR 进一步优化;但更大的并行宽度会显著增加上下文压力和训练不稳定性。

released code 未包含 VeRL/GSPO 的训练 launch config、hardware、batch size、learning rate 或 reward 配置;因此本笔记只把 RLVR 的模型、轨迹筛选区间、、训练早期现象记录为论文信息,不把仓库默认推理参数误写成 RL 训练超参。

3.7 代码级伪代码(基于 main@a24fe5da

并行推理阶段对应 workflow/parallel_reasoning.py

async def parallel_reason(query: str, config, agent) -> list[str]:
    trajectories = await agent.generate(
        prompt=query,
        n=config.reason_k,
        temperature=config.reason_temperature,
        max_tokens=config.reason_max_tokens,
        top_p=config.reason_top_p,
    )
    valid = []
    for traj in trajectories:
        if not is_repetitive(traj):
            valid.append(traj)
    return valid if valid else trajectories

Memory Cache 与轨迹选择对应 workflow/memory_cache.py

class MemoryCache:
    def __init__(self, trajectories=None):
        self.trajectories = trajectories or []
        self.deliberation_history = []
 
    def select(self, k: int, strategy: str = "random") -> list[str]:
        if len(self.trajectories) <= k:
            selected = list(self.trajectories)
        elif strategy == "random":
            selected = random.sample(self.trajectories, k)
        elif strategy == "max_answer_num":
            selected = self._select_by_answer_frequency(k)
        elif strategy == "max_diversity":
            selected = self._select_by_diversity(k)
        else:
            selected = random.sample(self.trajectories, k)
        random.shuffle(selected)
        return selected

Sequential Deliberation 对应 workflow/sequential_deliberation.pyworkflow/prompts.py

async def deliberate(query: str, cache: MemoryCache, config, agent) -> list[str]:
    selected = cache.select(k=config.reason_k, strategy="random")
    selected = clip_trajectories(selected, config.max_trajectory_tokens)
    prompt = build_summary_prompt(
        query=query,
        trajectories=selected,
        prompt_type=config.prompt_type,
        language=config.language,
    )
    summaries = await agent.generate(
        prompt=prompt,
        n=config.summary_k,
        temperature=config.summary_temperature,
        max_tokens=config.summary_max_tokens,
        top_p=config.reason_top_p,
    )
    return summaries

整体 pipeline 对应 workflow/pipeline.py

async def run_heavyskill(query: str, config) -> HeavySkillResult:
    reasoning_agent = OpenAICompatibleAgent(config.model_name, config.api_base)
    summary_agent = OpenAICompatibleAgent(config.summary_model, config.summary_base)
 
    trajectories = await parallel_reason(query, config, reasoning_agent)
    cache = MemoryCache(trajectories)
 
    summaries = []
    for iteration in range(config.iterations):
        summaries = await deliberate(query, cache, config, summary_agent)
        if config.iterations > 1 and iteration < config.iterations - 1:
            for summary in summaries:
                cache.add_deliberation(summary)  # released pipeline does not re-read this field later
 
    return HeavySkillResult(query=query, trajectories=trajectories, summaries=summaries)

Code reference: main @ a24fe5da (2026-05-09) — pseudocode and mapping based on this commit

Paper ConceptSource FileKey Class/Function
Heavy Thinking two-stage pipelineworkflow/pipeline.pyrun_heavyskill, HeavySkillResult
Parallel reasoning / independent trajectoriesworkflow/parallel_reasoning.pyparallel_reason
Serialized memory cache and trajectory permutationworkflow/memory_cache.pyMemoryCache.select, _select_by_answer_frequency, _select_by_diversity
Sequential deliberation / summary samplingworkflow/sequential_deliberation.pydeliberate
Summary prompt templatesworkflow/prompts.pybuild_summary_prompt, format_thinkers_prompt
CLI launch defaultsscripts/run_heavyskill.py, scripts/run_heavyskill.shparse_args, HeavySkillConfig construction
Paper experiment-style batch/eval utilitiesworkflow/deepthink_workflow.pypermutating, prompting, multi_call_api, model-eval metric aggregation
Harness-readable skillskill/heavyskill.mdnatural-language skill spec

4. Experimental Setup (实验设置)

4.1 Datasets / benchmarks

  • STEM:AIME25、BeyondAIME、HMMT25-Feb、GPQA-Diamond。论文没有逐一给出这些 benchmark 的样本数;表格只报告 accuracy。
  • General reasoning:LiveCodeBench (24.08–25.05)、Arena-Hard、IFEval、IMO (Answer Bench)。论文没有逐一给出样本数。
  • Sequential-deliberation 修错分析:Skywork OR1、DAPO、DeepScaler 的 open-resource data;作者随机采样 10k queries,并用 R1-Distill-Qwen-7B、 生成 parallel reasoning,用 pass-rate bins 分组。
  • Parallel trajectory selection 附录:R1-Distill-Qwen3-8B 在 AIME25 与 HMMT25-Feb 上,每个问题生成 256 条 parallel trajectories,再比较 Random、Max-Diversity、Max-Length、Max-Answer-Num。
  • Tool-interleaved reasoning:AIME25 与 HMMT25;使用可调用 Python interpreter 的 Qwen3-8B、Qwen3-32B、GPT-OSS-20B,工具交互上限为 50 rounds。

4.2 Compared baselines and metrics

  • Baselines:Mean@K / single-trajectory average、Pass@K upper-bound、Vote@K / majority voting / BoN-style heuristic,以及不同 trajectory selection 策略(Random、Max-Diversity、Max-Length、Max-Answer-Num)。
  • Metrics:M@K 是并行轨迹平均正确率;P@K 是 条轨迹中至少一条正确的比例;V@K 是最高频答案的正确率;HM@4 是 4 个 deliberation 输出的平均正确率;HP@4 是 4 个 deliberation 输出中至少一个正确的比例。
  • Models:closed-weight 包括 GPT-5-Thinking、Claude 4.5 Thinking、Gemini 3 Pro Preview;open-weight 包括 R1-Distill-Qwen-7B/32B、R1-Distill-Qwen3-8B、Qwen3-8B/32B、DeepSeek R1-0528、GPT-OSS-20B、Kimi K2 Thinking、GLM 4.6、DeepSeek V3.2 Thinking。

4.3 Main inference / released-code config

论文主实验默认 ,除非特别说明;temperature = 1.0,top-p = 0.95,top-k = 10,iteration ,parallel trajectories ,summary samples 。released repo 的 scripts/run_heavyskill.py 默认 reason_k=8summary_k=4iterations=1max_trajectory_tokens=80000reason_temperature=1.0reason_max_tokens=32768summary_temperature=0.7summary_max_tokens=32768scripts/run_heavyskill.sh 示例使用 MODEL="deepseek-r1"、OpenAI-compatible API_BASE="http://localhost:8080"PROMPT_TYPE="general"LANGUAGE="en"

论文公式与 released code 实现差异:论文主实验写了 top-k = 10,但轻量 CLI/config 没有暴露 top_k;论文只统一写 temperature = 1.0,而 released workflow 对 summary stage 默认用 summary_temperature=0.7。因此代码仓库更像是可运行 demo / skill workflow,而不是完整复现实验配置。

5. Experimental Results (实验结果)

5.1 STEM benchmark:HM@4 通常超过 M@K 和 V@K,强模型接近 P@K

Table 1 的主结论是 Heavy Thinking 在 STEM 上稳定优于单条平均推理,并且常常超过 majority voting。代表性 exact numbers:

  • GPT-5 Thinking, :AIME25 HM@4 = 99.2、HP@4 = 100;BeyondAIME HM@4 = 82.5、HP@4 = 88.0;HMMT25-Feb HM@4 = 95.0、HP@4 = 96.7;GPQA-Diamond HM@4 = 87.2、HP@4 = 90.9。
  • R1-Distill-Qwen-7B, :AIME25 HM@4 = 56.7、HP@4 = 60.0;BeyondAIME HM@4 = 35.3、HP@4 = 45.0;HMMT25-Feb HM@4 = 31.7、HP@4 = 43.3;GPQA-Diamond HM@4 = 51.8、HP@4 = 65.7。
  • Kimi K2 Thinking, :AIME25 HM@4 = 100、HP@4 = 100;BeyondAIME HM@4 = 83.0、HP@4 = 84.0;HMMT25-Feb HM@4 = 93.3、HP@4 = 93.3;GPQA-Diamond HM@4 = 86.9、HP@4 = 89.9。
  • DeepSeek V3.2 Thinking, :AIME25 HM@4 = 100、HP@4 = 100;HMMT25-Feb HM@4 = 100、HP@4 = 100。

这些数字支持作者的层级判断:对 verifiable STEM,sequential deliberation 能从多条轨迹中提取或综合正确推理。它不总能超过 Pass@K,因为 P@K 是“至少一条原始轨迹正确”的理论边界;但 HP@4 在不少实验中超过 P@K,说明 summary model 有时能生成原始轨迹中没有完整出现的正确答案。

5.2 General reasoning:可验证任务增益大,偏好任务增益弱

Table 2 显示 Heavy Thinking 对不同任务类型不均匀。LiveCodeBench 和 IFEval 这种 correctness-oriented 任务增益明显;Arena-Hard 这种 preference-oriented benchmark 中,HM@4 只与 M@K 接近,甚至略低。

  • R1-Distill-Qwen3-8B:LiveCodeBench M@K = 56.3、P@K = 70.9、HM@4 = 56.8、HP@4 = 67.4;IFEval M@K = 35.7、HM@4 = 69.3、HP@4 = 86.5。
  • GLM 4.6:LiveCodeBench M@K = 81.0、P@K = 90.3、HM@4 = 81.3、HP@4 = 87.9;IMO Answer Bench M@K = 74.5、P@K = 89.5、HM@4 = 75.1、HP@4 = 86.0。
  • Kimi K2 Thinking:LiveCodeBench M@K = 81.2、P@K = 91.0、HM@4 = 83.7、HP@4 = 80.4;IMO Answer Bench HM@4 = 77.2、HP@4 = 88.0。
  • GPT-OSS-20B:LiveCodeBench M@K = 69.7、P@K = 89.0、HM@4 = 69.2、HP@4 = 85.5;IFEval M@K = 90.8、HM@4 = 91.1、HP@4 = 97.6;IMO Answer Bench HM@4 = 71.0、HP@4 = 84.5。

5.3 Sequential deliberation 的修错能力

Figure 2 解读:横轴是 parallel pass rate cohort,纵轴是 query frequency / heavy pass behavior。作者用 10k queries 分析发现,当 parallel pass rate 低于 0.5 时,虽然约 1,400 个 query 仍未解决,但有超过 500 个 query 被 deliberation 修正;当 parallel pass rate 高于 0.5 时,heavy thinking 维持超过 98% 的成功率,只有约 30 个 query 出现性能退化。这说明第二阶段确实在做错误识别与重组,而不是单纯复制高频答案。

5.4 Summary model selection:第二阶段更依赖综合能力

Figure 3 解读:作者固定 parallel reasoning model 为 R1-Distill-Qwen-7B,比较 R1-Distill-Qwen-7B、R1-Distill-Qwen3-8B、Qwen2.5-32B-Instruct 作为 summary model 的效果。结果表明不同 summary model 都能让 HM@K 高于 M@K;其中 Qwen2.5-32B-Instruct 虽然自身在 AIME25 官方结果只有 12.8%,但作为 deliberation model 能表现很好,说明第二阶段看重的是 instruction following、分析与综合能力,而不只是单独解题能力。

5.5 Parallel trajectory selection 与宽度 scaling

Figure 5 解读:作者在 AIME25 与 HMMT25-Feb 上每题生成 256 条轨迹,再比较 下的 Random、Max-Diversity、Max-Length、Max-Answer-Num。所有策略随 增大整体上升,说明 parallel width 有 test-time scaling 效应;Max-Diversity 与 Random 接近,说明显式多样性选择的边际收益有限;Max-Length 最差,说明更长输出可能引入噪声;Max-Answer-Num 最好,说明提高正确轨迹占比会给 summary 阶段更稳的合成基础。

5.6 Tool-interleaved reasoning

Table 3 在可调用 Python interpreter 的场景中比较 AIME25 与 HMMT25。Exact numbers:Qwen3-8B 在 AIME25 上 M@K = 55.7、P@K = 83.3、V@4 = 68.3、HM@4 = 76.7,在 HMMT25 上 HM@4 = 69.3;Qwen3-32B 在 AIME25 上 M@K = 63.0、P@K = 89.0、V@4 = 83.3、HM@4 = 80.0,在 HMMT25 上 HM@4 = 68.5;GPT-OSS-20B 在 AIME25 上 M@K = 69.8、P@K = 95.0、V@4 = 83.3、HM@4 = 90.0,在 HMMT25 上 M@K = 55.3、P@K = 93.3、V@4 = 73.3、HM@4 = 85.7。作者据此认为 deliberation 能利用工具执行反馈信号修正轨迹,而不仅是处理纯文本 CoT。

5.7 Limitations and overall conclusion

作者明确的限制包括:Heavy Thinking 对 subjective alignment / open-ended preference task 的收益弱于 correctness-oriented task;iterative deliberation 虽提升 HM@K,但可能降低 HP@K,说明多轮综合会引入信息干扰;RLVR 的 组在 100 steps 后出现 entropy collapse,暴露长 serialized cache 与 sequence length 限制之间的冲突;released repo 也没有公开完整 RLVR 训练配置,复现 Appendix B 仍需要额外工程信息。

总体结论是:HeavySkill 用一个非常小的两阶段结构解释了 agentic harness 中相当一部分复杂推理增益。它比 BoN / Vote@K 更强,因为它让模型在第二阶段执行“批判性综合”;它也比复杂外部搜索框架更轻,因为可以被写成 readable skill 注入 harness。最适合它的任务是有明确 correctness signal 的数学、代码、工具反馈和 instruction-following;最需要谨慎的是偏好型任务、过深 iteration,以及超长 cache 下的 RLVR 稳定性。