RAPTOR - Advanced RAG with LangChain

Поделиться
HTML-код
  • Опубликовано: 25 июл 2024
  • RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrieval - new and powerful indexing and retrieval technique for LLMs. I will show you both theory and practice behind this.
    Code: github.com/Coding-Crashkurse/...
    Paper: arxiv.org/html/2401.18059v1
    Timestamps:
    00:00 What is RAPTOR?
    01:29 Create Documents (High & Low-Level)
    11:36 Indexing
    13:00 Retrieval
    #RAPTOR #langchain

Комментарии • 42

  • @andreypetrunin5702
    @andreypetrunin5702 4 месяца назад +1

    Спасибо! Наши знания становятся все шире и шире! )))

  • @reticentrex8446
    @reticentrex8446 4 месяца назад

    Always love your vids mate, cheers!

  • @8eck
    @8eck 3 месяца назад +1

    Very interesting approach with getting optimal clusters size. I did something similar in the past, via genetic algorithms.

  • @kai1234763
    @kai1234763 4 месяца назад +1

    Very impressive! Thanks for sharing!
    It would be great to see a comparison of the results. Once with RAPTOR and once simply vectorizing the documents in the classic way.

    • @codingcrashcourses8533
      @codingcrashcourses8533  4 месяца назад

      Yes, but so far i only saw this as prove of concept. I think its not too easy to make that work fully dynamic with a large set of raw data. Where to make the cutoff?

  • @henkhbit5748
    @henkhbit5748 4 месяца назад +1

    Great video, better than the Langchain video. This concept has alot of overhead and thus a performance impacr 2 be practical. its a simimar approach with the master detail summarization but with extra steps i.e clustering etc.

  • @8eck
    @8eck 3 месяца назад

    So you are filtering out any clustered points where probability of belongingness to a specific cluster is lower than specified threshold?
    Haven't seen GMM algorithm before, looks very interesting.
    Basically, you are filtering outliers by providing that threshold. Super cool.

  • @MEvansMusic
    @MEvansMusic 3 месяца назад

    what is the purpose of the dimensionality reduction step prior to clustering? is it because clustering is computationally expensive and reducing before hand helps? or is there a different reason ?

  • @georgefraiha6597
    @georgefraiha6597 4 месяца назад

    Great Video Love it. But does it work when we have thousands of periodically changing files use case or it will be very expensive

    • @codingcrashcourses8533
      @codingcrashcourses8533  4 месяца назад

      Good point! Probably not the best idea since you have to recalculate the clusters

  • @YueNan79
    @YueNan79 3 месяца назад

    Hey I got a issue, What if sum of cluster documents exceed maximum token of summary chain ?

  • @JeisonJimenez-tb3nc
    @JeisonJimenez-tb3nc 3 месяца назад

    Excellent video, I have a question and I want to ask questions to my documents (there are more than 3500), currently I am doing it dividing them in small chuck vectorizing them and storing them locally with chromadb and I am using the RetrievalQA class of langchain but I am not getting accurate results, but ambiguous answers, I am using the LLM Mistral-7b. How can I adapt this Raptor approach to my use case, is it possible to save this clouster classification in my vectors in chromadb?

    • @codingcrashcourses8533
      @codingcrashcourses8533  3 месяца назад +1

      you can use raptor, but first and best way to improve RAG Performance is better data. 3500 Datasets is quite a lot for RAG.

  • @corpsed5201
    @corpsed5201 Месяц назад

    hello, i am trying to make a rag chatbot for academic books. what rag techniques do you suggest me to adopt. I have been a lot of videos lately but cannot decide on one method. is RAPTOR any good for my use case? I have minimum latency, have watched about fusion and crag also, but i they are too slow for a chatbot response.

  • @trashchenkov
    @trashchenkov 3 месяца назад +1

    If we have completed all the steps to create a vector database using the RAPTOR method, and then the task of adding new documents appears, do we need to do everything all over again? Regularly updating the database can then become very expensive.

    • @codingcrashcourses8533
      @codingcrashcourses8533  3 месяца назад +2

      Yes, raptor is not Well Suited for data that has to be Updated regularly

  • @rowdyjuneja
    @rowdyjuneja 3 месяца назад

    Great video! Question - How does this process evolve in a production setting? What happens if I want to add new documents? It seems like you would need to rerun the entire process.

    • @codingcrashcourses8533
      @codingcrashcourses8533  3 месяца назад

      Yes, thats a big contra of this. You only want to perform RAPTOR for data that does not change

  • @Girijeshcse
    @Girijeshcse 3 месяца назад

    I have a similar use case of having a long context as well as the output should also be large, like from the documents of all restaurants in a town. If I ask list down all the restaurants that serve Italian food, I tried RAPTOR but it's not working in this case, can you suggest what can be done here?

    • @codingcrashcourses8533
      @codingcrashcourses8533  3 месяца назад

      I will release a Video on routing and an llm Perform sql queries next week. Your data sounds if it Was Tabular, so maybe this might be worth a look

    • @Girijeshcse
      @Girijeshcse 3 месяца назад

      @@codingcrashcourses8533 It's not tabular data, it is data from an internal website where all the projects and related information are shared, I can say it's more hierarchical so I tried to use a knowledge graph but as we have to use OSS LLM which is not able to do proper nl2cypher generation.
      I am wondering about some vector db approaches with some indexing strategy and some chunking tweaks can help :(
      Also in original question, I was trying to give a similar problem :D

  • @loicbaconnier9150
    @loicbaconnier9150 4 месяца назад +1

    Thanks very good video
    Why don’t you try to make some clusterering on each on the 3 mains clusters ? Must be test no ?

    • @codingcrashcourses8533
      @codingcrashcourses8533  4 месяца назад +1

      What do you exacty mean with Clustering on the 3 main clusters? I did so and ended up with a single "cluster". :-)

    • @loicbaconnier9150
      @loicbaconnier9150 4 месяца назад

      I mean make a clistering for each cluster to have subcluster ( so less length for texts to summarize )

    • @codingcrashcourses8533
      @codingcrashcourses8533  4 месяца назад +1

      ​@@loicbaconnier9150 Clustering does not work that way. Clustering works bottom up. You got many documents and end up with few clusters. But you can not have a large cluster and identify subclusters. You probably talk about a Pricipal Component Analysis.

    • @loicbaconnier9150
      @loicbaconnier9150 4 месяца назад

      No i mean you take all dataset
      initial clustering give you 3 clusters
      what i will try is to make clustering on each 3

    • @codingcrashcourses8533
      @codingcrashcourses8533  4 месяца назад +1

      @@loicbaconnier9150 Sorry maybe I am stupid but I think this is exactly what I did. I created clusters, summarised the clusers, embedded the summaries and again and clustered it again. You do that bottom up.If that is not what you mean, can you maybe rephrase your questios with a example?

  • @mrchongnoi
    @mrchongnoi 3 месяца назад

    How would this work on a 259 page document like the Tesla 2020 Financial Report ?

    • @codingcrashcourses8533
      @codingcrashcourses8533  3 месяца назад

      Depends on the model. With something like Gemini, you could probably start with the complete document, with other models you have to start with independent chapters. RAPTOR works best with long context window models

  • @timtensor6994
    @timtensor6994 3 месяца назад

    Was just wondering what your setup specs are. For me a simple langchain query takes around 4-5 mins

    • @codingcrashcourses8533
      @codingcrashcourses8533  3 месяца назад

      Are you behind a vpn?

    • @timtensor6994
      @timtensor6994 3 месяца назад

      @@codingcrashcourses8533 no no not at all . I am also using local models and embeddings

  • @saravanannatarajan6515
    @saravanannatarajan6515 4 месяца назад

    Such a great topic and you covered very nicely, thanks!
    Can we use the clustering method as mentioned in the video to create summarization task (since I feel its interesting) please suggest if you have any idea

    • @codingcrashcourses8533
      @codingcrashcourses8533  4 месяца назад

      Probably! But I would proably use models with a large context window and try to provide it chapter by chapter. This is more suited for RAG.

  • @IljaUchiah1997
    @IljaUchiah1997 2 месяца назад

    in my street there is a restaurant called bella vista and the owner is giovanni. you live in osnabrück?