用教师模型指导小模型生成确定性执行流程,提升推理准确率。
Compiling Deterministic Structure into SLM Harnesses

- 通过自然语言批评迭代优化小模型的执行流程结构
- 在GSM-Hard测试集上准确率达99.3%,比现有方法高34.3%
- 适合需要低成本、高可靠推理的企业级部署场景
企业级小模型部署面临认知不对称:小模型无法自我修正推理错误,而前沿大模型在规模化时成本高昂且存在数据主权风险。本文提出语义梯度下降(SGDe),一种教师-学生框架,将智能体工作流编译为离散执行计划——有向无环图拓扑、系统提示词和确定性代码。在离散语义空间中,前沿教师模型生成自然语言批评,作为方向性梯度迭代优化小模型的工作流产物。我们基于PAC学习形式化了SGDe,建立样本复杂度界,仅需三个训练样例即可收敛,利用教师作为统计先验。在对抗合成的GSM-Hard测试集上,编译工作流在m=5时达到91.3%准确率,m=3时达99.3%,较当前最优提示优化器提升26.3%至34.3%绝对值。在工作流工程中,SGDe将确定性代码放置(哪些子任务交由Python处理)作为基于轨迹的节点级优化目标,泛化了PAL和PoT中的静态全问题卸载。教师编译两种确定性结构:能力卸载(当小模型不可靠时将子任务交由Python)与结构共识(对敏感步骤使用带确定性投票的分叉/汇聚子图)。
原文摘要 · Abstract (English)
Enterprise SLM deployment faces epistemic asymmetry: small models cannot self-correct reasoning errors, while frontier LLMs incur prohibitive costs and data sovereignty risks at scale. We propose Semantic Gradient Descent (SGDe), a teacher-student framework that compiles agentic workflows into discrete execution plans--DAG topologies, system prompts, and deterministic code. The trailing e distinguishes this discrete, compilation-based approach from stochastic gradient descent. Operating in discrete semantic space, a frontier teacher generates natural-language critiques that serve as directional gradients to iteratively refine the SLM's workflow artefacts. We formalise SGDe under PAC learning, establishing sample-complexity bounds that enable convergence with as few as three training examples by leveraging the teacher as a statistical prior. On an adversarially synthesized GSM-Hard test set, compiled workflows achieve 91.3% accuracy at m=5 and 99.3% at m=3--a +26.3% to +34.3% absolute gain over state-of-the-art prompt optimisers. Within harness engineering, SGDe treats deterministic code placement (which subtasks to delegate to Python versus retain as LLM calls) as a trace-driven, per-node optimisation target, generalising static whole-problem offloading in PAL and PoT. The teacher compiles two deterministic structures: capability offloading (delegating subtasks to Python when the SLM is unreliable) and structural consensus (wrapping variance-sensitive steps in fan-out/fan-in subgraphs with deterministic voting).
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。