Fine tuning LLMs for Memorization

Ғылым және технология

➡️ ADVANCED-fine-tuning Repo (incl. Memorization Scripts): trelis.com/advanced-fine-tuni...
➡️ One-click Fine-tuning & Inference Templates: github.com/TrelisResearch/one...
➡️ ADVANCED-inference Repo: trelis.com/enterprise-server-...
➡️ Trelis Function-calling Models: trelis.com/function-calling/
➡️ Trelis Newsletter: Trelis.Substack.com
➡️ Trelis Resources and Support: Trelis.com/About
Affiliate Link (supports the channel):
- RunPod - tinyurl.com/4b6ecbbn
VIDEO RESOURCES:
- Slides: docs.google.com/presentation/...
- Dataset: huggingface.co/datasets/Treli...
TIMESTAMPS:
0:00 Fine-tuning on a custom dataset
0:18 Video Overview
1:28 GPTs as statistical models
2:07 What is the reversal curse?
4:08 Synthetic dataset generation
8:28 Choosing the best batch size
14:17 What learning rate to use for fine-tuning?
14:50 How many epochs to train for?
16:04 Choosing the right base model
17:12 Step by step dataset generation
28:20 Fine-tuning script, step-by-step
40:47 Performance Ablation: Hyperparameters
42:56 Performance Ablation: Base Models
46:00 Final Recommendations for Fine-tuning for Memorization

Пікірлер: 31

  • @bobg-abc123
    @bobg-abc1233 ай бұрын

    You have the best AI content out there hands down. While other people are just out there parroting the obvious you are actually teaching how this stuff really works. I thank you!

  • @TrelisResearch

    @TrelisResearch

    3 ай бұрын

    big thanks

  • @user-zh6zn4hk1k
    @user-zh6zn4hk1k4 күн бұрын

    This guy is a professor? excellent!!!!

  • @HistoryIsAbsurd
    @HistoryIsAbsurd3 ай бұрын

    Awesome, always a good day when you upload. Thanks again good sir!

  • @JulianHarris
    @JulianHarris3 ай бұрын

    Wow I’d appreciated rephrasing for data augmentation in general but not specifically to handle the reversal curse. Brilliant insight!

  • @unsaturated8482
    @unsaturated84823 ай бұрын

    awesome, was waiting for this

  • @francycharuto
    @francycharuto2 ай бұрын

    Wow! Glad I found you

  • @alchemication
    @alchemication3 ай бұрын

    This is very cool, and indeed similar to my recent approach to data generation for gpt3.5 fine tuning (needed milti-lingual support). It would be great to evaluate the diff in performance between FT and RAGs, as in theiry RAGs might be easier to manage when data changes more often, right?

  • @TrelisResearch

    @TrelisResearch

    3 ай бұрын

    Yes, definitely RAG generally the preferred option. I'm just separating here and focusing on fine-tuning, will be back fairly soon with more on the RAG front.

  • @abhisheksingh1510
    @abhisheksingh15103 ай бұрын

    Excellent

  • @aasembakhshi
    @aasembakhshi3 ай бұрын

    Great stuff, as always. How good would this approach be for text inviting higher order QA such as philosophy or sociology texts? Thanks.

  • @TrelisResearch

    @TrelisResearch

    3 ай бұрын

    Hmm, could you reframe your question, maybe with an example - to help me better respond

  • @aasembakhshi

    @aasembakhshi

    3 ай бұрын

    In all the example implementations, may it be with embeddings or fine tuning, QA is usually posed to use cases with factual data like rule book or manuals or stuff like that. What about very complex and multilayered texts like history or philosophy? For example if we use GPT4 to chat with a book like History of Western Philosophy, it will reply that who is the author and other factual questions but won't be able to carry out a deep discussion keeping material of the book in context. So can we use LLMs as memory machines of Philosophy or History tomes?

  • @loicbaconnier9150
    @loicbaconnier91503 ай бұрын

    Awasome video

  • @sergei202
    @sergei2022 ай бұрын

    As always, great content! But why is the video quality limited to 720p?

  • @TrelisResearch

    @TrelisResearch

    2 ай бұрын

    hmm, thanks, I'm going to check that going forward and aim to upload higher.

  • @TrelisResearch

    @TrelisResearch

    2 ай бұрын

    ok, yeah, thanks, I realised my computer camera is 720p, I'm going to shoot with a better camera from now on.

  • @user-fw9yb4yx9c
    @user-fw9yb4yx9c2 ай бұрын

    Thanks for this tutorial! How does this approach compare to something like MemGPT?

  • @TrelisResearch

    @TrelisResearch

    2 ай бұрын

    I'm not intimately familiar with MemGPT but it involves taking your conversation history and storing it in a database so it can be reused. By comparison, if you fine-tuning, you are actually updating the model weights to incorporate the info (which will be faster as an approach, but takes the effort and skill to actually do the fine-tuning).

  • @user-fw9yb4yx9c

    @user-fw9yb4yx9c

    2 ай бұрын

    Thank you!@@TrelisResearch

  • @adidevbhattacharya9220
    @adidevbhattacharya92202 ай бұрын

    Can this same strategy of synthetic data be effective for fine-tuning gpt on openai platform? So basically consider this: I have a short story(around 10k tokens long). I have divided the entire story into list of situations and incidents(around 13). For each incidents I have the original text from the story. Now I create questions from different angles for each incidents. When a user asks query to my system, will the fine-tuned gpt be able to identify the incident in which this question lies? What I think is that fine-tuning and iverfitting on rugby rules is quite easier that on some story or novel. Becasue in case of rugby rules you have one word or one-liner answer. In case of stories their is context in the first paragraph as well as the ending paragraphs too and therefore it makes it more tough imo. For e.g. If you had to ask about the nature of Harry Porter, there is no one line answer, the model needs to know context from various paragraphs before answering it Correct me if I am wrong and if possible can you try memorization of novel or a story, I think its a more intelligent system that QnA on set of rules. Thanks!

  • @TrelisResearch

    @TrelisResearch

    2 ай бұрын

    Yes, I think the same concept can be used, and I agree you are right that it will take more (and longer) synthetic data to achieve the same effect. Starting with situations/incidents/plot-points makes good sense.

  • @adidevbhattacharya9220

    @adidevbhattacharya9220

    2 ай бұрын

    Can you maybe prepare a brief guide on the steps(or a video) for giving knowledge base of some novel or story. Thanks@@TrelisResearch

  • @TrelisResearch

    @TrelisResearch

    2 ай бұрын

    ​@@adidevbhattacharya9220 it's a good thought, but probably be a while before I come back around to the storytelling use case, as I've laid out the basic approach here and people can build on that. Probably it makes sense to do unsupervised fine-tuning on the novel and then additionally do this supervised fine-tuning approach with some plot points from each chapter.

  • @divyagarh
    @divyagarh3 ай бұрын

    Can I use this fine-tuning script for Llam2 models?

  • @TrelisResearch

    @TrelisResearch

    3 ай бұрын

    Yes, definitely

  • @EminTemiz
    @EminTemiz2 ай бұрын

    a noob question: why are you not training on the PDF itself but converting to chat and training on the chat?

  • @TrelisResearch

    @TrelisResearch

    2 ай бұрын

    a) The LLM needs to see the knowledge from different angles (otherwise it will only be fine-tuned on those exact phrases and won't generalise as well b) if you just fine-tune on the pdf, the LLM will start losing the ability to respond in chat format (because the pdf is not chat format).

  • @AnoniChocolateMoose
    @AnoniChocolateMoose3 ай бұрын

    batch size 0.o

Келесі