2026-10-04 18:50 UTC
Building a RAG Pipeline for Semantic Code Search
----
- 58 minutes ago | 17 points | 0 comments
- URL: https://blog.jetbrains.com/ai/2026/09/building-a-rag-pipeline-for-semantic-code-search-a-developer-diary-and-field-notes/
- Discussions: https://news.ycombinator.com/item?id=49956148
- Summary: This blog post from JetBrains describes the development of Air Context, a RAG pipeline for semantic code search that helps LLM coding agents find relevant code. The first part covers parsing, chunking, and vectorization.
For chunking, the authors explain that fixed-size splitting fails because it groups unrelated code. Instead, they use structure-aware parsing with JetBrains' parsers for nine major languages, keeping declarations with their documentation and annotations while removing meaningless ones. Chunks are normalized and evaluated using an LLM-as-a-judge approach.
For vectorization, they discuss storage optimization. A 4,096-dimension vector in 32-bit floats weighs ~16KB, making millions of chunks expensive. They chose to keep all dimensions but reduce precision to one bit per component, using binary quantization. This preserves coverage of all semantic "questions" the model asks, even at the cost of precision. Binary vectors are compared using Hamming distance, which is computationally cheaper than cosine similarity. This sacrifices some recall but works well for agent consumption where ranking neighborhood matters more than exact ordering.
They also discuss embedding chunks with abbreviated file paths, handling monorepo path lengths, and privacy considerations—storing only coordinates, not code content, and using open-weight models on their own infrastructure.
Replies (0)
No replies.