3 ms·
Not really. RAG works very differently from a general (or generalist?) LLM. RAG is vector search first. It encodes the query, finds nearest vectors in the vect
by bambax 2y ago
Not really. RAG works very differently from a general (or generalist?) LLM.
RAG is vector search first. It encodes the query, finds nearest vectors in the vector database, retrieves the fragments attached to those vectors, and then sends those vectors to the LLM for it to summarize them.
A general LLM like Gemini or Claude or ChatGPT first produces an answer to a question, based on its training. This doesn't involve searching any external source at that point. Then after that answer is produced, the LLM can try to find sources that match what it has come up with.
- outofpaper 2y agoThis is a generalization. These proprietary systems do different things at different times. With GPT4o you can see little icons when a RAG is in use or when code and tests are being used. People, we have to stop talking about what we know as though it's all there is. Don't confuse our knowledge for understanding. Understanding only comes from repeadly trying to prove our understandings wrong and learning how things truly are.
- acka 2y agoThis. There is no point in arguing amongst ourselves when we're all wearing blindfolds and it is the zookeeper who decides what parts of the proprietary elephant we're allowed to touch.
- simonw 2y agoYou don't have to use vector search to implement RAG. You can use other search mechanisms instead or as well - whatever it takes to populate the context with the material most likely to help answer the user's question. Two common alternatives to vector search: 1. Ask the LLM to identify key terms in the user's question and use those terms with a regular full-text search engine 2. If the content you are answering questions about is short enough - an employee handbook for example - just jam the whole thing in the context. Claude 3 supports 200,000 tokens and Gemini Pro 1.5 supports a million so this can actually be pretty effective.
- bambax 2y agoYou're right and I was imprecise. 2. is how RAG is implemented in most cases. (I wouldn't call 1. 'RAG' exactly, though?)
- bigfudge 2y agoHYDE is a related technique. Ask the model to generate a response with no context, then use this for semantic search agains actual data and respond by summarising these documents.
- simonw 2y agoI'd definitely call 1 (the FTS version) RAG. It's how Bing and Google Gemini and ChatGPT Browse work - they don't have a full vector index of the Web to work with (at least as far as I know), they use the model's best guess at an appropriate FTS query instead.
- ozr 2y agoThat's not what RAG is. RAG is the process of adding relevant information to a prompt in an LLM. It's a form of in-context learning.
- mr_toad 2y agoIt’s right there in the name - first you Retrieve relevant information (often a vector lookup) then you use it to Augment the prompt, then you Generate an answer. It’s bloody useful if you can’t cram your entire proprietary code base into a prompt.
- kergonath 2y agoWhat makes it useful is precisely that it is not learning.
- ozr 2y agoYes it is; it's just not updating the weights. https://ai.stanford.edu/blog/understanding-incontext/ https://ai.stanford.edu/blog/understanding-incontext/