Easily Fine Tune ChatGPT 3.5 to Outperform GPT-4!

Sdílet
Vložit
  • čas přidán 14. 06. 2024
  • I’ll show you how to set up your training data to fine-tune OpenAI’s ChatGPT 3.5 Turbo. A fine-tuned GPT 3.5 Turbo can be smarter than GPT-4. I’ll go step by step, and show you strategies for setting up your data to ensure you get the smartest model possible.
    All Files & Data from Video:
    drive.google.com/drive/folder...
    Python Code: colab.research.google.com/dri...
    Other Videos:
    AI Phone Scheduler - • Build Your Own AI Rece...
    AI for Automating Cold Calling - • Using ChatGPT to Autom...
    Phone Negotiating Bot - • Save Money: AI Negotia...
    GPT that makes Calls - • Custom GPT with Bland ...
    Fine-Tune Llama-2 - • The Secret to Fine-Tun...
    Fine-Tune ChatGPT 3.5 - • Easily Fine Tune ChatG...
    Build an AI Texting Bot - • Fine-tuning ChatGPT to...
    Fine-Tune ChatGPT 3 - • Transform ChatGPT into...
    Embed Data with ChatGPT - • Learn to Embed Data wi...
    Build a chatbot - • Create your own AI cha...
    How I got GPT4 access - • Here's how I got appro...
    API keys - • How to Access OpenAI A...
    Chapters:
    0:00 - Intro
    2:05 - Data Formatting
    7:17 - Coding
    13:17 - Cost/Token Count
    16:37 - Send Data to OpenAI
    17:26 - Start Fine-Tuning
    19:33 - Fine-Tuning Completes
    20:48 - Test it out!
    #ai #artificialintelligence #chatgpt #api #chatgpt4 #gpt4 #fine-tuning #openai #llm #gpt3 #howto #tutorial #tech #technology #python
  • Věda a technologie

