arXiv論文メモ
新着一覧
cs.SE / cs.CR · 査読状況未確認

コード生成前の仕様提示で欠陥が減るかを比較実験

Specification Before Generation: A Pre-Registered, Five-Model Paired Evaluation of a Specification Frame for LLM-Generated Code in Money, Time, Idempotency, and Access Tasks

Sandeep Dhuri

この論文をやさしく読む

ひとことで言うと

コード生成の前に具体的な仕様を示すと、金額・時刻・再試行・権限の欠陥が減るか、5モデルで比較した。

何に役立つ?

生成コードの依頼文を設計する際、満たすべき条件を具体的に書く効果を評価する参考になる。

この研究の面白いところ

事前登録した一回生成の比較で、5モデル全ての欠陥が減り、別のセキュリティスキャナーでも同方向の結果だった。

どこまで分かった?

評価対象は50課題、5モデル、特定の検査器である。欠陥数の減少は、生成コードが全て安全であることの保証ではない。

v1のアブストラクトに基づくAI解説。日本語訳とは別に、用途の解釈を含みます。

アブストラクトの日本語訳

大規模言語モデルが生成するコードのセキュリティ検査通過率は、4年間でほとんど変わっていない。規制のあるバックエンドで重要な欠陥は、金額の計算、時刻の扱い、再試行時の安全性、アクセス制御に関わる。チームは指示ファイルで対応しているが、指示ファイルを調べた最大規模の比較研究では効果が見られなかった。本研究は、生成結果が満たすべき条件を固定の前文として示す仕様をプロンプトに含めると、生成コードが改善するかを検証する。 仮説、反証条件、分析コード、1回だけの生成規則を事前登録した。金融、医療、保険の実務を想定した現実的なバックエンド課題50件を、異なる5社系統の最先端モデル5種類に与え、各課題を仕様なしの場合と、267語の記入済み仕様枠を付けた場合の二通りで実行した。九つの決定的なASTに基づく検査器で出力を採点し、仕様枠を知らないBanditセキュリティスキャナーでも独立に採点した。 仕様枠は5モデル全てで欠陥を減らした。課題あたりの平均減少は0.16〜0.70件で、Holm補正後の符号検定は全て有意、ブートストラップ信頼区間も全てゼロを含まなかった。二条件の結果が異なる場合、100回のうち95回で仕様ありの方が良かった。どの領域でも、仕様枠によって悪化したモデルはなかった。Banditは中程度以上の問題を、仕様なしで53件、仕様ありで11件検出し、全モデルで同じ方向だった。効果は、仕様を与えない場合の既定の振る舞いが弱いモデルで最大だった。全500件の出力、プロンプト、検査器、採点コード、事前登録資料はDOI付きで公開され、結果を再計算できる。

v1の要旨から自動生成。本文の精読・人による確認は未実施。

初稿
2026-09-20(UTC)
最新改訂
2026-09-20 · v1
査読・掲載
査読状況未確認
arXivで読むPDF

更新履歴

取得できた版を表示。版の更新は査読済みを意味しません。過去版の本文差分は未解析です。

原文の要旨

Code generated by large language models passes security checks at a rate that has barely moved in four years. In regulated backends, the defect classes that matter most are money arithmetic, time handling, retry safety, and access control. Teams answer with instruction files, yet the largest controlled study of instruction files to date found no benefit. This paper tests a narrower idea: generated code improves when the prompt carries a specification, a fixed preamble stating what must be true of the result. We pre-registered hypotheses, refuters, analysis code, and a one-shot generation rule, then ran 50 realistic backend tasks from finance, healthcare, and insurance practice through five frontier models from five vendor lineages, each task twice: bare, and preceded by a 267-word filled specification frame. Nine deterministic AST-based checkers scored the outputs. The Bandit security scanner, which knows nothing of the frame, scored them independently. The frame reduced defects in all five models (mean reduction 0.16 to 0.70 findings per task, every Holm-adjusted sign test significant, every bootstrap confidence interval excluding zero). Where the arms differed, the frame arm won 95 of 100 times. It never made any model worse in any domain. Bandit found 53 medium-or-high issues in the bare arm and 11 in the frame arm, in the same direction for every model. The effect was largest where a model's unprompted defaults were weakest: the frame supplies the discipline a model lacks. All 500 outputs, prompts, checkers, scoring code, and the pre-registration are published with a DOI, so any team can re-derive the result without trusting the author.

著者のコメント

10 pages plus references, 2 figures, 5 tables. Dataset v1.1: https://doi.org/10.5281/zenodo.22850887. Also deposited at https://doi.org/10.5281/zenodo.22830263

arXiv ID: 2609.23270 / 要約の誤りについて