NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Improving Stack Overflow question title generation with copying enhanced CodeBERT model and bi-modal information

Fengji Zhang, Xiao Yu, Jacky Keung, Fuyang Li, Zhiwen Xie, Zhen Yang, Caoyuan Ma, Zhimin Zhang

TL;DR

Researchers have developed CCBERT, a deep-learning model designed to automatically generate high-quality titles for Stack Overflow questions. By combining the pre-trained power of CodeBERT with a specialized copy mechanism, the model effectively parses both natural language descriptions and code snippets to produce titles that are more accurate and readable than previous state-of-the-art methods.

What Problem Does This Paper Address?

On Stack Overflow (SO), the quality of a question title often determines whether it receives a helpful answer or is ignored. However, many users—particularly beginners or non-native English speakers—struggle to write concise, descriptive titles.

Previous attempts to automate title generation (like the BiLSTM-CC model) suffered from two major flaws:

  1. Information Scarcity: They relied solely on code snippets, ignoring the surrounding text descriptions that provide vital context.
  2. Architectural Limits: They used LSTMs, which struggle to capture "long-range dependencies" (relationships between words that are far apart in a long post).

The authors propose a new task called TGEQB (Title Generation from the Entire Question Body), shifting the focus from "code-to-title" to a "bi-modal" approach that treats the entire post (text + code) as the source material.

Methods

The authors introduce CCBERT, which follows an encoder-decoder architecture but adds a few clever "upgrades":

  • The Encoder (CodeBERT): Instead of a standard text encoder, they use CodeBERT, a model pre-trained on millions of lines of code and natural language. This allows the model to understand the "bi-modal" nature of SO posts—recognizing that a Python function and a text description of a bug are related.
  • The Decoder (Transformer): They replace traditional LSTMs with a stacked Transformer decoder. This architecture uses self-attention to better understand long question bodies (often 500+ tokens), where the most important clue might be buried at the very end.
  • The Copy Attention Layer: This is the "secret sauce." Technical titles often require specific, rare tokens—like a unique variable name (TriangleMesh) or a specific error code. Generative models often struggle with these "out-of-vocabulary" words. The copy mechanism allows the model to "point" at specific words in the input and copy them directly into the title, ensuring technical accuracy.

Datasets

The researchers curated a new large-scale dataset, $Data_{exp}$, consisting of approximately 200,000 high-quality questions filtered from Stack Overflow archives (2008–2020).

  • Quality Control: To ensure the model learned from the best examples, they only included questions that were not closed, had an accepted answer, and a positive score.
  • Languages: The dataset focuses on four popular programming languages: Java, Python, JavaScript, and PHP.
  • Benchmark: They compared CCBERT against several baselines, including TF-IDF (retrieval-based), BiLSTM, and the powerful BART model.

Key Insights and Ideas

  • Bi-modal is Non-Negotiable: The "aha moment" was confirming that code alone is misleading. Text provides the intent (e.g., "I want to move this..."), while code provides the implementation. Using both significantly boosted performance across all models.
  • The "Goldilocks" Overlap: Through manual evaluation, the authors found that the best titles have a moderate amount of word overlap with the body. Too little overlap makes the title vague; too much makes it a "bare error report." CCBERT strikes this balance better than retrieval-based methods.
  • Resilience to Low Data: Interestingly, CCBERT maintained high performance even when trained on only 1/8th of the dataset. This suggests that the pre-trained knowledge in CodeBERT provides a massive "head start," making the model viable for niche programming languages with less available data.

Key Results

CCBERT consistently outperformed all baselines across standard NLP metrics (BLEU and ROUGE):

  • Quantitative: On the joint dataset, CCBERT achieved a BLEU-4 score of 22.65 for PHP, outperforming the previous BiLSTM-CC (20.56) and even the large-scale BART model (22.28).
  • Qualitative (Human Eval): Five independent developers rated the titles. CCBERT was found to be nearly as readable as human-written titles and significantly better at capturing the "point" of the question (correlation) compared to retrieval-based systems.
  • Long-Range Success: CCBERT proved much better at identifying "critical words" (like sqlite or service) hidden in the middle of long posts, whereas older models tended to get distracted by irrelevant words at the very beginning.

Limitations and Future Work

While CCBERT is a significant step forward, the authors note a few hurdles:

  • Sequence Length: The model currently filters out posts longer than 1,000 tokens. Handling extremely long, "noisy" posts remains a challenge in deep learning.
  • Evolving Ecosystems: Programming languages and libraries change rapidly. The authors suggest that Incremental Learning—allowing the model to update its knowledge as new SO posts are created—is a necessary next step.
  • Language Breadth: The current study is limited to four languages. Expanding this to include CSS, SQL, or newer languages like Rust would test the model's true versatility.

Summary updated

BibTeX
@inproceedings{zhang2022improving,
  author = {Fengji Zhang and Xiao Yu and Jacky Keung and Fuyang Li and Zhiwen Xie and Zhen Yang and Caoyuan Ma and Zhimin Zhang},
  title = {{Improving Stack Overflow question title generation with copying enhanced CodeBERT model and bi-modal information}},
  booktitle = {Inf. Softw. Technol},
  year = {2022},
  url = {https://openreview.net/forum?id=d77vLD-5giA},
}

Loading related content...

Figure