Skip to main content
QUICK REVIEW

[Paper Review] SOGPTSpotter: Detecting ChatGPT-Generated Answers on Stack Overflow

Suyu Ma, Chunyang Chen|arXiv (Cornell University)|Feb 4, 2026
Expert finding and Q&A systemsComputer Science0 citations
TL;DR

SOGPTSpotter uses a BigBird-based Siamese network with triplet loss to detect ChatGPT-generated Stack Overflow answers, outperforming baselines and validated on a real-world case study.

ABSTRACT

Stack Overflow is a popular Q&A platform where users ask technical questions and receive answers from a community of experts. Recently, there has been a significant increase in the number of answers generated by ChatGPT, which can lead to incorrect and unreliable information being posted on the site. While Stack Overflow has banned such AI-generated content, detecting whether a post is ChatGPT-generated remains a challenging task. We introduce a novel approach, SOGPTSpotter, that employs Siamese Neural Networks, leveraging the BigBird model and the Triplet loss, to detect ChatGPT-generated answers on Stack Overflow. We use triplets of human answers, reference answers, and ChatGPT answers. Our empirical evaluation reveals that our approach outperforms well-established baselines like GPTZero, DetectGPT, GLTR, BERT, RoBERTa, and GPT-2 in identifying ChatGPT-synthesized Stack Overflow responses. We also conducted an ablation study to show the effectiveness of our model. Additional experiments were conducted to assess various factors, including the impact of text length, the model's robustness against adversarial attacks, and its generalization capabilities across different domains and large language models. We also conducted a real-world case study on Stack Overflow. Using our tool's recommendations, Stack Overflow moderators were able to identify and take down ChatGPT-suspected generated answers, demonstrating the practical applicability and effectiveness of our approach.

Motivation & Objective

  • Motivate the need to ensure quality and trust on Stack Overflow amid AI-generated content.
  • Develop a detection method that leverages Q&A structure and long-text handling to distinguish human vs. AI answers.
  • Create a diverse, high-quality dataset of Stack Overflow questions/answers and ChatGPT-generated references for training.
  • Evaluate the approach against baselines and assess robustness, generalization, and real-world applicability.

Proposed method

  • Propose SOGPTSpotter, a BigBird-based Siamese network trained with triplet loss on triplets (reference, human, ChatGPT) answers.
  • Represent long Stack Overflow answers efficiently using BigBird to handle long sequences.
  • Use cosine similarity between embeddings of reference vs. input answers to classify as ChatGPT-generated or human-generated, with a threshold of 0.5.
  • Construct a dataset of 6000 Stack Overflow triplets with high-reputation, high-upvote questions and accepted answers, plus ChatGPT reference and ChatGPT-generated answers.
  • Generate reference answers with non-human features via prompts designed to capture AI-like characteristics; generate diverse ChatGPT answers using varying prompts and lengths.
  • Conduct ablation studies, length-variation analyses, adversarial robustness checks, and cross-domain/LLM generalization assessments.

Experimental results

Research questions

  • RQ1RQ1: How well does SOGPTSpotter perform compared to baselines and in ablation studies?
  • RQ2RQ2: How does input text length affect detection performance?
  • RQ3RQ3: How robust is SOGPTSpotter to adversarial attacks?
  • RQ4RQ4: How well does SOGPTSpotter generalize across domains and different LLMs?
  • RQ5RQ5: How effective is SOGPTSpotter in a real-world Stack Overflow setting?

Key findings

  • SOGPTSpotter outperforms baselines (GPTZero, DetectGPT, GLTR, BERT, RoBERTa, GPT-2) in accuracy, F1-score, and precision.
  • The model achieves an accuracy of 97.67%.
  • The study includes ablation analyses, text-length impact assessments, adversarial robustness tests, and cross-domain/LLM generalization experiments.
  • A real-world Stack Overflow case study showed moderators removed 47 posts flagged by SOGPTSpotter as likely ChatGPT-generated.
  • The dataset comprises 6000 Stack Overflow triplets (reference, human, ChatGPT) and is evaluated with standard metrics (accuracy, precision, recall, F1).
  • The approach leverages a triplet loss with cosine distance to learn to distinguish AI-generated content relative to a reference AI answer.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.