Work

Lost in The Latent Space: Understanding, Auditing, and Evaluating Machine Learning Models for Code

Year: 2025
Type: dissertation
Abstract: The growing integration of Machine Learning models into Software Engineering is reshaping the development, testing, and maintenance of software systems. While early applications of such models were limited to rule-based tools targeting specific, interpretable tasks, the advent of Deep Learning and Large Language Models has led to powerful but black-box systems that are now being employed to automate core stages of the Software Engineering process. However, this shift from human-understandable, rule-driven workflows to black-box, datadriven models has introduced challenges regarding transparency, trustworthiness, and auditability of the Software Engineering workflow. In software development, code is expected to be explainable and accountable: the rationale and behavior of human-written code can be justified against explicit specifications, and quality-assurance practices such as unit testing, code review, and static analysis were developed to enable that accountability. Machine Learning models, by contrast, learn internal representations from data and objectives, making it difficult to interpret, audit, or guarantee their behavior in the same manner. This creates a critical gap: as these models are being increasingly deployed in the Software Engineering pipeline, a lack of transparency and trustworthiness risks undermining the reliability, security, and trust in the generated code. This thesis aims to address the challenges described above in the context of Machine Learning models trained on code. We provide three separate frameworks, each designed to address a specific aspect of reliability and trustworthiness: model representation learning, model auditing, and model evaluation. First, we investigate what Machine Learning models learn from code during training, and how their internal representations encode syntactic and semantic information. To enable systematic analysis, we introduce DeepCodeProbe, a probing framework for assessing the structure and quality of learned code representations. This work provides insights into how code representations and model capacity influence the retention of critical code features, supporting more interpretable and robust representation engineering and model design. Next, we address the need for transparent auditing of LLMs trained on code, especially as training datasets grow in size and are not made available for inspection. We propose TraWiC, a framework for detecting dataset inclusion in LLMs trained on code without requiring access to original datasets or model weights. This enables the detection of potential data leakage, intellectual property violations, and memorization, thereby supporting trustworthy model development and audit. Finally, we address the need for reliable, scalable, and adaptive benchmarking frameworks for code LLMs. Static benchmarks fail to capture LLMs' nuanced weaknesses or evolving capabilities by focusing only on binary success/failure signals on underlying tasks, and are prone to being incorporated in LLMs' training datasets, resulting in inflated benchmarking results. Existing dynamic benchmarks often rely on other LLMs to judge the performance of the model-under-test (i.e., LLM-as-judge), which introduces bias, or lack a principled structure for task evaluation, which introduces high variance between benchmarking runs. Furthermore, they attempt to test for multiple capabilities at the same time (e.g., resolving an issue), which masks how the model attempts to solve the task and hides model weaknesses by bundling multiple reasoning requirements into one. We propose PrismBench, a novel dynamic evaluation methodology for comprehensive and adaptive benchmarking of LLMs' code generation capabilities to address the shortcomings of current static and dynamic benchmarking approaches. This enables more reliable, fine-grained diagnostics and supports the development of robust, high-assurance models for code generation in Software Engineering. Together, these frameworks form a pipeline for probing, auditing, and systematically stresstesting Machine Learning models for Software Engineering. Our work provides both theoretical foundations and practical tools for understanding what these models learn, how their training data can be audited, and how their real-world capabilities and limitations can be rigorously evaluated. In doing so, it advances the state of the art in trustworthy Machine Learning models for Software Engineering and offers concrete methods for increasing transparency and reliability as these systems become integral to software development.
Language: English
Open Access status: green
OpenAlex ID: W7128650034
Cites: 282
Cited by:
Related to: 10