TraceCoder: Explainable and Auditable Code Generation with Position-Key Snippet Versioning

πŸ“… 2026-07-28
πŸ“ˆ Citations: 0
✨ Influential: 0
πŸ“„ PDF
πŸ€– AI Summary
This work addresses the lack of interpretability, traceability, and auditability in code generated by large language models, which obscures the rationale behind each line of code and its revision history. To overcome this, the authors propose an integrated approach combining a relational database of code snippet histories, a tree-node-based positional key indexing mechanism, and a visual provenance tool, enabling fine-grained tracking and full replay of the β€œcode generation narrative.” Coupled with a multi-round benchmark-driven repair framework, the system achieves an average 30% code mutation rate across 30 algorithmic tasks, with 30% of code snippets linked to specific repair events. Provenance coverage improves by over 21% compared to baseline methods, and case studies demonstrate the interpretability of line-by-line generation logic.
πŸ“ Abstract
Contemporary LLM-based coding agents produce code as black-box outputs: the rationale behind each line is hidden, the evolution of the code through benchmark-driven repair is ephemeral, and post-hoc auditing is impossible. We present a code generation concept that addresses these shortcomings through three complementary mechanisms: (i) a relational snippet-history schema that records, per repair event, the benchmark reference, round number, failure text, and LLM explanation, enabling full provenance queries; (ii) a browser-based visualisation tool that renders this history as heat-mapped, hover-annotated source code; and (iii) a competitive fractional position-key indexing scheme with tree-node delimiters that assigns stable, lexicographically-ordered identifiers to each code snippet, enabling fine-grained tracking without disrupting surrounding lines. We evaluate TraceCoder on 30 algorithmic programming tasks spanning string processing, mathematical computation, and data-structure manipulation, across two provider configurations. Of these, 10 exhaust the 6-iteration budget on tasks with subtle edge-case behaviour. Mean Chg% reaches 30%, three in ten code snippets carry a traceable repair-event row, compared to 21% when using Gemini 2.0 Flash as sole provider on a 20-task subset. Three detailed case studies demonstrate how the system explains which specific benchmark failures shaped each line of the final program. The proposed mechanism makes the internal "narrative" of automated code generation auditable and replayable, a property essential for trust and accountability in production deployments.
Problem

Research questions and friction points this paper is trying to address.

code generation
explainability
auditability
provenance tracking
LLM-based coding agents
Innovation

Methods, ideas, or system contributions that make the work stand out.

explainable code generation
snippet versioning
position-key indexing
auditable AI
code provenance