短并非更经济:LLM生成解释的声明式动画规范与自由格式代码的受控比较
Shorter Is Not Cheaper: A Controlled Comparison of Declarative Animation Specifications and Free-Form Code for LLM-Generated Explanations
AI总结:
该研究对比LLM生成解释的声明式动画规范与自由格式代码,发现短格式未提升生成经济性、速度或可靠性,还可能降低Qwen3-14B的规范生成可靠性。
摘要:
聊天助手越来越多地使用交互式动画解释来回答概念性问题,这些解释要么以自由格式的HTML/JavaScript生成,要么以固定运行时执行的声明式规范生成。人们普遍认为声明式路径更经济、更快、更可靠,因为其输出更短且受约束。我们在运行前冻结假设和分析计划的受控比较中测试了这一预期。我们设计了ExplainSpec,一种时间索引的声明式动画格式,以及一种观察契约,使每个生成的解释都可通过程序检查;经过验证的、与 pacing 无关的检查器对来自五个领域的20个解释请求进行评分。三个Claude模型(共360个任务),以及后续研究中启用和禁用思考功能的开放权重Qwen3-14B(共240个任务),以两种格式回答了每个请求。对于每个模型,规范在答案标记(排除推理的输出)方面短25-48%,但启用推理后,仅最大的Claude模型的总输出显著减少,且没有模型生成速度显著更快。原因各不相同:Claude模型在编写规范前的推理多(探索性;对于两个较大的模型,从15-20%升至85-88%的生成)。Qwen3-14B在两种格式中的推理量大致相同(此转变的预注册测试未得到支持),且其较短的答案相对于两倍以上长的推理轨迹节省很少。规范也并非更可靠:每个模型的自由格式页面在一轮修复后95-100%的任务中有效,而Qwen3-14B生成的有效规范仅占33%的任务,通过所有语义测试的仅占17%(HTML/JavaScript为62%)。因此,对于推理模型,仅较短的格式不会使生成更经济、更快或更可靠,且在上下文中学习的格式可能会降低可靠性。
英文摘要:
Chat assistants increasingly answer conceptual questions with interactive, animated explanations, generated either as free-form HTML/JavaScript or as declarative specifications that a fixed runtime plays. The declarative route is widely expected to be cheaper, faster and more reliable, because its outputs are shorter and constrained. We test this expectation in controlled comparisons whose hypotheses and analysis plans were frozen before the runs. We designed ExplainSpec, a time-indexed declarative animation format, and an observation contract that makes every generated explanation programmatically inspectable; validated, pacing-agnostic checkers score 20 explanation requests from five domains. Three Claude models (360 jobs) and, in a follow-up, the open-weight Qwen3-14B with thinking enabled and disabled (240 jobs) answered every request in both formats. For every model the specifications were 25-48% shorter in answer tokens (output excluding reasoning), yet with reasoning enabled total output fell significantly only for the largest Claude model and no model generated significantly faster. The reasons differed. The Claude models reasoned far more before writing specifications (exploratory; for the two larger models, from 15-20% to 85-88% of generations). Qwen3-14B reasoned about as much in both formats (a pre-registered test of this shift was not supported), and its shorter answers saved little against a reasoning trace more than twice as long. Nor were specifications more reliable: free-form pages were valid after one repair round in 95-100% of jobs for every model, whereas Qwen3-14B produced valid specifications in only 33% of jobs and passed all semantic tests in 17% (HTML/JavaScript: 62%). For reasoning models, a shorter format alone therefore does not make generation cheaper, faster or more reliable, and a format learned in context can cost reliability.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。