Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Poor Man’s BingChat – Building an Internet-con...

Poor Man’s BingChat – Building an Internet-connected Search Assistant from scratch*

Have you seen BingChat’s/ChatGPT’s ability to reason about current events, even though the underlying models have been trained with data only up to September 2021? Have you wondered how it works behind the scenes, what did they do to make it work?

During this talk Vlad will be talking about the ways to achieve this, including possible options such as fine-tuning and retrieval augmented generation, but also limitations such as models’ slow inference times and limited context window sizes. He will demo an app that can talk about current events, and you will learn how to build your own, from scratch*.

*from scratch = with nothing but Python and the Azure OpenAI APIs

Vlad Iliescu

October 27, 2023
Tweet

More Decks by Vlad Iliescu

Other Decks in Programming

Transcript

  1. vladiliescu.net what do we want? to ask GPT-4 questions about

    events that have occurred after September 2021
  2. vladiliescu.net AI in a nutshell def do_ai(input): output = ''

    for i in range(0, max_words): context = input + output next_word = predict_next_word(context) output += next_word return output do_ai('Give me the list of speakers for Codecamp Iasi 2023')
  3. vladiliescu.net Base models Q: How does Hamlet’s famous monologue start?

    A: What is the opening line of Romeo’s soliloquy in Act 2, Scene 2 of “Romeo and Juliet”? – What are the first words of the “Tears in rain” monologue from the film “Blade Runner”? – What are the first words of Mark Antony’s “Friends, Romans, countrymen” speech in “Julius Caesar”? –
  4. vladiliescu.net Assistant models Q: How does Hamlet’s famous monologue start?

    A: Hamlet’s famous monologue, often referred to as the “To be or not to be” soliloquy, is from William Shakespeare’s play “Hamlet.” This monologue appears in Act 3, Scene 1 and delves into the protagonist’s contemplation of life, death, and the nature of existence. The opening line is as follows: To be, or not to be, that is the question
  5. vladiliescu.net issue #1 gathering a dataset of all text on

    the Internet is non-trivial plus it takes like, a lot of time
  6. vladiliescu.net Remember this? def do_ai(input): output = '' for i

    in range(0, max_words): context = input + output next_word = predict_next_word(context) output += next_word return output do_ai('Give me the list of speakers for Codecamp Iasi 2023')
  7. vladiliescu.net some popular models Model Context window Company 4k tokens

    Meta 4k tokens OpenAI 8k tokens OpenAI 16k tokens OpenAI 32k tokens OpenAI 100k tokens Meta 100k tokens Anthropic Llama2 GPT-3.5-turbo GPT-4 GPT-3.5-turbo-16k GPT-4–32k Code Llama Claude 2
  8. vladiliescu.net You are a search assistant that helps users find

    information from a series of curated documents. The user just asked you this question: {QUESTION}. You need to think carefully and find the best answer to the query. Do not make stuff up, and answer using only information from the following documents: {RELEVANT_INFO}
  9. vladiliescu.net The thing about RAG is that it’s only as

    good as the quality of your search results. – Stack Overflow Blog