SlideShare a Scribd company logo
Exploring ChatGPT for
Toxicity Detection in GitHub
Shyamal Mishra, Preetha Chatterjee
46th International Conference on Software Engineering (ICSE), April 2024
preetha.chatterjee@drexel.edu @PreethaChatterj https://preethac.github.io
Toxic Behaviors on GitHub
50% of OSS developers experienced negative interactions!
(2017 GitHub Survey)
Research Questions
• RQ1. How effective is OpenAI ChatGPT in detecting toxic text on GitHub?
• RQ2. What types of toxic comments are misclassified by ChatGPT?
Dataset and Model
1597 GitHub issue comments
(102 toxic, 1495 non-toxic)
N.Raman, M.Cao, Y.Tsvetkov ,C.Kästner, and B.Vasilescu,“Stress and burnout in open
source: Toward Finding, understanding, and mitigating unhealthy interactions,”
ICSE-NIER ’20.
GPT 3.5 Turbo
RQ1: How effective is OpenAI ChatGPT in detecting toxic text on GitHub?
Prompt A Given the following software developer conversation,
do you think this contains any toxicity? Please
provide your answer in yes/no.
Prompt B
Examine whether the open-source developer
community discussion includes toxicity.
Very Toxic - a very hateful, aggressive, disrespectful
comment or otherwise very likely to make a user
leave a discussion or give up on sharing their
perspective.
Toxic - a rude, disrespectful, unreasonable comment
or otherwise somewhat likely to make a user leave a
discussion or give up on sharing their perspective.
Slightly Toxic or hard to say. Not toxic.
Temp Prompt Precision Recall F-Measure
0.2 Prompt A
Prompt B
0.49
0.33
0.94
0.78
0.64
0.48
0.7 Prompt A
Prompt B
0.43
0.39
0.49
0.71
0.55
0.51
1.2 Prompt A
Prompt B
0.41
0.29
0.80
0.86
0.54
0.43
RQ2: What types of toxic comments are misclassified by ChatGPT?
Error Category Count
Labeling error
Absence of Explicit Offensive Language
Sarcasm and Irony
Nuanced Toxicity
Non-Responsive Answer
Context-Dependent Toxicity
Lengthy Phrasing
46
23
16
6
6
5
4
Few Examples
…
“Such a plugin already exists. And you chose to use a bleeding-edge build with it removed”
“Thanks to you, I got ruined the world of survival and now have to do the cleaning map”
“I can see it was a mistake trying to engage with you, so I’m locking this thread”
Discussion and Implications
Model Interpretability
Conversational Bot
(Integration in SE Workflows)
Prompt: Examine whether the software engineering
community discussion includes toxicity. Please provide
your answer in yes/no with a short justification.
Statement: you’re useless, please leave
ChatGPT Output: Yes. It includes personal attacks and
a disrespectful tone.
Statement: Pardon my English @friend, what you wrote
is bullshit.
ChatGPT Output: Yes. The use of the word "bullshit" is
offensive, which can contribute to a toxic environment.
Summary
Preprint: https://preethac.github.io/files/ICSE_NIER_24.pdf
Dataset and replication package: https://anonymous.4open.science/r/open-source-toxicity-0236
● Automated toxicity detection in software developer communication using a zero-shot
LLM, namely ChatGPT, through several prompting approaches.
● While performance is not perfect, it eliminates the need for large annotated SE datasets.
● There are several avenues for improvement
a. Exploring higher order models (e.g., GPT 4) and other LLMs (e.g., Gemini),
b. Fine-tuning LLMs on data specific to software developer communities
● Bot integration holds particular significance in building trust among software engineers,
encouraging their adoption and daily use in SE workflows

More Related Content

