Posts

[Day 81] RAG from scratch - chunking is very important!

Image
 Hello :) Today is Day 81! A quick summary of today: Continued with my custom RAG from scratch project - extracting knowledge from a bank's terms and conditions ( github repo ) So, yesterday my main struggle was reading tables. I remembered gemini can read pictures so I gave the below to gemini to try to read and give me the text.  The output, not very good. Gemini could not read this table very well, and such tables were common in yesterday's PDF Yes, this is an image, but even if a powerful gemini LLM could not read this table and output it as text, for now at least, I gave up on this particular PDF, and looked for one with a bit more straigh-forward text and less tables.  The newly chosen pdf is here:  on github Now... given an allegedly more simple pdf, I used the code as it was to get outputs. But the results were just... really bad. Most times even though the scores were high, and the top-1 included the exact answer, the output was  ~'the context does not ...

[Day 80] Starting to write my own RAG from scratch on a bank's T&C pdf

Image
 Hello :) Today is Day 80! A quick summary of today: based on yesterday's RAG from scratch, I decided to create a new one, based on a pdf chosen by me I uploaded the code so far on this github repo , and below is an overview of my progress so far. Firstly, what document?  I wanted to use a document that is shorter (tutorial used 1200 page doc), but a bit more complex - including tables, more numbers. So I chose a bank's terms and conditions 32 page document ( source ). The file itself is in the github repo.  Sample content Firstly, I decided to follow the tutorial's code, but just shortening it and make it more comfortable to use.  To embed the text I tried using mixedbread-ai/mxbai-embed-large-v1 (new SoTA) and all-mpnet-base-v2 (from tutorial). Each model has to be used following specific instructions, for example, the all-mpnet one directly outputs normalised scores, but the mixedbread-ai one outputs raw scores, and cosine similarity function needs to be...

[Day 79] Attempting to make a Local Retrieval Augmented Generation (RAG) from Scratch

Image
 Hello :) Today is Day 79! A quick summary of today: Started this tutorial for building a local RAG from scratch and dealt with issues due to me being on a mac A 1 line summary of the tutorial: wow!!! amazing!!! haha The tutorial is focused on cuda, but instead of colab, I wanted to try to do this locally: 1. to see the limits of my m2 pro 2. to deal with issues not shown in the video I am almost at the end - 4:49:34 / 5:40:58, but it is 2am and I am falling asleep on the keyboard even writing this post now.  The tutorial is pretty amazing, it follows the below graph The pdf used for the tutorial is a 1200 page book about nutrition, and the goal is to create a model with which we can talk and ask questions about nutrition. My thoughts of using this are afterwards I would use research papers, and test it with them.  The steps to success are: Open a PDF doc (or collection of PDFs) Format the text, ready for an embedding model Embed the chunks of text and turn into embeddin...

[Day 78] NVIDIA GTC talks + accepted to Stanford AI professional certificate + PERL

Image
 Hello :) Today is Day 78! A quick summary of today: Out of the 4 sessions I joined from NVIDIA GTC, the AI careers in Europe one was the most interesting my application and thoughts about Stanford's AI professional certificate program  Research paper about PERL: Parameter Efficient Reinforcement Learning from Human Feedback The 4 sessions that I had marked to join today were 1. Retrieval Augmented Generation: Overview of Design Systems, Data, and Customization 2. Navigating AI Careers in Europe 3. Customizing Foundation Large Language Models in Diverse Languages With NVIDIA NeMo 4. LLM Inference Sizing: Benchmarking End-to-End Inference Systems But besides the 2nd one about AI careers in Europe, the other did not manage to catch my interest. They were talking about research on RAGs, how many GPUs are needed to do LLM inference, based on NeMo which I had not used up until now. Nevertheless, the 2nd talk was very good because I could ask questions to an HR r...

[Day 77] Review of the ACL 2023 talk, and lecture 10 from CMU's advanced NLP course about retrieval models

Image
 Hello :) Today is Day 77! A quick summary of today: I wanted to review all the content again from the ACL 2023 talk on retrieval-based models (all my notes can be found in the posts from the last 3 days) Also decided to cover lecture 10 : Retrival and RAG from CMU's 11-711 Advanced NLP course RAG seems to be an important topic these days, and recently I tried Gemini for the first time too, and on some topics it does give the source, so it is kind of cool and 'hot' in the LLM sphere, and I just read over my notes one more time to clear up any spots. In regards to lecture 10 on retrieval and RAG by professor Neubig, below are my notes (some content was covered twice, so I am just pointing to the appropriate section of my notes from the ACL talk that covers the particular topic in depth) Tomorrow is the NVIDIA conference. So I am looking forward to that ^^ That is all for today! See you tomorrow :)

[Day 76] Finishing the Retrieval-based LM talk, and learning about distillation, quantization and pruning

Image
 Hello :) Today is Day 76! Finished section 6 and 7 about multilingual retrieval-based LMs and retrieval-based LMs' challenges and opportunities ( ACL 2023 ) Covered  lecture 11  of CMU 11-711 Advanced NLP - Distillation, Quantization, and Pruning Section 6: Section 7: Lecture 11: Distillation, Quantization, and Pruning Problem: The best models for NLP tasks are massive. So how can we cheaply, efficiently and equitably deploy NLP systems at the expense of performance? Answer: Model compression Quantization -  keep the model the same but reduce the number of bits Pruning -  remove parts of the model while retaining performance Distillation -  train a smaller model to imitate the larger model Quantization - no parameters are changed, up to k bits of precision Amongst other methods, we can use post-training quantization We can binarize the parameters and activations  Pruning - a number of parameters are set to zero, the rest are unchanged There is Ma...

[Day 75] Retrieval-based LMs training and applications

Image
 Hello :) Today is Day 75! A quick summary of today: covered Section 4: retrieval-based LMs training of ACL 2023 covered Section 5: Applications Found out about NVIDIA GTC 2024 which is next week and registered for some of the events Firstly, as for the NVIDIA GTC courses that I registered for over the course of the conference: There is also a paid workshop on Building Transformer-Based Natural Language Processing Applications but it is sold out, and even though I have joined the waiting list, my hopes are not high haha. As for my notes on section 4 and 5 of the retrieval-based LM talk Section 4: Retrieval-based LMs: Training Section 5: Retrieval-based LMs: Applications There is ~30mins left, which I skimmed through and are not that long, but will cover tomorrow :) That is all for today! See you tomorrow :)