做代码文档对齐或规格说明自动化的团队,可以拿这个方法直接改进现有流程——它用 LLM 和静态分析结合,能快速发现并修复规格与代码的不一致,迭代效率很高。
研究人员提出了一种名为 fidelity probes 的方法,通过从代码中生成带真实答案的自然语言问题,来评估候选规格说明与代码的一致性。该方法将一致性分数分解为矛盾率和覆盖缺口率,从而指导规格说明的迭代改进。在包含约 12,000 行 COBOL 代码的基准测试中,经过八次迭代,规格说明的一致性从 0.63 提升至 0.94,且收敛点可通过两态马尔可夫固定点预测。探针可由 LLM 或静态分析管道生成,两者互补。该方法适用于任何应描述相同行为的成对工件。
Fidelity Probes for Specification--Code Alignment
We introduce fidelity probes: natural-language questions generated from a reference artifact with code-derived ground-truth answers, answered from a candidate specification. The fraction of agreeing probes, which we call the fidelity, decomposes into contradiction and coverage-gap rates that drive targeted spec edits to convergence. On a 15-program, roughly 12k-line COBOL benchmark (AWS CardDemo), we raise frozen-test specification fidelity from 0.63 to 0.94 over eight iterations, with the plateau location predicted by a two-state Markov fixed point $F^\dagger$ from just four iterations of rate data. Probes come from an LLM reading the code or from a static-analysis pipeline over its control-flow, data-flow, and system-dependence graphs, with a tunable mixture. A probe-resampling protocol with a frozen held-out set gives a Hoeffding-bounded overfitting discriminant; our measured train/test gap stays more than an order of magnitude below this envelope. Three graph-grounded mixtures lift fidelity by +16 to +30 points; cross-distribution evaluation shows the LLM and symbolic channels are empirically complementary. A cross-family generator sweep on five independent LLM lineages (Anthropic, DeepSeek, Google, Alibaba, OpenAI) confirms the convergence behaviour is not tied to any single model family: three of five non-Claude generators produce trajectories consistent with the Markov fixed-point prediction, and the frozen-test protocol actively falsifies the two generators whose probe distributions drift across iterations. The method applies to any pair of artifacts that are supposed to describe the same behaviour.