Complete DSPy Tutorial - Master LLM Prompt Programming in 8 amazing examples!

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2024

ความคิดเห็น • 73

  • @avb_fj
    @avb_fj  2 หลายเดือนก่อน +2

    If you found DSPy useful, check out this TextGrad tutorial: th-cam.com/video/6pyYc8Upl-0/w-d-xo.html.
    TextGrad is another awesome LLM Prompt Optimization library that also tries to reduce prompt engineering in favor of a more programmatic approach.

  • @fojo_reviews
    @fojo_reviews 3 หลายเดือนก่อน +19

    I kinda feel guilty that I am seeing such content without paying anything! This is gold...Thank you!

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน

      Thanks!

    • @caseyhoward8261
      @caseyhoward8261 3 หลายเดือนก่อน +1

      You could always donate to his channel 😉

    • @zes7215
      @zes7215 หลายเดือนก่อน

      wrr

  • @JimMendenhall
    @JimMendenhall 3 หลายเดือนก่อน +9

    This is the only video or resource I've seen on DSPy that makes ANY sense. Great job!

  • @security_threat
    @security_threat 22 วันที่ผ่านมา

    Thanks!

  • @spookymv
    @spookymv 3 หลายเดือนก่อน +7

    Thanks to you, my friend, I learned what I haven't understood for days. I insistently want to learn dspy, but I didn't understand it.
    Thanks a lot.

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน +1

      Glad to hear that! Your insistence has paid off! Good luck with your DSPy journey!

    • @gaims1
      @gaims1 2 หลายเดือนก่อน

      Same here, learnt what I couldn't from my other attempts

  • @AyanKhan-dc3eu
    @AyanKhan-dc3eu 3 หลายเดือนก่อน +1

    When this module came out the docs were very confusing. thank you for such a great explanation

  • @erfanrezaei7791
    @erfanrezaei7791 22 วันที่ผ่านมา

    Very good and clear explanation, thanks buddy👌

  • @MrMoonsilver
    @MrMoonsilver 3 หลายเดือนก่อน +1

    Yes boss! Subscribed! Great video and very much untapped territory, the only well made tutorial for dspy!

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน

      Thanks!

  • @thareejanp3933
    @thareejanp3933 2 หลายเดือนก่อน

    Wonderful content and Presentation loved the way you explained . Keep it up

  • @mazsorosh
    @mazsorosh 3 หลายเดือนก่อน

    I love the contents and presentations in this video! Keep it up!💙

    • @avb_fj
      @avb_fj  2 หลายเดือนก่อน

      😇

  • @haralc6196
    @haralc6196 3 หลายเดือนก่อน

    Thanks!

  • @trashchenkov
    @trashchenkov 3 หลายเดือนก่อน +1

    thanks for the video! It will be great to see how to use DSPy for agents.

  • @arirajuh
    @arirajuh 2 หลายเดือนก่อน

    Thank you for sharing step by step tutorial, i tried dspy with local Ollama, with Llama 3.1, the Chain of thought provided an different answer, i have shared the result, [ I don't know anything about football.]
    Reasoning: Let's think step by step in order to answer this question. First, we need to identify the team that won the World Cup in 2014. The winner of the tournament was Germany. Next, we should find out who scored the final goal for Germany. It was Mario Götze who scored the winning goal against Argentina. To determine who provided the assist, we can look at the details of the game and see that Toni Kroos made a long pass to André Schürrle, who then crossed the ball to Götze.

    • @avb_fj
      @avb_fj  2 หลายเดือนก่อน

      Yes the results will vary depending on the underlying LLM and the specific instructions as well.

  • @krlospatrick
    @krlospatrick 3 หลายเดือนก่อน

    Thanks for sharing this amazing tutorial

  • @tedhand6237
    @tedhand6237 16 วันที่ผ่านมา

    I've been impressed with the ability of LLMs to summarize academic research but also getting really frustrated with the limits and hallucinations. I wonder if programming my own LLM is the answer.

  • @GagandeepBhattacharya22
    @GagandeepBhattacharya22 2 หลายเดือนก่อน

    I love the content & found it really useful. Thank You!
    I have only 1 suggestion for you, "ZOOM IN" the code section as it's really difficult to see the code.

    • @avb_fj
      @avb_fj  2 หลายเดือนก่อน

      Thanks for the suggestion! Will keep it in mind next time.

  • @jeffrey5602
    @jeffrey5602 3 หลายเดือนก่อน +1

    As a German I enjoyed the chosen example a lot 😄

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน

      😂

  • @shoaibsh2872
    @shoaibsh2872 3 หลายเดือนก่อน +1

    Great video man, also loved the one piece T-shirt ;)

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน

      Thanks for noticing!

  • @vaioslaschos
    @vaioslaschos 2 หลายเดือนก่อน

    Really nice content. I liked and subscribed :-). Is there something that can be done easily with DSPy that cant be done with langchain?

  • @ritikatanwar3013
    @ritikatanwar3013 25 วันที่ผ่านมา

    Thank you for making this video. This has been a great hands-on experience learning DSPy..
    What are your thoughts on this - For building AI Agents or having more robust prompt programming, what other framework can be used?

    • @avb_fj
      @avb_fj  20 วันที่ผ่านมา +1

      My current go-to framework is definitely DSPy, although they do have their fair share of issues (like no async programming support, continuous changes, etc). There are a bunch of frameworks that try to do prompt tuning - I have played around with TextGrad, which uses feedback loops to improve LLM generated content/prompts. Many people swear by Langchain, although I personally haven't used it much. Langfuse is a good tool for maintaining prompts, and tracking usage/sessions etc - unnecessary for small scale apps. I have also used litellm, which is a good solution for load-balancing if you are using multiple different LLM providers in your application.
      It might sound funny but the most useful framework I have used for prompting is good old function composition in Python with some Jinja2 templating. :)

  • @VedantiSaxena
    @VedantiSaxena 2 หลายเดือนก่อน +1

    Hi! I am trying to use the LLM (Mistral-Nemo) for sentiment analysis. The issue I'm facing is that for the same input text, it returns different responses. Sometimes it identifies the sentiment as positive, and other times as negative. I have set the temperature to 0, but this hasn’t resolved the problem. Can using DsPy help solve this inconsistency, or is there another solution?
    Also , great video with precise and crisp explanation ! kuddos 👏

    • @avb_fj
      @avb_fj  2 หลายเดือนก่อน

      That’s indeed strange. Setting the temp to zero and keeping the entire prompt same generally return the same output coz the LLM chooses next tokens greedily. When I say “entire prompt” it includes the prompt as well as the input question. I don’t know the implementation details in Mistral Nemo, but if they still sample tokens with t=0 during decoding then I’m afraid we can’t do much to make it deterministic. Again, I am not aware. You may want to test with other LLMs once.
      DSPy might help, you could try it. Note that DSPy by default caches the results of past prompts in the session, basically reusing the cached outputs when the same prompt is re-ran. This means to test the consistency correctly, you must first set the caching off. (Control F “cache” here: dspy-docs.vercel.app/docs/faqs)

    • @VedantiSaxena
      @VedantiSaxena 2 หลายเดือนก่อน

      @@avb_fj I guess , trying Dspy through Fewshot might help with the consistent result . Thank you so much though!

  • @boaz9798
    @boaz9798 3 หลายเดือนก่อน +1

    Excellent video. Thank you. Can I grab the resulting prompt? I know it is supposedly a new paradigm which abstracts it away, but some may still want to revert back to using a simple prompt in prod. post optimization

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน

      Yes you can use the inspect_history() function as shown in the video (around 4:30) to check out all the previous prompts ran by a module.

  • @vineetsuvarna8185
    @vineetsuvarna8185 3 หลายเดือนก่อน

    Awsome ! Please can you share the collab link of the examples shown in video

  • @Anonymous-lw1zy
    @Anonymous-lw1zy 3 หลายเดือนก่อน +2

    Great video.
    However , dspy seems to be very fragile; it breaks easily.
    e.g. at 11:00 you ask ""What is the capital of the birth state of the person who provided the assist for Mario Gotze's in the football World Cup finals in 2014?"" and it answers 'Mainz', which you said is correct.
    But if I make the question slightly different by adding "goal" after "Gotze's", so the question is now ""What is the capital of the birth state of the person who provided the assist for Mario Gotze's goal in the football World Cup finals in 2014?"", it answers "Research".

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน +1

      In general it’s the underlying LLM that could be “fragile”. Remember that DSPy is just converting your program into a prompt and sending to the LLM. The LLM generates the answer which depends on input prompts and temperature settings. Either way, as long as the concepts make sense, don’t worry about replicating the test cases shown in the video!

    • @RazorCXTechnologies
      @RazorCXTechnologies 3 หลายเดือนก่อน +1

      @@avb_fj I tested your exact code with and without the "goal". It responded correctly for both prompts using a local Ollama model: gemma2:27b. DSPy seems to work well with local models that are >20B parameters. Smaller local models especially Mistral-Nemo:12b work in some cases but tend to fail with multi-step (ChainOfThought) modules.

  • @Anonymous-lw1zy
    @Anonymous-lw1zy 3 หลายเดือนก่อน

    Also at 12:42 I am getting:
    answer='Mario Götze' confidence=0.9
    not Andre Schurrle
    I quadruple-checked that my code is the same as yours.

  • @haralc
    @haralc 3 หลายเดือนก่อน

    I just tried it. However it failed on the first try of the "basic" stuff. With GPT4, the BasicQA keep returning "Question: .. Answer: ..." , but I only need the answer itself, not the whole "Quesion: ... Answer: ..." .... So, which part I don't have to worry about the prompting part?

  • @aillminsimplelanguage
    @aillminsimplelanguage 3 หลายเดือนก่อน

    Great video! Can you also please share the notebook with this code. This would help us in doing hands-on ourselves. Thanks!

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน

      Thanks! As mentioned in the video, currently all the code produced in the channel is for Patreon/Channel members.

  • @ashadqureshi4412
    @ashadqureshi4412 3 หลายเดือนก่อน +1

    Thanks man!!!

  • @artmusic6937
    @artmusic6937 3 หลายเดือนก่อน

    if the 60m parameter model does 50% accuracy, how can you improve this without using a bigger model? Because if you use a bigger model, then it actually just memorizes the data better. So it is basically overfitting, isn't it?

  • @daniloMgiomo
    @daniloMgiomo 3 หลายเดือนก่อน

    Awesome content, u can please try some text-grad? The Stanford guys release a paper about this in July

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน

      Thanks for the suggestion! Sounds like a good idea for a future video.

  • @shinigamiryuk4183
    @shinigamiryuk4183 3 หลายเดือนก่อน

    Pretty Nice explanation

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน

      Nice username 🍎

  • @ProgrammerRajaa
    @ProgrammerRajaa 3 หลายเดือนก่อน

    Greate explanation.
    can i have link for the Notebook that you have show on the video

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน

      As I mentioned in the video and on the description, the code is currently members/patrons only.

  • @Karan-Tak
    @Karan-Tak หลายเดือนก่อน

    Can we get Optimized Prompt using DSPy as we get using TextGrad? If yes How can we do it?

    • @avb_fj
      @avb_fj  หลายเดือนก่อน

      I believe so. It's on my bucket list of things to try out one day. Look into this page: dspy-docs.vercel.app/docs/building-blocks/optimizers
      and look for COPRO and MIPROV2 optimizers.

  • @prashlovessamosa
    @prashlovessamosa 3 หลายเดือนก่อน +1

    Excellent 👌

  • @lakshaynz
    @lakshaynz 3 หลายเดือนก่อน

    Thank you:)

  • @JeevaPadmanaban
    @JeevaPadmanaban 3 หลายเดือนก่อน

    i have a question can i use any other models other than openai? im running my own models in deepinfra.

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน +1

      Haven't tested this myself, but I assume that you can call deepinfra models using OpenAI apis by changing the base_url parameter.
      deepinfra.com/docs/openai_api

    • @JeevaPadmanaban
      @JeevaPadmanaban 3 หลายเดือนก่อน

      @@avb_fj Thanks man ✨

    • @JeevaPadmanaban
      @JeevaPadmanaban 3 หลายเดือนก่อน

      @@avb_fj also another doubt can i use another vector db's like astra db into rag
      Thanks.

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน +1

      @@JeevaPadmanaban check out the supported ones here:
      dspy-docs.vercel.app/docs/category/retrieval-model-clients

  • @zappist751
    @zappist751 2 หลายเดือนก่อน

    GOAT

  • @xtema1624
    @xtema1624 3 หลายเดือนก่อน

    Plz share the colab in this video, not dspy example.

  • @AbhijeetSingh-lf3uu
    @AbhijeetSingh-lf3uu 3 หลายเดือนก่อน

    you didn't show us the goal :(

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน

      Haha so I had a 5-second clip before, but FIFA copyrighted it so had to remove it.

    • @AbhijeetSingh-lf3uu
      @AbhijeetSingh-lf3uu 3 หลายเดือนก่อน

      @@avb_fj ah no worries, but thanks so much for teaching us I really appreciate it.

  • @leeharrold98
    @leeharrold98 หลายเดือนก่อน

    Champ

  • @haralc
    @haralc 3 หลายเดือนก่อน

    Btw, I'm not a football fan, and although you mentioned in the note that it is okay .... no, it's really not ... even when I watched this video a few times, who did what still doesn't register in my brain...

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน

      Fair criticism. I regretted using these examples soon after shooting the video. Future tutorials won’t have examples like these.

  • @h3xkore
    @h3xkore 3 หลายเดือนก่อน

    was hoping to make the prompts autonomized. i feel like you still need to understand prompting well before you can use this :(

  • @orthodox_gentleman
    @orthodox_gentleman 3 หลายเดือนก่อน

    You do realize that GPT 3.5 Turbo was deprecated aka it no longer exists.

    • @avb_fj
      @avb_fj  3 หลายเดือนก่อน +1

      Thanks for your comment. The DSPy documentation and official tutorial still uses it (links below), and it worked out for the examples I was going for in the tutorial. Whether the particular LM is deprecated or not is not important at all. You can replace it with whichever model you prefer… the concepts remain the same.
      dspy-docs.vercel.app/docs/tutorials/rag
      github.com/stanfordnlp/dspy/blob/main/intro.ipynb