Sadeque, Farig YousufHaque, SaminAhmed, Syed ShakibAhmed, Kazi FardinNayeen, JulkerNabi, Khandoker Hamidun2026-01-082026-01-0820252025-10ID 21301628ID 24141224ID 21301235ID 22101120ID 24141243http://hdl.handle.net/10361/27414Cataloged from PDF version of thesis.Includes bibliographical references (pages 79-80).This thesis is submitted in partial fulfillment of the requirements for the degree of Bachelor of Science in Computer Science and Engineering, 2025.Detecting sarcasm is a nuanced and challenging task in natural language processing (NLP), as it requires understanding subtle contextual cues, symbolic gestures, and timeline of dataset as sarcasm constantly changes through time. This study tends to evaluate the performance of open-source large language models in sarcasm detection, exploring each model’s effectiveness in identifying sarcasm across varied contexts. In doing so, it tries to apply various prompt engineering techniques towards establishing an optimized environment; where these open source models will detect sarcasm based on the hyper parameters like context, and the actual comment corresponding to the context. Among the evaluated models, Llama 3.1 8B achieved the highest overall accuracy (69.07%) while DeepSeek R1 14B demonstrated the most balanced performance (accuracy = 66%, precision = 64.29%, recall = 72%). On sarcasm-device level evaluation, the models showed varying strengths: Llama 3.1 8B performed best on Contextual Incongruity (63.15%), Mistral 7B on both Contradiction and Contextual Incongruity (50%), Gemma 3 12B on Contradiction (80%), Qwen 3 8B on Contradiction (50%), and DeepSeek R1 14B on Hyperbole (50%). The findings highlight that while current open-source LLMs exhibit promising capabilities in detecting sarcastic intent, their performance varies by sarcasm device, revealing architectural biases and limitations. This study thus provides benchmark insights and interpretive evidence for advancing future NLP research in sarcasm modeling, architectural evaluation, and pragmatic language understanding.88 pagesenBRAC University theses are protected by copyright. They may be viewed from this source for any purpose, but reproduction or distribution in any format is prohibited without written permission.Sarcasm detectionNatural language processingLarge language modelsOpen-source LLMsText processingNatural language processing (Computer science).Wit and humor--Identification.Computational intelligence.Language and emotions--Analysis.Data mining.Context-aware computing.Pattern recognition systems.Human-computer interaction.Irony--Computer simulation.Evaluating the performance of open-source LLMs in sarcasm detection: a comparative analysisThesis