The Best RAG Technique Yet? Anthropic’s Contextual Retrieval Explained!

  Рет қаралды 85,390

Prompt Engineering

Prompt Engineering

Күн бұрын

Пікірлер: 118
@tvwithtiffani
@tvwithtiffani 3 ай бұрын
For anyone wondering, I did try these methods (contextual retrieval + reranking) with a local model on my laptop. It does work great the rag part but it takes a while to import new documents due to chunking, generating summaries and generating embeddings. Re-ranking on a local model is surprisingly fast and really good with the right model. If you're building an application using rag, I'd suggest you make adding docs the very first step in the on-boarding to your application because you can then do all of the chunking etc in the background. The user might be expecting real-time drag->drop->ask question workflow but it wont work like that unless you're using models in the cloud. Also, remember to chunk, summarize and gen embeddings simultaneously, not one chunk after another as of course that'll take longer for your end-user.
@kenchang3456
@kenchang3456 3 ай бұрын
Thanks for the follow-up.
@TheShreyas10
@TheShreyas10 3 ай бұрын
Can you share the code if possible
@ashwinkumar5223
@ashwinkumar5223 3 ай бұрын
Nice
@ashwinkumar5223
@ashwinkumar5223 3 ай бұрын
Will you guide to do the same
@tvwithtiffani
@tvwithtiffani 3 ай бұрын
@@ashwinkumar5223 Unfortunately I cannot share code but I can advise. Just remember that everything runs locally. The language model, the embeddings model (very small compared to llm), the vector db (grows in GBs as you add more docs. This is where the generated embeddings are labeled & stored). A regular db for regular db crud stuff & keeping track of the status of document processing jobs. I went with mongodb because its a simple nosql data store that has libraries and docs for many programming languages. These dbs and models are ideally held in memory, but for resource constrained systems, you may want to orchestrate the loading and unloading of models as needed during your workflow. How would depend on the target platform you're developing for, desktop vs native mobile, vs web. I say all of this to say make sure you have a lot of system RAM and hard drive space. Mongo recently added some support for vectors given the noise around llms lately so there may be a bit of overlap here. But I haven't checked it out. Might not need a vectordb AND mongodb...
@BinWang-b7f
@BinWang-b7f 3 ай бұрын
Sending my best to the little one in the background!
@HelenTueni
@HelenTueni 2 ай бұрын
Adorable
@tomwawer5714
@tomwawer5714 3 ай бұрын
Thanks very interesting. Many ideas came to my head for improving RAG with enhancing chunk
@seanwood
@seanwood 3 ай бұрын
Working with this now and didn’t use the new caching method 😫. Nice to have someone else run through this 🎉😆
@megamehdi89
@megamehdi89 3 ай бұрын
Best wishes for the kid in the background
@MatichekYoutube
@MatichekYoutube 3 ай бұрын
do you maybe know what is going on in GPT Assistants - cause they rag is really efficiant - accurate - they have default 800 token chunks and 400 overlap. And it seems to work really well.Perhaps they use somekind of re-ranker also? Maybe you know ..
@vikramn2190
@vikramn2190 3 ай бұрын
Thanks for the easy to understand explanation
@IAMCFarm
@IAMCFarm 3 ай бұрын
Applying this to local models for large document repos seems like a good combo to increase RAG performance. I wonder how you would optimize for the local environment.
@SunilM-x9o
@SunilM-x9o 2 ай бұрын
what if the document is so big, that it couldn't fit in the llm context window how do we get the contextual based chunks then. if we consider break the document into small segments/documents to implement this approach, won't it lose some context with it
@anubisai
@anubisai 6 күн бұрын
Thought it was my baby, but it was yours in the background 😂😂
@alexisdamnit9012
@alexisdamnit9012 3 ай бұрын
Great explanation 🎉
@i2c_jason
@i2c_jason 3 ай бұрын
Hasn't structured graphRAG already solved this? Find the structured data using a graph, then navigate it to pull the exact example?
@remusomega
@remusomega 3 ай бұрын
How do you think the Graph gets structured in the first place
@faiqkhan7545
@faiqkhan7545 3 ай бұрын
@@remusomega Any Links to read ?
@MyBinaryLife
@MyBinaryLife 3 ай бұрын
@@faiqkhan7545 checkout the microsoft graphrag repo, pretty useful
@MyBinaryLife
@MyBinaryLife 3 ай бұрын
@@faiqkhan7545 check out the microsoft graphrag repository
@yt-sh
@yt-sh 3 ай бұрын
really useful article and video!
@HarmanSingh-wp8in
@HarmanSingh-wp8in 16 күн бұрын
Can someone suggest something for larger documents (above 500 pages)? Normal RAG is not so accurate and cannot use contextual Rag as we need to pass the whole document inside the prompt which exceeds the token limit.
@aaronjsolomon
@aaronjsolomon 29 күн бұрын
I was looking all over in the house and outside for the source of that sound. I thought the neighborhood cats were having a conference on my porch!
@engineerprompt
@engineerprompt 28 күн бұрын
:D
@PeterJung-cx1ib
@PeterJung-cx1ib 3 ай бұрын
How is the diagram generated/built at 0:48 for RAG embeddings?
@stonedizzleful
@stonedizzleful 3 ай бұрын
Great video man. Thank you!
@PedroNihwl
@PedroNihwl 7 күн бұрын
I don't know if I'm implementing 'prompt caching' incorrectly, but in my case, each chunk processing is taking too long (about 20s) with a 30-page file. Due to the processing time, this approach becomes unfeasible.
@loudcloud1499
@loudcloud1499 3 ай бұрын
very informational visualizations!
@jackbauer322
@jackbauer322 3 ай бұрын
I think the baby in the background disagrees :p
@limjuroy7078
@limjuroy7078 3 ай бұрын
What happened if the document contains a lot of images like tables, charts, and so on? Can we still chunk the document in a normal way like setting a chunk size?
@kai_s1985
@kai_s1985 3 ай бұрын
You can use vision based rag, he described in his previous video.
@limjuroy7078
@limjuroy7078 3 ай бұрын
@@kai_s1985, so we don't need to chunk our documents if we use vision based RAG? My problem is how are we going to chunk our documents even though the LLM has vision capabilities
@kairatsabyrov2031
@kairatsabyrov2031 3 ай бұрын
@@limjuroy7078 it is very different from the text based rag. But, I think you need to embed images page by page. Look at his video or read the ColPali paper.
@awakenwithoutcoffee
@awakenwithoutcoffee 2 ай бұрын
@@limjuroy7078 no, you would still need to chunk/parse your PDF's into text/tables/extracted images -> store those in 2 separate databases (s3/blob storage for images ) -> embed the images and the text separately -> on Query retrieve the closest images/text from these 2 stores in parallel -> feed to the OCR Model which will analyze the context including texts & image(s). There are more ways to use Vision models though: ColPali is one of them that is discussed by the OP in a different video. The approach here is to directly embed each page of a PDF/source as a picture and embed them directly. It's an interesting approach but with several drawbacks that source content isn't extracted/stored/accessible directly for queries/analysis but only at run-time. To get insight in your data you would need an OCR model to process the pages directly.
@AlfredNutile
@AlfredNutile 3 ай бұрын
Great work!
@DRMEDAHMED
@DRMEDAHMED 3 ай бұрын
I want to add this as a the default way the rag is handled in open webUI but its conflicting with other stuff, I tried to make a custom pipeline for it but i'm struggling to make it work is it out of the scope of open web UI or am I just not understanding the documentation properly
@souvickdas5564
@souvickdas5564 3 ай бұрын
How to generate those context for chunks without having the sufficient information to the LLM regarding the chunk? How they are getting the information about the revenue numbers in that example? If it is extracted from the whole document then it will be painful for llm cost.
@zachmccormick5116
@zachmccormick5116 3 ай бұрын
They put the entire document in the prompt for every single chunk. It’s very inefficient indeed.
@karthage3637
@karthage3637 3 ай бұрын
@@zachmccormick5116well it’s not inefficient if you can cache the prompt They find a way to push this feature
@samuelimanuel7643
@samuelimanuel7643 2 ай бұрын
I'm still new learning about RAG, but want to ask how would this differ or fit it with graphRAG? I heard GraphRAG are really well connected?
@martinsherry
@martinsherry 3 ай бұрын
V helpful explanation.
@CryptoMaN_Rahul
@CryptoMaN_Rahul 3 ай бұрын
I'm working on AI POWERED PREVIOUS YEAR QUESTIONS ANALYSIS SYSTEM WHICH WILL ANALYZE TRENDS AND SUMMARY OF PREVIOUS 5-10 YEARS PAPER AND WILL GIVE A DETAILED REPORT OF IMPORTANT TOPICS ETC.. can you tell what should be the approach to implement this ?
@SonGoku-pc7jl
@SonGoku-pc7jl 3 ай бұрын
thanks!
@RedCloudServices
@RedCloudServices 3 ай бұрын
Do you think Visual LLMs like ColPali provide accurate context and results than traditional RAG using text-based LLMs?
@wwkk4964
@wwkk4964 3 ай бұрын
🎉baby voices were cute!
@steve-g3j6b
@steve-g3j6b 3 ай бұрын
@Prompt Engineering didnt find a clear answer for my question, so I ask you. as a screenplay writer what do you think is the best model for me? gpt has very short memory. (not enough token memory)
@kees6
@kees6 3 ай бұрын
Gemini?
@steve-g3j6b
@steve-g3j6b 3 ай бұрын
@@kees6 why?
@lollots82
@lollots82 3 ай бұрын
​@@steve-g3j6bhas had 1M token window for a while
@konstantinlozev2272
@konstantinlozev2272 3 ай бұрын
Losing the context in RAG is a real issue that can destyall usefulness. I have read that a combination of the chunks and Graphs is a way to overcome that. But have not tested with a use case yet myself.
@NLPprompter
@NLPprompter 3 ай бұрын
I'm interested why graph can be useful for LLM to able retrieve better
@konstantinlozev2272
@konstantinlozev2272 3 ай бұрын
@@NLPprompter My understanding is that graphs condense and formalise the context of a piece of text. My use case is a database of case law. There are some obvious use cases for that when a paragraph cites another paragraph from another case. But beyond that I think there is a lot of opportunity is just representing each judgement in a standardised hierarchical format. But I am not 100% sure how to put all together from a software engineering perspective. And maybe one could use relational database instead of graphs too.🤔
@NLPprompter
@NLPprompter 3 ай бұрын
@@konstantinlozev2272 graph indeed is fascinating, maybe I'm not really know what and how it's able related to LLMs, what's makes it interesting is when Grokking state happen and model reach to be able generalize it's training, they tend to create a pattern with their given data, and those pattern are mostly geometric patterns, really fascinating although i tried to understand that paper which i can't comprehend with my little brain.... so i do believe graph rag somehow also have meaning/useful for llm.
@konstantinlozev2272
@konstantinlozev2272 3 ай бұрын
@@NLPprompter I guess it will have to be the LLM working with the API of the knowledge graph which function calling
@LatifAmars
@LatifAmars 3 ай бұрын
What tool did you use to record the video?
@janalgos
@janalgos 3 ай бұрын
how does it compare to hybridRAG?
@publicsectordirect982
@publicsectordirect982 3 ай бұрын
I'd like to know the same 👍
@ashutoshdongare5370
@ashutoshdongare5370 2 ай бұрын
How this compare with Graph Hybrid RAG ?
@andrew-does-marketing
@andrew-does-marketing 3 ай бұрын
Do you do contract work? I’m looking to get something like this created.
@engineerprompt
@engineerprompt 3 ай бұрын
Yes, you can contact me. Email is in the video description.
@VuNguyen-n2n1o
@VuNguyen-n2n1o Ай бұрын
hello, how this compared to Microsoft GraphRAG?
@VerdonTrigance
@VerdonTrigance 3 ай бұрын
How did they put a whole doc into prompt?
@vaioslaschos
@vaioslaschos 3 ай бұрын
most commercial LLm have a window of 120k or more. But even if this not the case, you can just take much bigger chunks as context.
@udaym4204
@udaym4204 3 ай бұрын
does Multi-Vector Retriever Worth It?
@robrita
@robrita 3 ай бұрын
can hear baby in the background 👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶👶
@loudcloud1499
@loudcloud1499 3 ай бұрын
starting them young🎉
@MrGnolem
@MrGnolem 3 ай бұрын
Isn't this what llama index has been doing for over a year now?
@loicbaconnier9150
@loicbaconnier9150 3 ай бұрын
I you want to make, the embedding, bm25 and reranker , just use Colbert it's more efficient...
@the42nd
@the42nd 3 ай бұрын
True, but he does mention colbert at 09:45
@engineerprompt
@engineerprompt 3 ай бұрын
ColBERT is great but there are two major issues with it currently, which hopefully will be addressed soon by the community. 1. Most of the current vectorstores lack support for it. I think qdrant has added the support. Vespa is another one but the mostly used ones still need to add that support. 2. The size and storage needs is another big issue with colbert. Quantization can help but I haven't seen much work on it yet.
@loicbaconnier9150
@loicbaconnier9150 3 ай бұрын
It’s very quick indexing documents, i use it as another retreiver in llamaindex. I create several index with it to improve or check retrieved chunks But you are right, best option to keep index is Qdrant.
@HawkFranklinResearch
@HawkFranklinResearch 3 ай бұрын
Contextual retrieval just seems equivalent to GraphRag (by Microsoft) that indexes knowlegde context wise
@DayLearningIT-hz5kj
@DayLearningIT-hz5kj 3 ай бұрын
Love the Baby ❤️ good father !
@nealdalton4696
@nealdalton4696 3 ай бұрын
Are you adding this to localGPT?
@engineerprompt
@engineerprompt 3 ай бұрын
Yes, big upgrade is coming :)
@ibrahimaba8966
@ibrahimaba8966 3 ай бұрын
This is the best way to sell their features: prompt caching 😁.
@crashandersen602
@crashandersen602 3 ай бұрын
So easy a baby could do it. Don't believe us? We have one following along in this lesson!
@micbab-vg2mu
@micbab-vg2mu 3 ай бұрын
interesting :)
@MrAhsan99
@MrAhsan99 3 ай бұрын
You can name the little one "Ahsan" just in case, if you are looking for the names.
@NLPprompter
@NLPprompter 3 ай бұрын
so we are going to have chunking model, embedding model, graph model, and conversation model... and they can work within program called by lines of codes, or... they can work freely fuzzyly in agentic way... i imagine a UI of game dev, drag and drop pdf to them, they will busy working on that file running around like cute little employee, and when done user can click a pc item then it will.... ah nevermind that would be waste of VRAM
@isaacking4555
@isaacking4555 3 ай бұрын
The baby in the background 🤣
@jensg8547
@jensg8547 3 ай бұрын
Vector embedding solutions for retrieval are doomed as soon as SLMs get cheap and fast enough. Why relying on cosine similarity when you can instead query a llm over all search data at inference time?!
@finalfan321
@finalfan321 3 ай бұрын
you sound tired but i thin i know why ;)
@LukePuplett
@LukePuplett 3 ай бұрын
I was so astonished by how obviously terrible the original "dumb chunking" approach is that I couldn't watch the video.
@marc-io
@marc-io 3 ай бұрын
so nothing new really
@cherepanovilya
@cherepanovilya 3 ай бұрын
old news))
@karansingh-fk4gh
@karansingh-fk4gh 3 ай бұрын
Your voice is very low. So difficult to understand entire things
@yurijmikhassiak7342
@yurijmikhassiak7342 3 ай бұрын
WHY NOT TO DO SMARK CHANKING ON CONTENT. LIKE WHEN NEW TOPIC STARTS? NEW SENTENCE, ETC? YOU WILL USE FAST LLM TO GENERATE CHANKS. THERE WILL BE LESS NEED FOR OVERLAP.
@Autovetus
@Autovetus 3 ай бұрын
Chill , dude... Sheesh 🙄
@hayho4614
@hayho4614 3 ай бұрын
maybe speaking with a bit more energy would keep me more engaged
@snapman218
@snapman218 3 ай бұрын
Good information, but having a child crying in the background is unprofessional. Of course now everyone will say I hate children, but I don’t care. I’m sick of unprofessional behavior.
@kerbberbs
@kerbberbs 3 ай бұрын
Its youtube dawg, nobody cares. Just watch the overlengthed vid and move on. Most people here only came for 2 mins of what's actually important
@ogoldberg
@ogoldberg 3 ай бұрын
Rude thing to say, and ridiculous. You are the one who is unprofessional.
@tombelfort1618
@tombelfort1618 3 ай бұрын
Entitled much? How much did you pay him for his time again?
@ZukunftTrieben
@ZukunftTrieben 3 ай бұрын
00:30
Stop Losing Context! How Late Chunking Can Enhance Your Retrieval Systems
16:49
Andro, ELMAN, TONI, MONA - Зари (Official Audio)
2:53
RAAVA MUSIC
Рет қаралды 8 МЛН
I Sent a Subscriber to Disneyland
0:27
MrBeast
Рет қаралды 104 МЛН
Reliable, fully local RAG agents with LLaMA3.2-3b
31:04
LangChain
Рет қаралды 79 М.
GraphRAG: LLM-Derived Knowledge Graphs for RAG
15:40
Alex Chao
Рет қаралды 133 М.
why you suck at prompt engineering (and how to fix it)
56:39
Liam Ottley
Рет қаралды 42 М.
RAG Explained in 7 Minutes: The Future of AI?
7:52
AIwithAustin
Рет қаралды 6 М.
Building Production RAG Over Complex Documents
1:22:18
Databricks
Рет қаралды 19 М.
Meet KAG: Supercharging RAG Systems with Advanced Reasoning
14:41
Prompt Engineering
Рет қаралды 24 М.
Anthropic’s Blueprint for Building Lean, Powerful AI Agents
28:25
Prompt Engineering
Рет қаралды 27 М.
LightRAG: A More Efficient Solution than GraphRAG for RAG Systems?
19:49
Prompt Engineering
Рет қаралды 44 М.
RAG But Better: Rerankers with Cohere AI
23:43
James Briggs
Рет қаралды 64 М.
Andro, ELMAN, TONI, MONA - Зари (Official Audio)
2:53
RAAVA MUSIC
Рет қаралды 8 МЛН