BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News GitHub Introduces New Embedding Model to Improve Code Search and Context

GitHub Introduces New Embedding Model to Improve Code Search and Context

Listen to this article -  0:00

GitHub has introduced a new embedding model for Copilot, now integrated into Visual Studio Code. The model is designed to improve how Copilot understands programming context, retrieves relevant code, and suggests completions. According to GitHub, this update provides a 37.6% improvement in retrieval quality, doubles throughput speed, and reduces memory usage for code indexing by a factor of eight.

The new model powers all of Copilot’s main modes: chat, agent, edit, and ask. Benchmarks shared by GitHub show that the average embedding score increased from 0.362 to 0.498. Developers writing in C# and Java reported noticeably better results, with the rate of accepted code suggestions roughly doubling. These gains suggest that Copilot can now better recognize intent in complex codebases and deliver more relevant snippets during everyday programming.

To train the system, GitHub used contrastive learning with InfoNCE loss and introduced a method called Matryoshka Representation Learning. This technique allows the model to handle embeddings at multiple levels of granularity, meaning it can represent both small code fragments and entire files effectively. The training process also relied on hard negatives, examples of code that appear similar but are functionally incorrect, to help the model better distinguish between valid and invalid suggestions. This approach is meant to reduce retrieval errors that occur when two pieces of code look nearly identical but differ in behavior.

Compared to other models in the field, such as VoyageCode3, Nomic Embed Code, and Jina Code Embeddings, GitHub’s approach is notable for its integration and optimization within the VS Code environment. Competing models often emphasize benchmark scores or multilingual support, but GitHub’s focus on efficiency and memory reduction directly benefits the local developer experience. By compressing the embedding index, the model can work faster without sacrificing retrieval accuracy, which is especially useful for developers working on large projects.

The introduction of this model is part of GitHub’s broader effort to make Copilot more context-aware. While earlier versions of Copilot relied heavily on large language models for text prediction, the embedding layer now plays a larger role in understanding the structure of a codebase. Better embeddings mean Copilot can recall relevant functions, classes, and documentation with higher precision, reducing the need for repeated prompts and improving workflow speed.

In Reddit, developers raised immediate questions about how broadly the new embedding model is rolling out. User Andrew Greenh posted: 

I only see vscode mentioned, is this automatically in the cli as well?

Meanwhile a less enthusiastic view from user oVerde appeared too: 

Oh this sounds like VSCode only, sad news.

GitHub says it will continue to train on more languages and data sources and refine retrieval quality in future updates. Developers can already experience the improvements by updating to the latest version of Copilot in VS Code. The company’s roadmap includes expanding embedding coverage and further optimizing the balance between latency, memory use, and retrieval accuracy.

About the Author

BT