Code Comment Inconsistency Detection with BERT and Longformer
Not on the map. Why?
Abstract (arXiv)
Comments, or natural language descriptions of source code, are standard practice among software developers. By communicating important aspects of the code such as functionality and usage, comments help with software project maintenance. However, when the code is modified without an accompanying correction to the comment, an inconsistency between the comment and code can arise, which opens up the possibility for developer confusion and bugs. In this paper, we propose two models based on BERT (Devlin et al., 2019) and Longformer (Beltagy et al., 2020) to detect such inconsistencies in a natural language inference (NLI) context. Through an evaluation on a previously established corpus of comment-method pairs both during and after code changes, we demonstrate that our models outperform multiple baselines and yield comparable results to the state-of-the-art models that exclude linguistic and lexical features. We further discuss ideas for future research in using pretrained language models for both inconsistency detection and automatic comment updating.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Builds on 14 of its 28 references that are in the map. First posted on arXiv 29 Jul 2022.
Builds on
14 of 28 references.
References · 14
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2014Adam: A Method for Stochastic Optimizationcited by 37,240
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
- 2014Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translationcited by 4,057
- 2020Longformer: The Long-Document Transformercited by 3,413
- 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,918
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2018Generalized Cross Entropy Loss for Training Deep Neural Networks with Noisy Labelscited by 997
- 2015Gated Graph Sequence Neural Networkscited by 796
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2020Learning to Update Natural Language Comments Based on Code Changescited by 31
Built on by
Citing papers per year: 2023: 1; 2024: 0; 2025: 2; 2026: 3.
6 papers.
- 2026SciCoQA: Quality Assurance for Scientific Paper--Code Alignmentcited by 10
- 2025Large Language Models are Qualified Benchmark Builders: Rebuilding Pre-Training Datasets for Advancing Code Intelligence Taskscited by 6
- 2023DocChecker: Bootstrapping Code Large Language Model for Detecting and Resolving Code-Comment Inconsistenciescited by 3
- 2025CodeFuse-CommitEval: Towards Benchmarking LLM's Power on Commit Message and Code Change Inconsistency Detectioncited by 1
- 2026Do Papers Tell the Whole Story? A Benchmark and Framework for Uncovering Hidden Implementation Gaps in Bioinformaticscited by 1
- 2026SkillConsist: Detecting Inconsistencies in Agent Skills via Bidirectional Graph Alignmentcited by 1
- 2026SkillConsist: Detecting Inconsistencies in Agent Skills via Bidirectional Graph Alignment7 Aug 2026
- 2026Do Papers Tell the Whole Story? A Benchmark and Framework for Uncovering Hidden Implementation Gaps in Bioinformatics23 Mar 2026
- 2026SciCoQA: Quality Assurance for Scientific Paper--Code Alignment19 Jan 2026
- 2025CodeFuse-CommitEval: Towards Benchmarking LLM's Power on Commit Message and Code Change Inconsistency Detection25 Nov 2025
- 2025Large Language Models are Qualified Benchmark Builders: Rebuilding Pre-Training Datasets for Advancing Code Intelligence Tasks28 Apr 2025
- 2023DocChecker: Bootstrapping Code Large Language Model for Detecting and Resolving Code-Comment Inconsistencies10 Jun 2023