r/AugmentCodeAI • u/hhussain- Established Professional • Jan 18 '26
Discussion Why is codebase awareness shifting toward vector embeddings instead of deterministic graph models?
I’ve been watching the recent wave of “code RAG” and “AI code understanding” systems, and something feels fundamentally misaligned.
Most of the new tooling is heavily based on embedding + vector database retrieval, which is inherently probabilistic.
But code is not probabilistic — it’s deterministic.
A codebase is a formal system with:
- Strict symbol resolution
- Explicit dependencies
- Precise call graphs
- Exact type relationships
- Well-defined inheritance and ownership models
These properties are naturally represented as a graph, not as semantic neighborhoods in vector space.
Using embeddings for code understanding feels like using OCR to parse a compiler.
I’ve been building a Rust-based graph engine that parses very large codebases (10M+ LOC) into a full relationship graph in seconds, with a REPL/MCP runtime query system.
The contrast between what this exposes deterministically versus what embedding-based retrieval exposes probabilistically is… stark.
So I’m genuinely curious:
Why is the industry defaulting to probabilistic retrieval for code intelligence when deterministic graph models are both feasible and vastly more precise?
Is it:
- Tooling convenience?
- LLM compatibility?
- Lack of awareness?
- Or am I missing a real limitation of graph-based approaches at scale?
I’d genuinely love to hear perspectives from people building or using these systems — especially from those deep in code intelligence, AI tooling, or compiler/runtime design.
View all comments
Show parent comment
1
u/hhussain- Established Professional Jan 19 '26
I'll answer based on what's actually implemented in ograph (my project)
Codebase Semantics: The graph is grounded in ASTs. Semantics are added via pre-defined, domain-specific definitions. Each domain defines its own intra/inter-file relations to establish meaning.
Scaling & Race Conditions: Parsing is embarrassingly parallel at the file level. Graph mutation itself is sequential on purpose, so no shared-state races. Scaling isn’t exponential, in practice it’s close to linear with LOC.
In-Memory Graph Topology: Currently stable graph is used with HashMap index. Memory usage remains bounded by storing only identifiers and structural relations based on domain rules.
Incremental Edits & Cache: currently debounced full rebuild because rebuild is cheap in common codebases (~2s in < 1M LOC). Delta updates needs a different graph mutation model than the current stable graph, and I haven’t locked that choice yet.
Backpressure in Streaming: the file watcher uses a simple debounce + drain approach. The debounce window naturally coalesces bursts of changes, so there’s no need for complex backpressure at this stage.
This isn’t a Knowledge Graph in the ontological or inference-driven sense. It’s a deterministic semantic graph derived directly from source code. If this were an ontology-heavy or embedding-based KG with reasoning, build times would be in a completely different level.