HintMiner: Automatic Question Hints Mining From Q&A Web Posts with Language Model via Self-Supervised Learning

Zhenyu Zhang, JiuDong YangAISTATS 2024

Abstract

HintMiner is a novel framework designed to automatically generate "hints" for technical questions by mining and merging relevant text spans from existing Q&A forum posts. By combining a BERT-based encoder-decoder architecture with a copying mechanism and a self-supervised learning strategy, it outperforms standard retrieval and generation baselines, providing users with concise, multi-source summaries to help solve their programming woes.

Introduction

Online Q&A forums like Stack Overflow are invaluable resources, but they face significant "last-mile" challenges. Many questions remain unanswered for long periods, and even when answers exist, they are often buried within long threads or spread across multiple related posts. This forces users to spend significant time filtering through noise.

Existing solutions generally fall into two categories: Information Retrieval (IR), which returns entire paragraphs that may contain irrelevant information, and Machine Reading Comprehension (MRC), which extracts a single specific text span. Neither is ideal for technical troubleshooting, where a "hint"—a synthesis of several key points from different sources—is often more useful than a single raw paragraph or a tiny snippet. HintMiner addresses this by automatically mining and merging relevant text spans into concise hints.

Methodology

The HintMiner framework centers on a model called MiningNet. The workflow consists of three main stages:

  1. Retrieval & Filtering: The system uses Elastic Search to find relevant posts. To handle the "noise" common in forums (e.g., "Thanks for the help!"), it employs an ensemble of three algorithms—Lexrank, KL greedy search, and Latent Semantic Analysis (LSA)—to filter out non-essential sentences and create a clean "context passage."
  2. MiningNet Architecture: The model uses a BERT Encoder to capture the deep semantics of the question and the retrieved context. This is paired with a Transformer Decoder and a CopyNet mechanism. The inclusion of CopyNet is critical; it allows the model to selectively "copy" specific tokens from the source text into the output, ensuring the hints remain grounded in the actual forum data rather than being entirely hallucinated.
The MiningNet architecture featuring BERT Encoder, Transformer Decoder, and CopyNet mechanism.
  1. Self-Supervised Learning (SSL): To train the model without expensive manual labeling, the authors leveraged the "Linked Posts" feature on Stack Overflow. They built a Post-Link Graph where nodes are posts and edges represent community-marked relationships. They formulated a training objective where the model must identify the "best" answer from a shuffled set of related paragraphs, forcing it to learn which text spans are truly helpful for a given query.

Datasets and Training

The researchers curated a massive dataset from four Stack Exchange sites (Stack Overflow, AI, Data Science, and Cross Validated), totaling approximately 17 million posts.

  • Training: They constructed 3.6 million "question-passage-hints" triplets using their Post-Link Graph.
  • Evaluation: A separate set of 60,000 Stack Overflow questions (with accepted answers not present in the training set) was used to test the model's performance.

One of the cleverest aspects of this work is using the "Linked" sidebar on Stack Overflow as a proxy for relevance. This allows for a massive, high-quality training set without human annotators. During training, the authors randomly shuffled the order of sentences in the context passage. This prevents the model from simply memorizing the position of an answer and instead forces it to actually "understand" the relationship between the question and the text.

Key Results

HintMiner was compared against strong baselines, including retrieval-based methods (AnswerBot, SimCSE) and generative models (GPT-2, BART, UniLM).

Performance comparison of HintMiner against various baselines across different answer lengths.

As shown in the results, HintMiner achieved an average BLEU score of 36.17% and a ROUGE-2 score of 36.29%. It consistently outperformed the next best model (UniLM) across various answer lengths. Qualitatively, the authors noted that while retrieval-based methods often returned irrelevant "noise" sentences, HintMiner successfully extracted and combined the core logic required to address the user's query.

Discussion and Future Work

In technical domains, precision is paramount. By using a copying mechanism (CopyNet), HintMiner avoids the common pitfalls of large language models that might generate plausible-sounding but technically incorrect advice. Unlike traditional MRC, which looks for a single answer, HintMiner is designed to merge multiple useful segments, reflecting how developers actually work—gathering bits of info from several comments to form a complete solution.

Despite its success, HintMiner has limitations. Currently, the model replaces code snippets and mathematical expressions with placeholders like [CODE] and [NUM]. While this reduces vocabulary complexity, it means the "hint" might lack the actual code needed to solve the problem. Additionally, the quality of the hint is capped by the quality of the initial retrieval. Future directions include developing a "link prediction tool" to better find relevant posts for brand-new questions and exploring ways to integrate actual code and math into the generated hints.

Summary updated

BibTeX
@inproceedings{zhang2024hintminer,
  author = {Zhenyu Zhang and JiuDong Yang},
  title = {{HintMiner: Automatic Question Hints Mining From Q\&A Web Posts with Language Model via Self-Supervised Learning}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2024},
}
Figure