The 5 Levels Of Text Splitting For Retrieval

  Рет қаралды 56,257

Greg Kamradt (Data Indy)

Greg Kamradt (Data Indy)

Күн бұрын

Get Code: fullstackretrieval.com/
Get updates from me: mail.gregkamradt.com/
* www.chunkviz.com/
Greg’s Info:
- Twitter: / gregkamradt
- Newsletter: mail.gregkamradt.com/
- Website: gregkamradt.com/
- LinkedIn: / gregkamradt
- Work with me: tiny.one/TEi2HhN
- Contact Me: Twitter DM, LinkedIn Message, or contact@dataindependent.com
Outline:
0:00 - Intro
3:42 - Theory
6:57 - Level 1: Character Split
16:04 - Level 2: Recursive Character Split
20:59 - Level 3: Document Specific Splitting
32:10 - Level 4: Semantic Splitting (With Embeddings)
48:02 - Level 5: Agentic Splitting
1:02:47 - Bonus Level: Alternative Representation

Пікірлер: 180
@DataIndependent
@DataIndependent 4 ай бұрын
Both LangChain and Llama Index have added Semantic Chunking (level 4) to their libraries LangChain: python.langchain.com/docs/modules/data_connection/document_transformers/semantic-chunker Llama Index: llamahub.ai/l/llama-packs/llama-index-packs-node-parser-semantic-chunking?from=all
@GeorgAubele
@GeorgAubele 3 ай бұрын
But the Semantic Chunker in LangChain only goes with the OpenAI Embedder, doesn't it? What I mean: Is there a way to use another embedding mode than openAI embedder?
@DataIndependent
@DataIndependent 3 ай бұрын
@@GeorgAubele No, you can use your own, check out the docs, replace the embeddings engine you use
@alexeponon3250
@alexeponon3250 6 күн бұрын
Single and multi hop explained concerning the semantic splitting. Nice !!
@AshWickramasinghe
@AshWickramasinghe 6 ай бұрын
First video I came across that actually explain langchain in detail so that a layman can understand how it actually works
@DataIndependent
@DataIndependent 6 ай бұрын
Nice I love that - thank you!
@adityasankhla1433
@adityasankhla1433 2 ай бұрын
With the continuous influx of short form content, props to you for making this so interesting to watch. Didn't even realise it was an hour long. Loved every second of it. Thanks!
@stavroskyriakidis4839
@stavroskyriakidis4839 4 ай бұрын
Why did KZfaq take so long to recommend me this channel? Incredible work!
@DataIndependent
@DataIndependent 3 ай бұрын
Glad you're here my friend
@stonedizzleful
@stonedizzleful 29 күн бұрын
This is an insanely detailed from first principles tutorial. Thank you for taking the time to put this together.
@artislove491
@artislove491 4 ай бұрын
Hi Greg, many thanks for the work you put into this and to help all of us learn. Great clarity, depth and tempo! 💪
@DataIndependent
@DataIndependent 4 ай бұрын
Awesome thank you! The tempo part is good to hear because you never know
@kenchang3456
@kenchang3456 5 ай бұрын
I thought the explanation and showing your experimentation for semantic splitting was creative. Thank you very much.
@drakongames5417
@drakongames5417 2 ай бұрын
what the ___. how good can a tutorial be. such a gem of a video. thx for making this. new to ml and found this very helpful
@Munk-tt6tz
@Munk-tt6tz 2 ай бұрын
Your channel is a gem, thank you!
@NadaaTaiyab
@NadaaTaiyab 2 ай бұрын
Wow! I hadn't even thought about Agentic Chunking! I need to try this. I did some extensive experimentation with chunking on a project at work for a clinical knowledge base and I found that chunking strategies can make the difference between an ok retrieval and an awesome retrieval that works across a higher percentage of queries.
@truthwillout2371
@truthwillout2371 4 ай бұрын
Thanks for this Greg. I've been looking at agentic chunking for a while and this video really helped me with implementation. Not heard of you before I searched but now subbed. Thanks a lot :)
@DataIndependent
@DataIndependent 4 ай бұрын
Awesome - love it thanks for sharing
@andreyseas
@andreyseas 6 ай бұрын
Nice vid, Greg! You're on the cutting edge with some of these splitting techniques. Well done. 😎
@DataIndependent
@DataIndependent 6 ай бұрын
Thanks man - they were fun explorations
@nihilitymandate6073
@nihilitymandate6073 9 күн бұрын
Not a comment on the context, but I think that the style of the thumbnail is very smart. It reminds me of the Wired 5 Levels of Difficulty style. I think if the aesthetic is softer, it can be even more popular.
@Jonathan-rm6kt
@Jonathan-rm6kt 6 ай бұрын
Hi Greg, thanks for the video. It's awesome to have someone publishing good content who's doing the exact same thing as me. Hope to see more videos on advanced topics like this!
@DataIndependent
@DataIndependent 6 ай бұрын
Awesome thank you Jonathan! What is the domain you're working in?
@chakerayachi8468
@chakerayachi8468 3 ай бұрын
you really deserve that like buttons really thanks for this out of the world content
@JoanApita
@JoanApita 14 күн бұрын
man it took me 3 weeks to find you. thank you please keep on coming.
@connorshorten6311
@connorshorten6311 6 ай бұрын
Amazing!! I am fascinated by how document specific splitting or the bonus level also ties with how we structure our data schema. E.g. extracting metadata like "Introduction" in level 3 or applying a summary to the podcast and indexing that to then link to the raw clip in the bonus level. All amazing, super useful stuff -- I am a bit skeptical on embedding based splitting though, maybe just need to dive in further! Mostly bullish on level 5: agentic splitting with multimodal llms that kind of blend levels 3 and 5
@DataIndependent
@DataIndependent 6 ай бұрын
Awesome Connor I love the comment!
@JunYamog
@JunYamog 5 ай бұрын
Thanks I was thinking about solving my own Retrieval problem. I already got the small crude proof of concept using just simple chunking, embedding, RAG, etc. Now I need to get bigger user inputs that are in bigger pdf files. I thought using agents for it to get around the context window, you agentic chunker is a good starter and does make intuitive sense. I will try this route.
@srikanthganta7626
@srikanthganta7626 6 ай бұрын
Thanks greg! Love the long form instructional video :D Greatly appreciated
@DataIndependent
@DataIndependent 6 ай бұрын
Awesome! Glad it worked out
@user-mg2qk2cl3f
@user-mg2qk2cl3f Ай бұрын
Liked this semantic splitting! Cool stuff you´ve done there!! Also agentic chunking. Pretty cool!!!
@aarshmehtani5468
@aarshmehtani5468 Ай бұрын
While running the code elements=partition_pdf(filename=filename,strategy="hi_res",infer_table_structure=True,model_name="yolox") in my Jupyter notebook, I encountered errors such as TesseractNotFoundError. If anyone has faced this issue or knows how to solve it, please guide me as soon as possible. Great work, sir. I can confidently say that such a combination of content and explanation is unparalleled in the KZfaq world. @DataIndependent
@aarshmehtani5468
@aarshmehtani5468 Ай бұрын
Now this problem is solved but new problem has come. Basically this code is not working properly due some versions or subclasses. So please give the alternative method.
@GeorgAubele
@GeorgAubele 3 ай бұрын
Thank you very much! Great video!
@oleksandr.brazhii
@oleksandr.brazhii 5 ай бұрын
Best chunking video to date.
@KaptainLuis
@KaptainLuis 5 ай бұрын
thank you so much! well done!
@jessaco.8653
@jessaco.8653 6 ай бұрын
Another banger hit from Greg! How does he do it. Love this video!
@amrohendawi6007
@amrohendawi6007 28 күн бұрын
This is an amazing professional content! it hits the point directly
@JelckedeBoer
@JelckedeBoer 6 ай бұрын
Extremely helpful, thanks for the great tutorial!
@DataIndependent
@DataIndependent 6 ай бұрын
nice! thank you
@vctorroferz
@vctorroferz Ай бұрын
amazing video ! very helpful ! thanks !
@robxmccarthy
@robxmccarthy 5 ай бұрын
Love your videos, especially this one. The information density and presentation is off the charts. It is so altruistic of you to put this out there for free. I am especially interested in the semantic chunking. One use case is transcripts which often have distinct conversation blocks or qhestion answer pairs. Since it is important to capture the question and answer for full context, i was wonderinf what methodology might work best. Alternatively, semantically chunking a document vs pre-defined themes - sort of the opposite direction as the agentic chunker. First generate or define the overarching themes or buckets, then assign chunks to them. It seems that there is some real possibility in the semantic chunking methods. 🎉 Looking forward to experimenting more. Thank you again.
@DataIndependent
@DataIndependent 5 ай бұрын
Nice! For that one I actually recommend a slightly different method to explore. No idea if it'll work better for your use case but it might Check out this video where I do topic extraction from podcasts, I bet you could use this method and switch up the prompts a bit to pull out Q&A pairs w/ answers kzfaq.info/get/bejne/pqubq7WCq7Slo2g.html
@YanasChanell
@YanasChanell Ай бұрын
That was really helpful, thank you for information you're sharing!
@DataIndependent
@DataIndependent Ай бұрын
Thanks Yanas!
@micbab-vg2mu
@micbab-vg2mu 6 ай бұрын
Another great video - thank you:) In my case I need to try Semantic Splitting and Document Specific Splitting.
@DataIndependent
@DataIndependent 6 ай бұрын
Awesome, thanks Micbab
@xmagcx1
@xmagcx1 Ай бұрын
great video, thanks you
@MrSawaiz
@MrSawaiz 4 ай бұрын
This video should have a milliion views already. Amazing work
@DataIndependent
@DataIndependent 4 ай бұрын
Thanks again sawaiz - text splitting, not sexy, but it's fun!
@caiyu538
@caiyu538 6 ай бұрын
great lectures, great teacher
@DataIndependent
@DataIndependent 6 ай бұрын
Thanks Caiyu!
@frimis
@frimis 4 ай бұрын
This video is a piece of art ❤
@DataIndependent
@DataIndependent 4 ай бұрын
Thanks Frimis
@furkandemirturk3646
@furkandemirturk3646 5 ай бұрын
wow it has been very long time since I made a comment. This content is outstanding! Thank you for creating such a great video.
@DataIndependent
@DataIndependent 5 ай бұрын
heck ya! Thank you! glad to see you back on the comments
@Arvolve
@Arvolve 6 ай бұрын
That was great! Semantic and Agential ideas are definitely a way forward. Branching off that, here's a thought: building a meta-transformer that uses a classic-transformer through multi head attention to associate high dim vect between semantic chunks > more efficient parallel processing and capturing more nuanced relations between chunks & macro managing the splitting iteratively GPT formatting: Proposed Meta Transformer Approach: Chunk-Level Semantic Analysis: The meta transformer, as you propose, would operate on semantically split chunks, not just individual tokens. High-Dimensional Semantic Space: Each chunk (sequence of tokens) is mapped onto a high-dimensional semantic space. Iterative Mapping for Optimal Chunking: Through multi-head attention, the model would iteratively determine the best separation points for these chunks.
@DataIndependent
@DataIndependent 6 ай бұрын
That’s a fun idea - I’d love to see a demo or implementation if you share it out
@BrianRhea
@BrianRhea 5 ай бұрын
Incredible! I love the approach to Semantic Splitting. I'm working on creating AI tools that will analyze customer interviews (i.e. founders or user researchers talking to customers and then using AI for the analysis/synthesis). In those transcripts, there are multiple speakers. I'm incorporating your approach here and trying to find a better way to chunk those transcripts by the topic of conversation. Thanks a ton for sharing your work!
@DataIndependent
@DataIndependent 5 ай бұрын
Awesome, thank you Brian! Love it - I'm doing a ton of work on transcripts as well. This company was just showed to me around user research calls for consultants www.myjunior.ai/
@robxmccarthy
@robxmccarthy 5 ай бұрын
Any tips yet based on your findings? I've also been experimenting with semantic chunking of transcripts with somewhat mixed results.
@christosmelissourgos2757
@christosmelissourgos2757 2 ай бұрын
Great stuff!
@paalhoff63
@paalhoff63 5 ай бұрын
Great video, starting out with naive and easy to understand methods of text chunking, ending up with novel ideas that may point to the future
@DataIndependent
@DataIndependent 5 ай бұрын
Awesome - thank you!
@p3drocr
@p3drocr 3 ай бұрын
This was next level
@AllDomainDefense
@AllDomainDefense 3 ай бұрын
Thank you.
@danielvalentine132
@danielvalentine132 6 ай бұрын
Fantastic Video. Been thinking about level 5, a brilliant way to approach chunking, and I see other applications. Level 4 is clever. Retrieving in syntheticI believe will be the standard as time moves on.
@DataIndependent
@DataIndependent 6 ай бұрын
Totally agree
@RushyNova
@RushyNova 6 ай бұрын
Great content. FYI - Google’s Gemini models are built to be Multi-Modal from the outset, so seems to overcome some of the challenges you mentioned when combing text and images.
@DataIndependent
@DataIndependent 6 ай бұрын
Awesome thanks Rushy - ya, I’m ready for a multi modal embedding model
@jj55222
@jj55222 6 ай бұрын
Love the upload
@DataIndependent
@DataIndependent 6 ай бұрын
Awesome thanks
@ccapp3389
@ccapp3389 6 ай бұрын
I really enjoyed this thanks. I’ve had good IRL business results with your tiers 2 and 3. I’ve used semantic search quite a bit and my jury is still out on the match score’s reliability to granular levels like decision-making breakpoints. So I would probably find tier 4 still more of an aspirational novelty. I like the concepts of 4 & 5 though on the more distant horizon. As an aside - the term “naive” a lot of folks are using lately in the Langchain llamaindex crowd makes me roll my eyes. It just smells like smug Silicon Valley 20-something (not specifically throwing shade at you I’m seeing it all over the place). If someone is chunking a set of documentation and the content is divided into topics by markdown tags they’d call your “tier 3” implementation naive even if it’s clearly the most practical way to chunk the data and achieve an outcome. I would love to see a term arise to discuss the simple-but-often-practical methods with less negative baggage.
@DataIndependent
@DataIndependent 6 ай бұрын
Nice! Thank you for the solid comment. Totally agree that 4 and 5 are experimental for now. It’s really tough to beat the ROI on recursive character. Definitely open to a new word if one fit better
@ccapp3389
@ccapp3389 6 ай бұрын
Perhaps a specific term isn’t even needed? They’re all just different methods that can add value in different scenarios. Some are useful for concept-level education, some are useful for practical implementations today, some are useful for future-state theory crafting 🤷‍♂️
@DemoP.AUSSEIL-bb1ew
@DemoP.AUSSEIL-bb1ew 5 ай бұрын
Congrats that's ! That's an excellent job ! I hope you will continue your work and more benchmark will come. I am particularly curious if the benefit of semantic & agent chunking are minored or majored when code, html , csv is chunked.
@olivert.7177
@olivert.7177 Ай бұрын
29:13 Now there is GPT4-O ... So you were right with the prediction 😂
@leisdodigital
@leisdodigital 3 ай бұрын
Fantastic!
@DataIndependent
@DataIndependent 3 ай бұрын
Thanks Leisdo
@derekcarroll7904
@derekcarroll7904 5 ай бұрын
Buy you a cup of coffee ? How about a Starbucks franchise ! This is some very powerful material.. Looking forward to implementing these into my pipelines ! THANK YOU !
@TitanWellnessCenter2852
@TitanWellnessCenter2852 6 ай бұрын
Thanks!
@DataIndependent
@DataIndependent 6 ай бұрын
Woah this is cool - I think its my first tip, I appreciate it and I will be enjoying In-n-out animal style fries with it
@TitanWellnessCenter2852
@TitanWellnessCenter2852 6 ай бұрын
Your Doing an amazing Job. I have really enjoyed the hard work you have put in. Keep it up. @@DataIndependent
@hensonjhensonjesse
@hensonjhensonjesse Ай бұрын
I also never thought of purpose built chunking or semantic proxies like that. Adding question hypotheticals as the embedding could be extrapolated to other use cases.
@MrSawaiz
@MrSawaiz 4 ай бұрын
Love it
@DataIndependent
@DataIndependent 4 ай бұрын
thanks sawaiz
@nathank5140
@nathank5140 4 ай бұрын
This might just work for my meeting transcripts. Ts similar to something David Shaperio did. Where knowledge bases articles are written. And then reserved and updated during a conversation. I like the idea of using propositions and doing this at the article level.
@cag6825
@cag6825 3 ай бұрын
Great video. Some concepts in it overlap with the RAPTOR paper for RAG
@Sylarleft
@Sylarleft 3 ай бұрын
I feel like my mind was blown, brought together then blown again by 'level 4 - semantic search' part of the video
@DataIndependent
@DataIndependent 3 ай бұрын
Love it! Thanks for the comment
@hensonjhensonjesse
@hensonjhensonjesse Ай бұрын
Imagine langsmith for chunking. Something like the agentic flow you have but all chunk titles, summaries ECT... Are kept and able to be used for future tuning and other iterations.
@ahmadzaimhilmi
@ahmadzaimhilmi 3 ай бұрын
That agentic chunking really does sound like an interesting approach . How can we predefine the topics instead of them being automatically generated?
@krishnaprasad5874
@krishnaprasad5874 4 ай бұрын
What a great video. It would have taken me forever if if I was to research and learn more about this on my own. What a life safer. Do you have a video or a good resource about optimizing other RAG hyperparams and about reranking of chunks?
@DataIndependent
@DataIndependent 4 ай бұрын
Nope not yet, but there is more at FullStackRetrieval.com on RAG in general
@xinxunzeng9639
@xinxunzeng9639 Ай бұрын
Great video! it helped me clarify the past and present of all the chunks. I have a question, in agent chunking, there can be an issue of having too much content on a single topic. In extreme cases, an entire book might be about one topic. How should we further break it down in such situations?
@balkisdirahoui7622
@balkisdirahoui7622 4 ай бұрын
If I could like this video twice, I would have
@DataIndependent
@DataIndependent 4 ай бұрын
Thank you!
@IvanTsvetanov-yq7xu
@IvanTsvetanov-yq7xu 3 ай бұрын
Nice video, next level of chunking! Are you planning to have soon max_chunk_size?
@DataIndependent
@DataIndependent 3 ай бұрын
Hey, nope not at the moment, but it would be cool to add
@DarrenAllatt
@DarrenAllatt 2 ай бұрын
Human beings are always continuously learning. LLM’s should have all the abilities that we have.
@nfaza80
@nfaza80 2 ай бұрын
Theory & Importance of Text Splitting: Context Limits: Language models have limitations on the amount of data they can process at once. Splitting helps by breaking down large texts into manageable chunks. Signal-to-Noise Ratio: Providing focused information relevant to the task improves the model's accuracy and efficiency. Splitting eliminates unnecessary data, enhancing the signal-to-noise ratio. Retrieval Optimization: Splitting prepares data for effective retrieval, ensuring the model can easily access the necessary information for its task. Five Levels of Text Splitting: Level 1: Character Splitting: Concept: Dividing text based on a fixed number of characters. Pros: Simplicity and ease of implementation. Cons: Rigidity and disregard for text structure. Tools: LangChain's CharacterTextSplitter. Level 2: Recursive Character Text Splitting: Concept: Recursively splitting text using a hierarchy of separators like double new lines, new lines, spaces, and characters. Pros: Leverages text structure (paragraphs) for more meaningful splits. Cons: May still split sentences if chunk size is too small. Tools: LangChain's RecursiveCharacterTextSplitter. Level 3: Document Specific Splitting: Concept: Tailoring splitting strategies to specific document types like markdown, Python code, JavaScript code, and PDFs. Pros: Utilizes document structure (headers, functions, classes) for better grouping of similar information. Cons: Requires specific splitters for different document types. Tools: LangChain's various document-specific splitters, Unstructured library for PDFs and images. Level 4: Semantic Splitting: Concept: Grouping text chunks based on their meaning and context using embedding comparisons. Pros: Creates semantically coherent chunks, overcoming limitations of physical structure-based methods. Cons: Requires more processing power and is computationally expensive. Methods: Hierarchical clustering with positional reward, finding breakpoints between sequential sentences. Level 5: Agentic Chunking: Concept: Employing an agent-like system that iteratively decides whether new information belongs to an existing chunk or should initiate a new one. Pros: Emulates human-like chunking with dynamic decision-making. Cons: Highly experimental, slow, and computationally expensive. Tools: LangChain Hub prompts for proposition extraction, custom agentic chunker script. Bonus Level: Alternative Representations: Concept: Exploring ways to represent text beyond raw form for improved retrieval. Methods: Multi-vector indexing (using summaries or hypothetical questions), parent document retrieval, graph structure extraction. Key Takeaways: The ideal splitting strategy depends on your specific task, data type, and desired outcome. Consider the trade-off between simplicity, accuracy, and computational cost when choosing a splitting method. Experiment with different techniques and evaluate their effectiveness for your application. Be mindful of future advancements in language models and chunking technologies. Further Exploration: Full Stack Retrieval website: Explore tutorials, code examples, and resources for retrieval and chunking techniques. LangChain library: Discover various text splitters, document loaders, and retrieval tools. Unstructured library: Explore options for extracting information from PDFs and images. LlamaIndex library: Investigate alternative chunking and retrieval methods. Research papers and articles on text splitting and retrieval.
@shingyanyuen3420
@shingyanyuen3420 4 ай бұрын
Gold.
@DataIndependent
@DataIndependent 4 ай бұрын
nice!!
@henkhbit5748
@henkhbit5748 2 ай бұрын
Thanks, Excellent video about chunking strategies👍 Question: Can i store the pulled html table using unstructured in a vector database together with a normal text and asking question (RAG)?.
@zinebbhr651
@zinebbhr651 5 ай бұрын
Could attention be used here instead of the embeddings? Input every 2 sentences with overlap into an encoder. Above a certain threshold of "attention" from one sentence to another, have both in the same chunk
@shankstuv
@shankstuv Ай бұрын
Love this! I'm working with transcripts where semantically generated chunks can be quite large. These chunks need to be further divided to fit the limits of the embedding model. Given this, isn't semantic chunking unnecessary if we ultimately have to recursively break down the larger chunks into smaller ones?
@mlguy8376
@mlguy8376 26 күн бұрын
Rip to semantic search for large datasets 😂! But interesting approach.
@AR_7333
@AR_7333 6 ай бұрын
Agent chunking is a paradox. We aim to spilt the document into concise units to eliminate the noise so that the LLM can generate better answers. But we are asking the LLM to figure out the concise units by dumping all the propositions.
@DataIndependent
@DataIndependent 6 ай бұрын
Thanks for the comment! I take the other side of the argument where the correct chunks are task dependent, and creating those with character based methods is too crude.
@AR_7333
@AR_7333 6 ай бұрын
​@@DataIndependent , I agree that creating chunks with character based method is a naive approach. But my concern is: won't the LLM suffer from the same difficulty to process all the proposition to group together the relevant ones as it did when the entire document (without chunking) is given as context to the LLM.
@karthikb.s.k.4486
@karthikb.s.k.4486 6 ай бұрын
Great tutorials . Are there any courses or book written by you. Your explanation is excellent . Thank you. Can you please share the code which was shown in the demo.
@DataIndependent
@DataIndependent 6 ай бұрын
Check out fullstackretrieval.com for the code
@tomor3880
@tomor3880 5 ай бұрын
Hi Greg, Nice video! As for 4, did you considered to use fine tuned NLI models? i.e. combine 2 sentences if the model predicts entailment/natural relationship?
@DataIndependent
@DataIndependent 5 ай бұрын
I did - but it seemed like way overkill for the tutorial scope I'd like to explore that another time
@Himanshu-gg6vo
@Himanshu-gg6vo 2 ай бұрын
Hi... Any suggestion like how we can handle large chunks s some of the chunks are having token length greater then 4k !!
@MuhammadDanyalKhan
@MuhammadDanyalKhan 3 ай бұрын
@DataIndependent Hi Greg. Which type of splitting would you recommend when working with bank statement, invoices, balance sheets etc.
@actorjohanmatsfredkarlsson2293
@actorjohanmatsfredkarlsson2293 6 ай бұрын
Great video. Thanks for sharing. The level 5 implementation doesn't rewrite the proposition (e.g. It would still say "He likes walking" not "Greg likes walking"), or am I missing something!? I guess that would be another level of improvement? Any ideas how to implement that rewrite?
@actorjohanmatsfredkarlsson2293
@actorjohanmatsfredkarlsson2293 6 ай бұрын
Ah answer seems to be in the bouns part. Use a graph retriever.
@DataIndependent
@DataIndependent 6 ай бұрын
Hey thanks for the comment. The first step of getting the proposition would remove any of the “he likes doing X” Or maybe I’m not understanding the question correctly
@sticksen
@sticksen 5 ай бұрын
So, as you are using Langchain and Llama-Index - what do you prefer for which task? What are the pros and cons of each? I´ve also used both and have manifested an opinion.
@DataIndependent
@DataIndependent 5 ай бұрын
Nice! They both have pros and cons for different tasks. It's up to the dev w/ what they are most comfortable with
@saiashwalkaligotla6639
@saiashwalkaligotla6639 Ай бұрын
Hey Greg Thanks for an amazing tutorial, really loved all the strategies. I have couple of doubts. So if we do agentic chunking wont it cost too much and also considering the scale of the data we have and also i believe it would be very costly to update with a new item aswell every time. What about retrival strategies, Also how to tackle retrival strategies in QA chat setup. Thank you once again.
@DataIndependent
@DataIndependent Ай бұрын
Agentic chunking would definitely cost a lot, but the assumption is that latency and cost will go down so it will become more approachable. Do you mean how to do retrieval when building a chat bot?
@saiashwalkaligotla6639
@saiashwalkaligotla6639 Ай бұрын
@@DataIndependent yes, so i always had this doubt , during a chat we have the responses of user and assistants. Now say after 5 conversations , now if a user asks a question, Now how do we do retrieval of embeddings during this situation .
@eyemazed
@eyemazed 6 ай бұрын
just found the channel and i already know its gonna be big. remember me when you're famous
@DataIndependent
@DataIndependent 6 ай бұрын
The goal is to keep putting out good work - thanks Eye!
@vijaybrock
@vijaybrock 2 ай бұрын
Hi Sir, what is the best chunking method to process the complex pdfs such as 10K reports. 10K reports will have so many TABLES, How to load those tables to vectorDBs?
@erdoganyildiz617
@erdoganyildiz617 3 ай бұрын
Great content! I have one quick question though, You have specified that typically you go with chunk sizes around 2000-4000 characters. But isn't it a problem for the embedding stage? I believe 4000 characters roughly corresponds around 600-1000 tokens, popular small-sized sentence transformers (for embedding purposes) typically have context size around 512. What am I missing here? How do you meaningfully embed the long chunks? Any suggestions? Thanks in advance.
@ultracycling_vik
@ultracycling_vik 5 ай бұрын
Running the code, it always throws an error when using unstructured --> "No module named 'unstructured_inference.inference.elements' " Anyone solved it?
@haribattula5187
@haribattula5187 6 күн бұрын
I guess semantic search is what already vector databases are supporting.. and i don't find any advantages by doing sentence split, then calculating cosine distance and putting them in same bucket.. am i missing something here?
@awakenwithoutcoffee
@awakenwithoutcoffee Ай бұрын
Hi Greg, appreciate the fantastic breakdown of text splitting for LLM. Personally I keep finding LLM's having trouble retrieving whole chapters or pages. I was wondering why we wouldn't split based on page number instead of paragraph, would that slow down the LLM ? I'm temped to train a local LLM on chunking based on user input.
@DataIndependent
@DataIndependent Ай бұрын
You could split on page number, no problem! But then if your content spans pages, then you might lose context. You could store the page number and chapters in the metadata, then query and filter for those later on. Training a local LLM would be fun, but also a ton of work
@awakenwithoutcoffee
@awakenwithoutcoffee Ай бұрын
​@@DataIndependent Q: What I am wondering is why don't we use an LLM/custom parser to split a text based on a Document's Chapter's (1-3 pages)? Is it because this is difficult to do ? This would increase the chunk size but wouldn't it also solve our contextual issues ? - "You could store the page number and chapters in the metadata, then query and filter for those later on." Q: This sounds like a potential solution but I am honestly a bit overwhelmed with the application of it. Is there a specific tutorial that you can direct me to for study ? Your work is greatly appreciated Greg. I consider myself a student that one day hopes to contribute to the community like yourself, Cheers!
@Akimbofmg9_
@Akimbofmg9_ 5 ай бұрын
Is there a way to dynamically change the chunk size ? I have text where I want to split according 4 anchors let’s say. The 4 anchors have x amount of text in between them. So chunk size can say constant, and I’m trying to use regex to split the text.
@DataIndependent
@DataIndependent 5 ай бұрын
Check out level 2 and specify your own splitters and then chunk size
@Akimbofmg9_
@Akimbofmg9_ 5 ай бұрын
@@DataIndependent I’m sorry I meant to say chunk size cannot stay constant. This is for api call sequences from windows executables. They have varied names and argument sizes. But they do have module name, api name arguments and return values as constants. But the actual text in each field(args ret value etc) can vary according to the specific api.
@zugbob
@zugbob 3 ай бұрын
Awesome, I'm trying to do a similar thing with semantic chunking on historic chat messages, but every new message that comes in means you have to re-do the chunking. Can you think of a better way of chunking chat message history.
@DataIndependent
@DataIndependent 3 ай бұрын
Instead of redoing the all the chunks again you could try finding which cluster the embedding is closest with and naively add it to that one?
@zugbob
@zugbob 3 ай бұрын
@@DataIndependent Cheers, I did that at first but ended up doing something similar to the percentile method you mentioned. The issue was the overlapping possibly unrelated message threw off the cluster. I get the embedding of each new message and measure the similarity distance between each and then when a new message comes in and if it's > 85 percentile then it splits on that (with a minimum of 4-5 messages in a cluster with overlap).
@umeshkumarasamy6608
@umeshkumarasamy6608 26 күн бұрын
8:52 Thou shan't troll the beginners for you were one too. - Pro Code, Rule 4.
@datagus
@datagus 4 ай бұрын
Has someone solved this issue when running the function partition_pdf(). I get this error: module 'PIL.Image' has no attribute 'LINEAR'
@DataIndependent
@DataIndependent 4 ай бұрын
I would try upgrading all packages
@surajthakkar3420
@surajthakkar3420 6 ай бұрын
Hello Greg, Great video! ANy chnace we can get access to the Agentic chunking code?
@DataIndependent
@DataIndependent 6 ай бұрын
It's in this repo! Which you can find at fullstackretrieval.com
@surajthakkar3420
@surajthakkar3420 6 ай бұрын
Thank you for the reply, maybe i'm just dumb but I cannot find link to the repository anywhere after the sign up. I tried to use the search bar as well as CTRL+F. Would be great if you could post it here. @@DataIndependent
@DataIndependent
@DataIndependent 6 ай бұрын
Here ya go github.com/FullStackRetrieval-com/RetrievalTutorials/blob/main/5_Levels_Of_Text_Splitting.ipynb @@surajthakkar3420
@surajthakkar3420
@surajthakkar3420 6 ай бұрын
Thank you so much Greg!@@DataIndependent
@raulgarcia6191
@raulgarcia6191 15 күн бұрын
I've a better way for imsgesyin PDF, I converted PDF to markdown and turn all images to markdown image reference, then put all the images in a separate folder, that way my embeddings show markdown text with markdown images which can later be turned into html images in the chatbot
@joshlopez7727
@joshlopez7727 4 ай бұрын
Does anyone have an example of agentic chunking (level 5) as javascript?
@DataIndependent
@DataIndependent 4 ай бұрын
I bet you could feed the agentic chunking python code into gemini (or claude 3) and get a pretty good starting point to make it yourself
@shuvobarman9294
@shuvobarman9294 4 ай бұрын
When I try to run the same code for reading tables from pdf and saving image from pdf my kernel shutdown and gives message that it will restart again. How to overcome this? Thanks
@DataIndependent
@DataIndependent 4 ай бұрын
weird - I haven't seen that one before. I would double check that all packages are up to date
@shuvobarman9294
@shuvobarman9294 4 ай бұрын
I have tried the same code with Google Colab, and it's working just fine. The issue was with my anaconda environment as it seems. Thanks a lot for creating such a depth video. Learned a lot.
@AdamTwardoch
@AdamTwardoch 3 ай бұрын
One useful technique for performing sentence embedding is to apply COREFERENCE RESOLUTION, with a cheap model like Haiku: """Identify pronouns, definite noun phrases, and other referring expressions in the text (for example "it", "he", "she", "they", "this", "that", "those", "their" etc.). Determine the antecedent or the entity to which each referring expression refers. Apply coreference resolution by replacing the referring expressions with their antecedents or a more explicit description of the entity."""
@AdamTwardoch
@AdamTwardoch 3 ай бұрын
This makes each sentence self-sufficient semantically, and you get huge improvements this way. This is useful for any kind of chunking.
@AdamTwardoch
@AdamTwardoch 3 ай бұрын
Grammar simplification also may be useful: """Optimize the syntax and grammar. Identify syntactic and grammatical problems such as complex phrases, clauses, and sentence structures, as well as passive voice, embedded clauses, or convoluted sentence constructions. Break these syntactic and grammatical problems down into simpler, more concise sentences, and rephrase them using simpler structures, such as active voice or straightforward subject-verb-object constructions."""
@TalhaJSiam
@TalhaJSiam 3 ай бұрын
Do you havy any example notebook or code for this ? Or any way I can contact you ?
@jlsachse
@jlsachse 2 ай бұрын
There is a spacy module for coreference resolution called "neuralcoref" which works without an LLM. I wonder whether neuralcoref + a clustering algorithm, e. g. BERTopic, could replace the use of LLMs and make the process cheaper.
@RobertoFabrizi
@RobertoFabrizi 6 ай бұрын
Maybe I'm missing something here, but isn't there the risk that in the Date&Time chunk you end up getting a chunk that reads "The month is October" and another that reads "The year is 2023" but that don't relate to the same context in the original source? In other words, are we sure that those wouldn't be placed togheter unless it was actually October 2023 in the source?
@DataIndependent
@DataIndependent 6 ай бұрын
Because we use propositions the hypothesis and aim is that of Oct 2023 was related to something then the proposition would include that something. So like “it was October 2023. Bob was 18” then the proposition would be “Greg was 18 in Oct 2023.” I think that is what you’re referring to?
@jonintc
@jonintc 6 ай бұрын
Yea I had a similar feeling but the wfh prompt template asks the LLM to break sentences into propositions. Greg then fed it by paragraph so the assumption is the paragraph has a direct relation. It would be good to test this against a paragraph that vaguely makes two related claims. Example: The year is 2023 and Jon had many gatherings. Jon celebrated his birthday last month in July. Jon’s favorite birthday party was in 2006.
@DataIndependent
@DataIndependent 6 ай бұрын
@@jonintc definitely valid points around, I did a paragraph because it was a manageable chunk. The example in the prompt is much longer and more complicated so you could experiment increasing this window size.
@OccamsPlasmaGun
@OccamsPlasmaGun 5 ай бұрын
Wouldn't it make sense to use prepositional heirarchical chunking, where each embedding vector includes indexing to the document, section and paragraph? That way, propositions that seem unrelated but relate to the same discussion are mapped close together in some axis.
@DataIndependent
@DataIndependent 5 ай бұрын
@@OccamsPlasmaGun definitely worth a try! sounds like a good experiment
@ivant_true
@ivant_true 6 ай бұрын
How would you suggest to split legal documents ?
@DataIndependent
@DataIndependent 6 ай бұрын
depends on the format - assuming their PDFs, probably starting with unstructured as a proof of concept
@ivant_true
@ivant_true 6 ай бұрын
​@@DataIndependent They are HTMLs and PDFs, unstructured is for parsing the documents themselves I guess, I was asking about splitters(to further split those documents)
@kyunglee1924
@kyunglee1924 6 ай бұрын
cool ideas, another way is keybert till keyword repetition stops
@DataIndependent
@DataIndependent 6 ай бұрын
Cool thanks for sharing
@ihateorangecat
@ihateorangecat 3 ай бұрын
OMG this video is so precious for me❤. I am a web dev and started studying LLMs for fews days now. I had no idea about "splitting" "embeddings" "retrieval" etc. You really well explained in here. Thanks!
@MrDespik
@MrDespik 6 ай бұрын
Unstructured is a great package... But very very slow. If you need to work with big pdfs you will need 10+mins to extract all images and tables...
@DataIndependent
@DataIndependent 6 ай бұрын
Ooo - have you found an alternative method that works better?
@MrDespik
@MrDespik 6 ай бұрын
@DataIndependent I am trying to extract tables with the same approach that unstructured uses. Detect tables with detectron2, crop table image and extract table info with table transformer from Microsoft. Or we can try to do everything with table transformed. There is a great package llmsherpa... but they provide API, so difficult to use it in production, cuz I don't want to send someone client documents
@MrDespik
@MrDespik 6 ай бұрын
I know that unstructured provide API and it is possible to work with this API in async, but haven't tried yet.
@MrDespik
@MrDespik 6 ай бұрын
Ah. And of course. Azure document intelligence extract tables really great. And it can chunk text too.
@paulluka7594
@paulluka7594 Ай бұрын
good video but you speak so fast
@joseph_thacker
@joseph_thacker 6 ай бұрын
Hey greg, do you have a discord?
@DataIndependent
@DataIndependent 6 ай бұрын
Nope! I don’t want to manage a community unless it’s curated and focused and it is not a priority for my energy right now. Maybe in the future
The LangChain Cookbook - Beginner Guide To 7 Essential Concepts
38:11
Greg Kamradt (Data Indy)
Рет қаралды 333 М.
Chunking Best Practices for RAG Applications
53:45
HOW DID HE WIN? 😱
00:33
Topper Guild
Рет қаралды 42 МЛН
تجربة أغرب توصيلة شحن ضد القطع تماما
00:56
صدام العزي
Рет қаралды 50 МЛН
5 Levels Of LLM Summarizing: Novice to Expert
19:19
Greg Kamradt (Data Indy)
Рет қаралды 50 М.
Learn RAG From Scratch - Python AI Tutorial from a LangChain Engineer
2:33:11
From RAG to RAG Fusion to RAPTOR   An AI Development Journey
40:40
John Capobianco
Рет қаралды 2,4 М.
OpenAI Embeddings and Vector Databases Crash Course
18:41
Adrian Twarog
Рет қаралды 419 М.
A Hackers' Guide to Language Models
1:31:13
Jeremy Howard
Рет қаралды 511 М.
GraphRAG: LLM-Derived Knowledge Graphs for RAG
15:40
Alex Chao
Рет қаралды 90 М.
Semantic Chunking for RAG
29:56
James Briggs
Рет қаралды 19 М.
Cosmology in Crisis? Confronting the Hubble Tension
36:26
World Science Festival
Рет қаралды 78 М.
⚡️Супер БЫСТРАЯ Зарядка | Проверка
1:00
1$ vs 500$ ВИРТУАЛЬНАЯ РЕАЛЬНОСТЬ !
23:20
GoldenBurst
Рет қаралды 1,7 МЛН
Cheapest gaming phone? 🤭 #miniphone #smartphone #iphone #fy
0:19
Pockify™
Рет қаралды 1,8 МЛН
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 8 МЛН
Как распознать поддельный iPhone
0:44
PEREKUPILO
Рет қаралды 1,4 МЛН
Todos os modelos de smartphone
0:20
Spider Slack
Рет қаралды 4,2 МЛН