학술

SpecProbe: Probing Intent-Implementation Misalignments with Generated Executable Postconditions

arXiv CS.AI
CC BY
이 매체는 공공·자유 라이선스로 본문을 직접 표시합니다.

Abstract

Ensuring that code faithfully reflects its documented intent is a fundamental challenge in software engineering, but the informal natural language specifications in real repositories cannot be automatically compiled into executable checks and run against implementations.

We introduce behavioral probes: executable postconditions generated from natural language documentation, injected into programs, and checked during test execution to reveal where documented intent and implementation behavior align or diverge.

We present SpecProbe, a repository-aware pipeline that generates behavioral probes and classifies each as non-executable, matched, or mismatched.

A structured four-field schema (import, pre-ghost, post-ghost, condition) makes generated postconditions injectable and compilable in real repositories; reasoning supervised fine-tuning on $\sim$1.5K automatically curated examples enables a compact 7B model to generate probes without continued API access.

On Defects4J, SpecProbe's 7B model achieves GPT-4o-comparable semantic consistency (Sem@1) at 141$\times$ lower inference cost.

The pipeline reveals 80 of 726 historical bugs, and for 95% of them the original failing-test stack trace omits the method checked by the probe.

On Python icontract generation, SpecProbe surpasses GPT-5-mini and GPT-o3, demonstrating transfer to a different language and contract format.

These results show that behavioral probes complement failing-test stack traces with diagnostic evidence grounded in the selected method's documented intent.

관련 뉴스