# Enhancing Neural Code Representation with Additional Context

DevFeed: [Enhancing Neural Code Representation with Additional Context](<https://devfeed.tech/articles/enhancing-neural-code-representation-with-additional-context-123999.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2510.12082>)

Author: Huy Nguyen, Christoph Treude, Patanamon Thongtanunam

Published: 2026-11-09T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>), [arXiv: Software Engineering](<https://devfeed.tech/sources/arxiv-software-engineering.md>)

Topics: [Representation learning](<https://devfeed.tech/topics/representation-learning.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [AI Foundation Models](<https://devfeed.tech/topics/ai-foundation-models.md>), [Fine-tuning](<https://devfeed.tech/topics/fine-tuning.md>)

Tags: [classification](<https://devfeed.tech/tags/classification.md>), [clone](<https://devfeed.tech/tags/clone.md>), [code](<https://devfeed.tech/tags/code.md>), [context](<https://devfeed.tech/tags/context.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [cs-se](<https://devfeed.tech/tags/cs-se.md>), [datasets](<https://devfeed.tech/tags/datasets.md>), [deep-learning](<https://devfeed.tech/tags/deep-learning.md>), [fine-tuning](<https://devfeed.tech/tags/fine-tuning.md>), [history](<https://devfeed.tech/tags/history.md>), [java](<https://devfeed.tech/tags/java.md>), [neural](<https://devfeed.tech/tags/neural.md>), [performance](<https://devfeed.tech/tags/performance.md>), [prompt](<https://devfeed.tech/tags/prompt.md>), [security](<https://devfeed.tech/tags/security.md>), [software-engineering](<https://devfeed.tech/tags/software-engineering.md>), [tasks](<https://devfeed.tech/tags/tasks.md>), [vulnerability-detection](<https://devfeed.tech/tags/vulnerability-detection.md>)

## AI overview

The study finds that adding context such as version history and structural relationships can improve code-model performance, but effects vary by task and model family. Context improved classification for all five foundational models and, after fine-tuning, most evaluated code-specialized LLMs. For summarization, version history improved all four foundational models on every metric, while prompt-level context helped two of seven LLMs and hurt five. Combining context types yielded reported gains of up to 21.48% macro-F1 in classification and 15.04% F1 in clone detection. In a human evaluation of CodeT5 summaries for 100 Java snippets, context-augmented summaries ranked higher for accuracy and content adequacy. Vulnerability detection results are exploratory and provide only initial evidence of transfer.

## Source excerpt

arXiv:2510.12082v2 Announce Type: replace Abstract: Automated program comprehension underpins many software engineering tasks, from code summarisation to clone detection. While recent deep learning models have achieved strong results, they typically rely on source code alone, overlooking contextual signals such as version history or structural relationships. We conduct an empirical study of how enriching code representations with such signals affects model performance on four tasks: code clone detection, code classification, code summarisation, and vulnerability detection, using three datasets (SeSaMe, CodeSearchNet-Java, Vul4J). We evaluate five foundational code models (CodeBERT, GraphCodeBERT, CodeT5, PLBART, ASTNN) and seven code-specialised LLMs (CodeLlama, Qwen2.5-Coder, DeepSeek-Coder), comparing prompt-based context injection against fine-tuned use of context. Context improves classification for all five foundational models and, after fine-tuning, for most LLMs. For summarisation, the effect depends on the model family: version history improves all four foundational models on every metric, whereas prompt-level context helps two of the seven LLMs and hurts the other five. Combining context types reaches up to +21.48% macro-F1 in code classification and +15.04% F1 in clone detection. A human evaluation of CodeT5 summaries on 100 Java snippets ranks context-augmented summaries significantly higher for Accuracy and Content Adequacy. An exploratory vulnerability detection evaluation provides initial evidence of transfer to security-oriented tasks.