NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Systematic Approach for Large Language Models Debugging

Basel Shbita, Anna Lisa Gentile, Bing Zhang, Sungeun An, Shailja Thakur, Shubhi Asthana, Yi Zhou, Saptha Surendran, Farhan Ahmed, Rohan Kulkarni, Yuya Jeremy Ong, Chad DeLuca, Hima PatelarXiv 2026

TL;DR

This paper introduces a systematic, model-agnostic four-phase framework to transform large language model (LLM) debugging from an ad-hoc guessing game into a structured engineering discipline. By treating LLMs as observable systems, the framework guides practitioners through issue detection, evidence gathering, behavioral analysis, and iterative refinement. This closed-loop approach successfully resolves complex failures across well-defined, underspecified, and agentic workflows.

What Problem Does This Paper Address?

Debugging traditional software relies on deterministic execution paths, stack traces, and clear error codes. LLMs break this paradigm completely: they are inherently probabilistic, their internal representations are opaque, and their "failures" are often silent or subjective (e.g., subtle formatting errors, logical inconsistencies, or hallucinations).

Furthermore, standard evaluation benchmarks rarely reflect custom, real-world deployment conditions. When an LLM-based application fails in production—especially within complex multi-step agentic workflows—isolating whether the root cause is a bad prompt, a data coverage gap, a noisy evaluation metric, or an architectural limitation is incredibly difficult.

Methods

The authors propose a structured, model-agnostic debugging workflow divided into four distinct phases:

  1. Phase 1: Issue Detection: Localizing where failures are most visible (e.g., drops in benchmark performance or reasoning failures) and characterizing the problem in practical terms.
  2. Phase 2: Evidence Gathering: Assembling the necessary evaluation data, criteria, and metrics. If benchmarks are missing, practitioners are guided to build lightweight evaluators (like code-based validators or LLM-as-a-Judge rubrics) and scale up evaluation data using Scalable Synthetic Data Generation (SDG).
  3. Phase 3: Behavioral Analysis: Probing the model using either "black-box" methods—such as a glass-ceiling test (temporarily adding evaluation data to the training set to see if performance peaks, which isolates data gaps from architectural limits)—or "white-box" token-level diagnostic signals (entropy, varentropy, and confidence).
  4. Phase 4: Iterative Refinement: Applying targeted interventions based on the analysis, categorized into prompt refinement (for content issues), hyperparameter tuning (for stability issues), or data curation/fine-tuning (for data gaps).
Figure 1: Overview of our systematic debugging workflow. After detecting an issue, the process branches based on the available evidence, including benchmarks, task definition, and evaluation criteria. Structured analyses then guide refinements to prompts, hyperparameters, evaluation protocols, or training data, with each cycle feeding back into re-testing and continued iteration.

Datasets

The framework was validated across several standard benchmarks and custom datasets:

  • Open LLM Leaderboard, RULER, and ALERT for initial issue profiling.
  • GraphQL public benchmark (10K samples) for structured query generation.
  • Test of Time (ToT) for evaluating complex temporal reasoning.
  • HumanEval-Infilling for Fill-in-the-Middle (FIM) code completion.
  • MermaidSeqBench (a newly introduced benchmark developed by the authors) for text-to-sequence diagram generation.
  • SRE Incident Logs, consisting of real and synthetic Kubernetes incident trajectories generated via SDG.

Key Insights and Ideas

  • The "Logical Boundary" Trap in Code Completion: During Fill-in-the-Middle (FIM) debugging, the authors discovered that splitting training data strictly at logical code boundaries prevented the model from learning proper indentation. Randomly splitting code into prefix, middle, and suffix segments completely resolved the formatting bugs.
  • Don't Trust the Judge Blindly: In RAG workflows, poor performance is sometimes caused by noisy benchmarks or misaligned LLM-as-a-Judge configurations rather than a faulty model. Comparing model outputs against Subject Matter Expert (SME) annotations can expose judge noise.
  • Data-Mixture Fine-Tuning Prevents Forgetting: Injecting task-specific data (like GraphQL queries) into a larger, diverse mixture of generic technical data (~1M samples) yielded better performance (+40% accuracy) than vanilla fine-tuning on the task data alone (+30%), while successfully mitigating catastrophic forgetting.

Key Results

The framework yielded significant quantitative improvements across three major task categories:

  • Well-Defined Tasks (NL2GQL & Temporal Reasoning): For GraphQL generation, optimizing the data mixture boosted Granite-3.1-8B-Instruct accuracy from 20% to 60%. On the Test of Time (ToT) benchmark, targeted data augmentation raised accuracy by over 20 percentage points (from 25.4% to 48.9%). For FIM tasks, single-line code completion PASS@1 scores jumped from 0.15 to 0.72.
  • Underspecified Tasks (NL2Mermaid & RAG QA): Resolving benchmark and judge noise in RAG QA tasks drastically improved correctness and completeness metrics across multiple Llama and Granite models.
Table 1: Performance comparison of RAG QA tasks before and after resolving noise. Metrics: Correctness (answer accuracy), Completeness (information coverage), Adherence (instruction following), RL-F (retrieval-level F1 score), RB-LLM (retrieval-based LLM evaluation), and Conciseness (response brevity).
  • Agentic Tasks (SRE Workflow): Trajectory profiling and prompt constraints successfully mitigated hallucinated tool calls and redundant log queries in a Kubernetes diagnostic agent, leading to cleaner root-cause attributions.
Table 2: Performance comparison of SRE debugging tasks before and after refinement.

Limitations and Future Work

While highly practical, the authors note that treating the LLM primarily as an externally observable system limits diagnostic depth compared to full white-box gradient analysis. Additionally, the framework's reliance on LLM-as-a-Judge evaluators in underspecified settings can introduce subtle biases and reproducibility challenges. Future work includes expanding large-scale empirical validation across more diverse domains, languages, and production environments.

Summary updated

BibTeX
@misc{shbita2026systematic,
  author = {Basel Shbita and Anna Lisa Gentile and Bing Zhang and Sungeun An and Shailja Thakur and Shubhi Asthana and Yi Zhou and Saptha Surendran and Farhan Ahmed and Rohan Kulkarni and Yuya Jeremy Ong and Chad DeLuca and Hima Patel},
  title = {{A Systematic Approach for Large Language Models Debugging}},
  year = {2026},
  eprint = {2604.23027},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.23027},
}
Figure