Automated Generation of Code Contracts - Generative AI to the Rescue?
summary
Fine-tuned CodeT5+ on a dataset of ~14k Java methods with JML annotations and an original crawl of ~40k methods, the system inputs a single method (300–400 words) and outputs JML pre/postconditions that are reinserted into source. Generated contracts reach ~60% exact textual match, BLEU ≈0.5, and 95% compileable, with ~5% compilation errors; logical checks on held-out academic examples show ~16% equivalent, >50% stronger (but 14% overconstraining and 9% invalid), so automated generation works well but needs post-processing.
AI-written summary · about
chapters (10)
- 0:00Design by contract intro
- 1:28JML contracts in Java
- 3:37Manual contract challenges
- 5:05Generative AI for contracts
- 7:09Model training approach
- 9:19Evaluating contract quality
- 13:34Logical analysis of contracts
- 16:49Study validity threats
- 19:18Findings and potential
- 21:32Q&A
related talks
47mTDD & Generative AI: A Perfect Pairing
48mTDD & generative AI - a perfect pairing?
45mTDD & generative AI - a perfect pairing?
46mTDD & generative AI - a perfect pairing?
44mAI Code Generation - Benefits, Risks and Mitigation Controls
32mCan We Trust AI-Generated Code?
19mWith great power comes great responsibility in code quality
49mClean Code in the AI era