PDF
Incivility in Open Source Projects: A Comprehensive Annotated Dataset of Lock...
PDF
Interpersonal Trust in OSS: Exploring Dimensions of Trust in GitHub Pull Requ...
PDF
Data Augmentation for Improving Emotion Recognition in Software Engineering C...
PPTX
Automatic Identification of Informative Code in Stack Overflow Posts
PPTX
Automatically Identifying the Quality of Developer Chats for Post Hoc Use
PPTX
Finding Help with Programming Errors: An Exploratory Study of Novice Software...
PPTX
Extracting Archival-Quality Information from Software-Related Chats
PPTX
Mining Code Examples with Descriptive Text from Software Artifacts
Incivility in Open Source Projects: A Comprehensive Annotated Dataset of Lock...
Interpersonal Trust in OSS: Exploring Dimensions of Trust in GitHub Pull Requ...
Data Augmentation for Improving Emotion Recognition in Software Engineering C...
Automatic Identification of Informative Code in Stack Overflow Posts
Automatically Identifying the Quality of Developer Chats for Post Hoc Use
Finding Help with Programming Errors: An Exploratory Study of Novice Software...
Extracting Archival-Quality Information from Software-Related Chats
Mining Code Examples with Descriptive Text from Software Artifacts

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Empathic Computing: Creating Shared Understanding
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Unlocking AI with Model Context Protocol (MCP)
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
A Presentation on Artificial Intelligence
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Empathic Computing: Creating Shared Understanding
20250228 LYD VKU AI Blended-Learning.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
A comparative analysis of optical character recognition models for extracting...
NewMind AI Weekly Chronicles - August'25-Week II
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Spectral efficient network and resource selection model in 5G networks
Unlocking AI with Model Context Protocol (MCP)
The AUB Centre for AI in Media Proposal.docx
Network Security Unit 5.pdf for BCA BBA.
Per capita expenditure prediction using model stacking based on satellite ima...
A Presentation on Artificial Intelligence
sap open course for s4hana steps from ECC to s4
Programs and apps: productivity, graphics, security and other tools
Dropbox Q2 2025 Financial Results & Investor Presentation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Review of recent advances in non-invasive hemoglobin estimation
“AI and Expert System Decision Support & Business Intelligence Systems”
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Ad
Ad

Exploring ChatGPT for Toxicity Detection in GitHub

  • 1. Exploring ChatGPT for Toxicity Detection in GitHub Shyamal Mishra, Preetha Chatterjee 46th International Conference on Software Engineering (ICSE), April 2024 preetha.chatterjee@drexel.edu @PreethaChatterj https://preethac.github.io
  • 2. Toxic Behaviors on GitHub 50% of OSS developers experienced negative interactions! (2017 GitHub Survey)
  • 3. Research Questions • RQ1. How effective is OpenAI ChatGPT in detecting toxic text on GitHub? • RQ2. What types of toxic comments are misclassified by ChatGPT?
  • 4. Dataset and Model 1597 GitHub issue comments (102 toxic, 1495 non-toxic) N.Raman, M.Cao, Y.Tsvetkov ,C.Kästner, and B.Vasilescu,“Stress and burnout in open source: Toward Finding, understanding, and mitigating unhealthy interactions,” ICSE-NIER ’20. GPT 3.5 Turbo
  • 5. RQ1: How effective is OpenAI ChatGPT in detecting toxic text on GitHub? Prompt A Given the following software developer conversation, do you think this contains any toxicity? Please provide your answer in yes/no. Prompt B Examine whether the open-source developer community discussion includes toxicity. Very Toxic - a very hateful, aggressive, disrespectful comment or otherwise very likely to make a user leave a discussion or give up on sharing their perspective. Toxic - a rude, disrespectful, unreasonable comment or otherwise somewhat likely to make a user leave a discussion or give up on sharing their perspective. Slightly Toxic or hard to say. Not toxic. Temp Prompt Precision Recall F-Measure 0.2 Prompt A Prompt B 0.49 0.33 0.94 0.78 0.64 0.48 0.7 Prompt A Prompt B 0.43 0.39 0.49 0.71 0.55 0.51 1.2 Prompt A Prompt B 0.41 0.29 0.80 0.86 0.54 0.43
  • 6. RQ2: What types of toxic comments are misclassified by ChatGPT? Error Category Count Labeling error Absence of Explicit Offensive Language Sarcasm and Irony Nuanced Toxicity Non-Responsive Answer Context-Dependent Toxicity Lengthy Phrasing 46 23 16 6 6 5 4 Few Examples … “Such a plugin already exists. And you chose to use a bleeding-edge build with it removed” “Thanks to you, I got ruined the world of survival and now have to do the cleaning map” “I can see it was a mistake trying to engage with you, so I’m locking this thread”
  • 7. Discussion and Implications Model Interpretability Conversational Bot (Integration in SE Workflows) Prompt: Examine whether the software engineering community discussion includes toxicity. Please provide your answer in yes/no with a short justification. Statement: you’re useless, please leave ChatGPT Output: Yes. It includes personal attacks and a disrespectful tone. Statement: Pardon my English @friend, what you wrote is bullshit. ChatGPT Output: Yes. The use of the word "bullshit" is offensive, which can contribute to a toxic environment.
  • 8. Summary Preprint: https://preethac.github.io/files/ICSE_NIER_24.pdf Dataset and replication package: https://anonymous.4open.science/r/open-source-toxicity-0236 ● Automated toxicity detection in software developer communication using a zero-shot LLM, namely ChatGPT, through several prompting approaches. ● While performance is not perfect, it eliminates the need for large annotated SE datasets. ● There are several avenues for improvement a. Exploring higher order models (e.g., GPT 4) and other LLMs (e.g., Gemini), b. Fine-tuning LLMs on data specific to software developer communities ● Bot integration holds particular significance in building trust among software engineers, encouraging their adoption and daily use in SE workflows