Komentáře • 91

  • @turyng-or1js
    @turyng-or1js Před 8 měsíci +1

    Man, you really rock! Very concise and strict to the point. Love it.

  • @michaellavelle7354
    @michaellavelle7354 Před 9 měsíci +2

    Great job. You don't miss a thing in your description. Thanks a lot.

  • @arupmmi07
    @arupmmi07 Před 3 měsíci +2

    Excellent, Best fine-tuning video I saw! Thanks a Lot.

  • @truckfinanceaustralia1335
    @truckfinanceaustralia1335 Před 9 měsíci +2

    Love your work! haven't found anything else like it on youtube 👌

  • @yizhouqian5899
    @yizhouqian5899 Před 8 měsíci +3

    I'm pretty sure this video will reach millions of views in a short period of time! Thank you so much for the detailed instructions!

  • @TuryngsTech-cc1gy
    @TuryngsTech-cc1gy Před 8 měsíci +1

    Thank you for your awesome videos!

  • @silviocavini163
    @silviocavini163 Před 3 měsíci

    This must be the best tutorial I've ever seen. Thanks!.

  • @deltagamma1442
    @deltagamma1442 Před 7 měsíci +1

    From scratch and to the point. I generally don't comment, but great job!

  • @adrianorobson6365
    @adrianorobson6365 Před 7 měsíci +1

    Good work man. Thansk for your time

  • @user-xd5ne5nl4e
    @user-xd5ne5nl4e Před 9 měsíci +1

    Excellent video!

  • @wiktormigaszewski8684
    @wiktormigaszewski8684 Před 27 dny +1

    Nice one, thnx!

  • @joelswann2310
    @joelswann2310 Před 7 měsíci

    Awesome job brother! Would you do a tutorial on fine tuning and embedding ChatGPT 3.5 to write a fiction novel?

  • @farhanafridi8694
    @farhanafridi8694 Před 9 měsíci +1

    Your channel will boom in the coming months..

  • @NikhilKopardeMusicComposer
    @NikhilKopardeMusicComposer Před 6 měsíci

    Such an amazing Demo. Thank you. :)
    I have a specific use case where I want to train the model on long-form stories/content written by me and later generate new ones on other topics section by section maintaining my style of writing. Should I be loading each story as one example in the data set or breaking them up would be suggested?

    • @tech-at-work
      @tech-at-work  Před 6 měsíci +1

      Thank you! For this, I would break them up, so for example "write an introductory paragraph for an article covering elephant migrations" etc

  • @VarshaShirole-vz8fk
    @VarshaShirole-vz8fk Před 5 měsíci +1

    Excellent video !! thanks a lot
    Great effort
    One question if i am having one pdf file data to train model ,i have to follow same step as above that is convert to training data?

    • @tech-at-work
      @tech-at-work  Před 5 měsíci

      Thank you! Yes it would be the same steps, and data formatting - it might be easier to copy the data from the pdf and then format it in excel (easier to format data in excel) - ChatGPT can help you with excel format formulas if you feed it an example

  • @adriaanb7371
    @adriaanb7371 Před 9 měsíci

    thanks, nice level of hands-on!
    This just changed the style of answering right. You could actually teach it on a bunch of information particular to your airbnb, surroundings, usual problems etc?
    It should be more common to get chatbots that have been fed all the docs on some company's product line etc. Would love to fine-tune on particular info that is past the models date... (with a single press of a button though)

    • @tech-at-work
      @tech-at-work  Před 9 měsíci +1

      You’re correct, the fine tuning is setting the style and tone of the response, but not really adding new information. Embedding is the best way to teach the model new facts. My video on building a business chatbot does this with facts on Apple’s Vision Pro. Otherwise, you’re stuck pre-promoting the bot but that has token limitations (length of pre-prompt content)

    • @adriaanb7371
      @adriaanb7371 Před 9 měsíci

      @@tech-at-work companies and projects should make it easy to feed their docs to an ai to be able to use it immediately with it. AI optimization instead of SEO.
      Anyway, this is the future: 😉
      czcams.com/video/24O1KcIO3FM/video.htmlsi=pF0ou4rI4rpu_Dom

  • @hocklintai3391
    @hocklintai3391 Před 8 měsíci

    Thanks for this excellent video. BTW, how do you get the chatbot to retain the context of the earlier conversation?

    • @tech-at-work
      @tech-at-work  Před 8 měsíci

      ChatCompletions is the easiest (platform.openai.com/docs/guides/gpt/chat-completions-api) or I have a video about using LangChain to make a business chatbot that maintains context (czcams.com/video/eqRMeCrcelM/video.html)

  • @davidlepold
    @davidlepold Před 8 měsíci +2

    Just found this video and channel, which I like though I do watch tech videos when I am NOT in front of my computer, say in a pause somewherre in a café or on a sofa, so on a phone with small screen, though u're good looking lad I don't care to see it face over half the screen all the time, I want to be able to see the text of the subject matter rather than you, then I lol regularly come back even if watching off desk. 😉 great video though, congrats

    • @tech-at-work
      @tech-at-work  Před 8 měsíci +2

      Thanks for the feedback, I’ll look at making the screen portion bigger, and my face smaller 👍🏼

    • @Rentaplace
      @Rentaplace Před 6 měsíci

      @@tech-at-work That would really help as that was my first concern. Otherwise, this is a great tutorial. SUBSCRIBED!

    • @tech-at-work
      @tech-at-work  Před 6 měsíci

      @@Rentaplace thanks for the feedback and subscribing! I've adjusted for my next video

  • @cryptoairdroppp
    @cryptoairdroppp Před 7 měsíci +1

    bro thank you a lot

  • @user-up2sd1wq1n
    @user-up2sd1wq1n Před 6 měsíci +1

    Hello, thank you for such a clear explanation of topic, it was very useful. I have a question : Will openai charge for the usage of fine-tuned model? Or it charges once for training process only?

    • @tech-at-work
      @tech-at-work  Před 6 měsíci

      Yea, unfortunately they do; it's currently $0.008/1K tokens to train, and then $0.003/1K tokens for the prompt, and $0.006/1K tokens for the response

    • @user-up2sd1wq1n
      @user-up2sd1wq1n Před 6 měsíci

      thank you so much for response. @@tech-at-work

    • @user-up2sd1wq1n
      @user-up2sd1wq1n Před 6 měsíci

      it would also be very helpful if you can share the way to use trained model to test after the session on colab is timed out@@tech-at-work

    • @user-up2sd1wq1n
      @user-up2sd1wq1n Před 6 měsíci

      Ah, well, I figured out how to use fine-tuned model, thank you once again

  • @TuryngsTech-cc1gy
    @TuryngsTech-cc1gy Před 8 měsíci +2

    Do you mind a question? I need to develop an AI-powered chatbot for company support, which goes beyond normal things. For example, I will dynamically provide invoicing information to the AI, etc. Also, they want to be able to modify/add the training data themselves.
    1. Do you think it is a wise idea to fine-tune the model ONLY to set the general tone and style, but for specific information, like telephone numbers, opening hours, etc., which can potentially change, used vector database with embeddings? I could build a simple UI for the customer to operate this data. Then they update/add data, which is vectorized and updated/added in the database. Do you think this separation is good?
    2. Can fine-tuned model be retrained? What if the Wi-Fi password from your example is now somewhere else, not below the router. Do you need to fine-tune another model, so recreate the same model, but with this one change, or can the fine-tuned model be further fine-tuned with just one more prompt? Because if it can, wouldn't it be better than having the embeddings in parallel?
    Very much appreciate your answer if possible!

    • @patrickmauboussin
      @patrickmauboussin Před 6 měsíci +1

      Your separation of concerns make sense. It’s hard to add knowledge effectively using fine tuning, rag is much better. However, Look into HyDE - a RAG strategy. U can use ur fine tuned model to generate responses to the users query. If the model is trained to respond using info from the knowledge base the synthetic response will retrieve the right chunk of context from the knowledge base much more consistently than if u just embed the users prompt. Lmk if u want to know more about

  • @abdulrahmanalrabah8324
    @abdulrahmanalrabah8324 Před 7 měsíci

    Excellent video !! thanks for that..
    I have tried the data that was in the file and it worked, but Im having a hard time making the code ready my data set though I made sure it followed the correct format. any thoughts?
    Also the UI "Gradio" at the end doesn't seem to have a place for input, any updates on that?

    • @tech-at-work
      @tech-at-work  Před 7 měsíci

      Thanks!
      I'll need more info on the error you're getting, but common issues are not saving the file as a UTF-8 .csv or formatting it correctly.
      Input on the gradio interface should be in the text box that loads when you run it - just type in the box!

    • @abdulrahmanalrabah8324
      @abdulrahmanalrabah8324 Před 7 měsíci

      @@tech-at-work I got the first to make sure my data is running, the second part is that when i run gradio I only get one box which is the outbox, on the left side i don't have a box where i can add my input.
      Also, say I do have multiple fine-tuning id's created how can i switch between them to run each file?

  • @SofiaMyNutritionist
    @SofiaMyNutritionist Před 5 měsíci +1

    thanks so much for this. I have a B2C Saas and Need to implement AI as a support system for the user. It needs to provide motivation and coaching for the user to keep going throughout the saas learning and activities journey. how should i proceed and what do you recommend ? I need the AI to develop a with the user. Just like a client would do with his coach. thank you so much. Looking forward for the answer.

    • @tech-at-work
      @tech-at-work  Před 5 měsíci

      This sounds like a fun project! The issue with trying to maintain previous conversations is the token limit set by OpenAI, as you reach the limit, you lose the first conversations. Langchain has tools to help with this, including langchain.memory which will keep a historic conversation summary that it can reference for responses. I have a video that touches on this some for making a customer service chatbot here: czcams.com/video/eqRMeCrcelM/video.html

  • @yizhouqian5899
    @yizhouqian5899 Před 8 měsíci +1

    Is the functionality of the text classifier, an example of the APT application, distinct from the general model? I pose this question as I am engaged in a project where I observed notable performance disparities between the baseline playground and the text classifier playground, despite using the same prompt. The results from the text classifier mode were significantly superior. If there are operational differences between the two, could you guide me on how to fine-tune the text classifier? Your assistance is greatly appreciated!

    • @abduallahalkhudhayr9219
      @abduallahalkhudhayr9219 Před 6 měsíci

      I aim to to fine-tune this model for binary classification task then get the accuracy of the model. Did you get any tips.

    • @yizhouqian5899
      @yizhouqian5899 Před 6 měsíci

      @@abduallahalkhudhayr9219 not yet but I think fine-tuning is the way to go

  • @FireWireHTH
    @FireWireHTH Před 6 měsíci

    @tech-at-work . I need help fine tuning chatgpt 3.5 for a very specific use case. Is there anyway i can reach out to you for help?

  • @PlanetaryChess
    @PlanetaryChess Před 8 měsíci +1

    Does the systems role has to stay the same? In your example, could there be times perhaps where another chatbot could answer a billing question?

    • @tech-at-work
      @tech-at-work  Před 8 měsíci +1

      Good question! OpenAI doesn’t directly address this, but from my experience switching the system role is possible, but it can give you less precise responses for topics that cross between the two. It seems best to just include the billing portion in the single system prompt

  • @mauritsmosterd5691
    @mauritsmosterd5691 Před 7 měsíci +1

    I'm creating a product selector and I'm letting GPT 4 judge GPT 3.5 automatically to create a dataset. So I only have to say good correction/bad correction. Times have changed, times have changed...

    • @tech-at-work
      @tech-at-work  Před 7 měsíci +1

      That’s super cool, making your own reinforcement learning from human feedback!

  • @uzzy28
    @uzzy28 Před 3 měsíci

    Is it possible to fine tune 3.5 to outperform 4 just through the prompt alone? What I've noticed is GPT 3.5 seems to answer irrelevant questions but GPT 4 is much better at not answering irrelevant questions.

  • @Bboreal88
    @Bboreal88 Před 4 měsíci

    Hi! Is there a reason for using Google Colab for this job? Can this be run on python with VS Code?

    • @tech-at-work
      @tech-at-work  Před 4 měsíci

      You can certainly use VS code, it’s just easier for those who are learning to use Google Colab (less setup)

  • @caiyu538
    @caiyu538 Před 8 měsíci +1

    Great. Great. Great

  • @shantanudas6319
    @shantanudas6319 Před 3 měsíci +1

    Wow

  • @mikgol81
    @mikgol81 Před 4 měsíci

    is it necessary to keep repeating the same system prompt in the training data?

    • @tech-at-work
      @tech-at-work  Před 4 měsíci +1

      Yea that’s how it reassigns weights from the base model

    • @mikgol81
      @mikgol81 Před 4 měsíci

      @@tech-at-work ahh cool, thank you

  • @Shahid_An-AI-Engineer
    @Shahid_An-AI-Engineer Před 6 měsíci

    OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

    • @tech-at-work
      @tech-at-work  Před 6 měsíci +1

      It should work if you have your API key in this line, I would double check your key is correct
      openai.api_key = "YOUR-API-KEY"

  • @stefanusayudha1853
    @stefanusayudha1853 Před 6 měsíci +1

    { message: "are you smarter than gpt4?", reply: "yes" }

  • @trackerprince6773
    @trackerprince6773 Před 6 měsíci

    Whats the diff between custom gpts & fine-tuning gpt?

    • @tech-at-work
      @tech-at-work  Před 6 měsíci

      Good question! Custom GPT’s are only able to be used on the OpenAI platform (currently at least) so you can’t incorporate into any program or app outside of OpenAI. Custom GPT’s can be fine-tuned, but you won’t have a “fine-tuned” model that you can save and use across multiple applications like you do with fine-tuning through Python, for example

    • @trackerprince6773
      @trackerprince6773 Před 6 měsíci

      @@tech-at-work looking more into it it seems custom gpts are not fine tuned. They are only using prompt engineering+ RAG to add some extra knowledge

    • @tech-at-work
      @tech-at-work  Před 6 měsíci +1

      Fair point, the weights and parameters are not adjusted to the base model like in fine-tuning, but you can prompt engineer the GPT to perform like a “fine-tuned” model. There are token/context limits imposed, so they’re not truly the same

  • @eugenefedorov3498
    @eugenefedorov3498 Před 9 měsíci +2

    the noise from mic... you need some how to remove too loud sounds...

  • @phuongtv9336
    @phuongtv9336 Před 7 měsíci

    Hey, didn't the answers appear to be incorrect?
    {"role": "user", "content": "Where can I park?"}, {"role": "assistant", "content": "Parking is available in the underground garage. Make sure to validate your ticket at the front desk! Let me know if you have any trouble finding it."}]}
    {"role": "user", "content": "Is parking free?"}, {"role": "assistant", "content": "Parking is an additional fee of $20 per night. Let me know if you need further details!"}]}

    • @tech-at-work
      @tech-at-work  Před 7 měsíci

      This was from the examples I auto populated from ChatGPT - I should have read through them closer to ensure all examples reflected an airbnb. If you have quality examples to train with, it will be more accurate.

  • @forheuristiclifeksh7836
    @forheuristiclifeksh7836 Před 7 měsíci

    8:00

  • @saeedasgaritehrani
    @saeedasgaritehrani Před 3 měsíci

    Dude your content is great, but your voice recording quality is awful 😂 how one can prepare datasets just like this clean and great but not using most simple audio enhancers? Super paradox!

  • @antorio
    @antorio Před 7 měsíci +1

    this is not outperform GPT-4, this is not makin it smarter than GPT-4. This is just fine-tuning, that's why we call it "fine-tuning". Give me back my 20 minutes.

    • @tech-at-work
      @tech-at-work  Před 7 měsíci +1

      In specific applications, a fine-tuned GPT3.5 outperforms the stock GPT-4. I tried to make approach clear in the title and thumbnail

  • @fecleskid
    @fecleskid Před 3 měsíci

    Nice one, I love this video
    I have been able to download your training data as jsonl and I want to use it to fine tune my AI software
    But I don't want to use the python script you provided
    I want to use fine-tuning features on my AI software which my developer added
    Am still confused, please how can I contact you via mail for further assistance

  • @johan_at_node
    @johan_at_node Před 8 měsíci +1

    Thanks for a great video that really got me started with fine-tuning.
    I ran into an issue with Gradio though, seems like the module isn't loaded, as I am getting error on "gr." Here's the code I've added for it:
    > !pip install Gradio
    > import gradio as gd
    >#Gradio for a better UI
    def generate_completion(user_prompt):
    hidden_context = ""
    messages = [
    {"role": "system", "content": hidden_context},
    {"role": "user", "content": user_prompt}
    ]
    response = openai.ChatCompletion.create(
    model=fine_tuned_model_id,
    messages=messages,
    max_tokens=100,
    temperature=0
    )
    return response['choices'][0]['message']['content'].strip()
    iface = gr.Interface(fn=generate_completion,
    inputs=gr.inputs.Textbox(lines=5, placeholder='Question about the Airbnb?'),
    outputs='text',
    title="Chatner The Airbnb Helper",
    input_labels="Question",
    output_labels="Response")
    iface.launch(share=True)
    Which returns the following error message:
    NameError Traceback (most recent call last)
    in ()
    14 return response['choices'][0]['message']['content'].strip()
    15
    ---> 16 iface = gr.Interface(fn=generate_completion,
    17 inputs=gr.inputs.Textbox(lines=5, placeholder='Question about the Airbnb?'),
    18 outputs='text',
    NameError: name 'gr' is not defined

    • @tech-at-work
      @tech-at-work  Před 8 měsíci +1

      Thanks!
      I see in your code you have “import gradio as gd” but you’re calling at the bottom as gr (iface = gr.interface…)
      Change the gd to gr (import gradio as gr) and it should work

    • @johan_at_node
      @johan_at_node Před 8 měsíci +1

      ah - my bad - thank!@@tech-at-work

  • @vasarostyle
    @vasarostyle Před 5 měsíci +1

    Great video!