Published: August 5, 2025
12
2
58

Anyone exploring query expansion for RAG in codebases? For example, instead of doing a vector search, you could instruct the LLM to expand the query whenever searching. E.g. to find the authentication code, it could query for "authentication|auth|login|signin|credentials".

@josevalim isn’t literally every agentic coding solution doing this?

@AndersonAndrue They do it naturally, but the tools do not support it. So most times it ends up being multiple calls. So I’m wondering if a tool that supports and encourages boolean predicates would be better.

@josevalim yeah query expansion like that seems a pretty smart approach for complex systems.

Image in tweet by José Valim

@josevalim HyDE is common. I used it successfully but not for a code base. You have the LLM make up an answer to the query, then vector search that. It's guess at the auth code will be closer in the vector space to actual auth code then a query about auth code will be.

@josevalim I always wanted to do “lucene beats embeddings” story. Did similar with Boolean query expansion vs embeddings in large search engine circa 2020

@josevalim That is a fantastic idea. And would also be very fast.

@josevalim Well it depends. As in your example you have just one word which is expanded to multiple terms. But if you have many words such expansion brings noise and you lose the order. There are IR models like Colbert and sparse embeddings which work better. Yet they are rarely supported

@josevalim Does that mean - in your view vector search does not make much difference for code generation? I explored Cognee, Serena etc. - could not find much difference in the quality of code generated. Want to hear your views.

@josevalim I think @zeddotdev's use of tree sitter here is relevant, although not exactly the same. When a file is read, the agent only sees the structure and can call the tool again for more details. For me though, Claude already does exactly what you describe on its own.

Image in tweet by José Valim

@josevalim What are you building, Mr Valim?

@josevalim We have a hyde implementation in discourse you can check out, an interesting twist for code is preprocessing code with llm and the indexing that

@josevalim There is ast-grep tool and an MCP wrapper https://github.com/ast-grep/as... I have it and claude uses it from time to time. Much less than cat & grep

Phoenix 1.8.0 is officially out! - AGENTS .md for a level-up in LLM assisted dev - themes + dark mode - streamlined generators/layouts - revamped guides - scopes - phx.gen.auth magic links Huge thanks to Steffen Deusch and @dashbit for making it happen! https://phoenixframework.org/b...

The Elixir community and the folks at Software Mansion are running a Global Elixir Meetups week, where folks around the world meet, learn from each other, and discuss everything related to Elixir and the Erlang VM! Join or run your own! Link to official announcement right below.

Image in tweet by José Valim

🧵 3 years ago: started 'Backend Stuff' to help people learn and build with Elixir faster. No business plan, just wanted to help. Rebranded to 'Elixir Mentor' to cover all Elixir dev, added podcast. Growth was slow but steady - and that's what real success looks like.

Image in tweet by José Valim

Finally!

Image in tweet by José Valim

Share this thread

Read on Twitter

View original thread

Navigate thread

1/18