mlsanityData to 14 Oct 2026

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

arXiv 2607.10411 ↗First posted 11 Jul 2026cs.SE cs.AIcited by 0

On the map: LLM reasoning → Reasoning for agents, planning and code

Abstract (arXiv)

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.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 5 of its 23 references that are in the map. First posted on arXiv 11 Jul 2026.

Builds on

5 of 23 references.

Closest ancestors · 1

Same direction, newest first

  1. 2024Qwen2.5-Coder Technical Report18 Sep

Other references · 4

  1. 2024The Llama 3 Herd of Modelscited by 14,715
  2. 2023Towards Understanding Sycophancy in Language Modelscited by 1,040
  3. 2025ReProbe: Efficient Test-Time Scaling of Multi-Step Reasoning by Probing Internal States of Large Language Modelscited by 10
  4. 2025CoT-RAG: Integrating Chain of Thought and Retrieval-Augmented Generation to Enhance Reasoning in Large Language Modelscited by 8

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2026Beyond Strict Rules: Assessing the Effectiveness of Large Language Models for Code Smell Detection ↗
  2. 2026Targeted Tests for LLM Reasoning: An Audit-Constrained Protocol
  3. 2026PromptAudit: Auditing Prompt Sensitivity in LLM-Based Vulnerability Detection
  4. 2024Can LLM Prompting Serve as a Proxy for Static Analysis in Vulnerability Detection
  5. 2025Reasoning Isn't Enough: Examining Truth-Bias and Sycophancy in LLMs
  6. 2024Code Prompting Elicits Conditional Reasoning Abilities in Text+Code LLMs
  7. 2025ORFuzz: Fuzzing the "Other Side" of LLM Safety -- Testing Over-Refusal
  8. 2025Is LLM an Overconfident Judge? Unveiling the Capabilities of LLMs in Detecting Offensive Language with Annotation Disagreement