Gaganjot Kaur
-
BTech (Dr B R Ambedkar National Institute of Technology Jalandhar, 2018)
Topic
Helping Coding Agents Find Relevant Code: Structure-Aware Filtering of File Reads
Department of Electrical and Computer Engineering
Date & location
-
Friday, August 28, 2026
-
10:00 A.M.
-
Virtual Defence
Reviewers
Supervisory Committee
-
Dr. Sean Chester, Department of Electrical and Computer Engineering, UVic (Co-Supervisor)
-
Dr. Alex Thomo, Department of Electrical and Computer Engineering, UVic (Co-Supervisor)
External Examiner
-
Dr. Jaya Prakash Champati, Department of Computer Science, University of Victoria
Chair of Oral Examination
- Dr. Jillian Roberts, Department of Educational Psychology and Leadership Studies, UVic
Abstract
Repository-level coding agents leveraging large language models (LLMs) must locate a small amount of task-relevant code within large software repositories. Full-file reads contain the required code, but often include large amounts of irrelevant code that consumes additional tokens and can misdirect the LLM’s reasoning. This is particularly harmful for multi-turn agents because the effects accumulate as the entire conversation context is repeatedly resubmitted during a run. One way to reduce this noise is to return only relevant lines. However, line-level filtering may separate those lines from their surrounding context and enclosing program structure, which the LLM may need to understand the code and reason about a solution. This thesis investigates whether filtering file reads into structurally complete, relevant units helps coding agents find relevant code more effectively, and examines the resulting impact on token usage and task resolution.
This thesis introduces the Structure-Aware Relevance-based Context filter (SARC) for full-file reads, a runtime method requiring no task-specific training. For each eligible read, the agent supplies a question describing its current information need. SARC divides the source file into structurally complete code units, optionally augments them with natural language descriptions, ranks them against the question, and returns the selected units. The ranges filtered out from the file are explicitly mentioned in the returned output for the agent to retrieve them later if needed.
SARC is evaluated using the mini-SWE-agent scaffold on SWE-bench Verified tasks, which consist of GitHub issue descriptions, repository code, and a test-based evaluation. ContextBench provides annotations for measuring context retrieval. The primary evaluation compares three related SARC designs on 995 total agent runs with the unfiltered mini-SWE agent and a fine-tuned line-level filtering model, SWE-Pruner, using MiniMax-M2.7 as the underlying LLM. A second evaluation on 96 instances using Kimi-K2.5 examines whether the main findings repeat with another LLM.
SARC produced no statistically significant difference in task resolution or overall context recall relative to unfiltered delivery. Although SARC reduced the amount of delivered code by 10.5%, this saving was too small to reduce the underlying LLM’s cumulative prompt-token use as SARC only acts on full-file reads, which are about 41% of the prompt tokens. Reducing that share by roughly 10% could therefore remove only about four percentage points from the overall tokens, which was further offset by repeated conversation-history submission and SARC’s prompt overhead. Overall, SARC incurred 7.4% higher runtime cost. Matched prompt SWE-Pruner runs also failed to reproduce the published 23–54% token reductions and consumed more tokens than the unfiltered baseline. Despite not reducing overall token consumption, SARC improved context retrieval quality significantly.
SARC reached the relevant code 21.5% earlier than the unfiltered baseline. Relative to SWE-Pruner, SARC made approximately 18% fewer reads, reached the relevant code 16.2% to 23.4% earlier, and preserved more broadly relevant context. Component comparisons show that natural-language descriptions produced most of the localization improvement. Description-augmented lexical scoring is hence suggested as a practical approach to code context filtering. Overall, this thesis provides a training-free, generizable method for improving code context filtering, that does not reduce overall token consumption, but helps the agent find relevant code earlier in the run. It informs future work for reducing token consumption while improving retrieval quality for coding agents.