CORTEXA
← Browse
arxivcs.SEcs.AI2026-07-11

Mitigating LLM Sycophancy in Code Smell Detection Using Evidence-Guided Reasoning Prompts

Istiaq Ahmed Fahad, Kamruzzaman Asif, Md. Nurul Ahad Tawhid

Large Language Models (LLMs) are increasingly used for code smell detection tasks due to their ability to interpret program semantics. However, their reliability in this context remains poorly explored, particularly under varying prompt conditions where model predictions may be influenced by external cues rather than code characteristics. One such limitation is sycophancy bias, where models tend to align their outputs with user-provided assumptions instead of performing objective analysis. In this paper, we present the first systematic empirical study of sycophancy bias in LLM-based code smell detection. Using the MLCQ dataset, we evaluate how different prompt framings like confirmation bias, contradictory hints, and false premises affect model predictions. Our results show that LLMs are highly sensitive to prompt variations, with Decision Flip Rates reaching up to 72% and False Alignment Rates exceeding 90%, indicating substantial instability and agreement with misleading prompts. To address this issue, we propose Evidence-Guided Debiasing Prompting (EGDP), a structured prompting strategy that enforces evidence-first reasoning. EGDP reduces decision instability and improves robustness, lowering Decision Flip Rates to as low as 12% and False Alignment Rates to as low as 21%, while increasing reliance on structurally grounded evidence. Our findings demonstrate that sycophancy bias poses a critical threat to the reliability of LLM-based code smell detection, and that evidence-guided reasoning provides an effective and generalizable mitigation approach.

View free PDFSource page

Related papers

arxivcs.SEcs.AI2026-07-02

An Exploratory Study on LLM-Generated Code and Comments in Code Repositories

Yongyi Ji, Jiaji Wang, Yi Zhou, Fuxiang Chen, Hongji Yang

The use of LLMs in software development has become increasingly widespread on tasks such as code generation and summarization. Reports from large technology companies showed that around 20% to 30% of their code are generated by LLMs. However, there remains skepticism about the pr…

View free PDFSource page
arxivcs.SEcs.AI2026-06-28

Citation Discipline in Spec-Driven Development: A Cross-Model Empirical Study of Output Determinism and Automated Hallucination Detection in LLM-Generated Code

Subham Panda

Spec-Driven Development (SDD) frameworks guide Large Language Model (LLM)-powered code generation through formal specifications, yet they differ fundamentally in how they enforce traceability between requirements and generated code. This paper presents two controlled empirical st…

View free PDFSource page
arxivcs.SEcs.AI2026-07-10

Practical Source Code Recovery from Binary Functions Using Anchor-Based Retrieval and LLM Reasoning

Charles Edward Gagnon, Steven H. H. Ding, Philippe Charland, Benjamin C. M. Fung

We present a practical pipeline for recovering source code from stripped binary functions by combining reverse engineering, anchor-based source code retrieval, and large language model reasoning. Our binary-to-source-code retrieval method attempts to identify the source function…

View free PDFSource page
arxivcs.SEcs.AI2026-07-02

A Preliminary Study on Explaining Risk of Code Changes using LLM-Based Prediction Models

Yalin Liu, Kosay Jabre, Rui Abreu, Zachariah J. Carmichael, Vijayaraghavan Murali, Akshay Patel, et al.

Predictions by machine learning (ML) and artificial intelligence (AI) models are often received skeptically unless they are paired with intelligible explanations. In the context of just-in-time defect prediction, highlighting small portions of a software change (diff) -- beyond r…

View free PDFSource page
arxivcs.SEcs.AI2026-07-22

Cross-Model LLM Code Review: Should you use Claude to review Codex or vice versa?

Zuodong Xiang, Yike Zhang, YueMing Zhang, Hailu Xu

Developers increasingly use two coding agents together: one writes a draft, and the other reviews it. However, it is not clear whether the pairing is worth its cost and time, or whether the order of the pairing matters. We run a controlled experiment on 116 recent hard and medium…

View free PDFSource page
arxivcs.SEcs.AI2026-06-27

Reward-Free Code Alignment from Pretrained or Fine-Tuned LLM: Unpacking the Trade-offs for Code Generation

Sanjeepan Sivapiran, Gias Uddin

Large Language Model (LLM) alignment trains an LLM using preference data to produce outputs that better meet established quality standards. While LLM alignment techniques are studied for non-coding tasks, we know little about their usefulness for coding tasks. It is unclear wheth…

View free PDFSource page