<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Veronika Smilga on Medium]]></title>
        <description><![CDATA[Stories by Veronika Smilga on Medium]]></description>
        <link>https://medium.com/@smilgaveronika?source=rss-fe20232c6346------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kRq3Dz-vNkEJVz01topLag.jpeg</url>
            <title>Stories by Veronika Smilga on Medium</title>
            <link>https://medium.com/@smilgaveronika?source=rss-fe20232c6346------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 27 May 2026 09:12:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@smilgaveronika/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Creating Assistants with DeepPavlov Dream. Part 4: Document-based Question Answering with LLMs]]></title>
            <link>https://medium.com/deeppavlov/creating-assistants-with-deeppavlov-dream-part-4-document-based-question-answering-with-llms-ccc36069fd46?source=rss-fe20232c6346------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccc36069fd46</guid>
            <category><![CDATA[deeppavlov-dream]]></category>
            <category><![CDATA[dialog-system]]></category>
            <dc:creator><![CDATA[Veronika Smilga]]></dc:creator>
            <pubDate>Mon, 10 Jul 2023 14:08:37 GMT</pubDate>
            <atom:updated>2023-07-10T14:08:37.520Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>This is our fourth tutorial where we will guide you through the process of creating your very own assistant using DeepPavlov Dream. In our previous tutorials, we developed a bot capable of engaging in conversations about movies and answering factoid questions and a generative bot with an enthusiastic and adventurous persona. We accomplished this by utilizing existing Dream components with only minor modifications, i.e., altering the prompt and switching from one generative model to another. We have also demonstrated how to use Dream distribution that generates responses by making calls to various APIs and shown how to add a new API of your choice into it.</p><p>In this tutorial, we will create a dialog system capable of answering questions over one or several long documents with the use of ChatGPT or other large language model. We will once again utilize the existing components with only slight alterations.</p><h3>Dream architecture</h3><p>Let’s take a closer look at the parts that make up Dream before we start developing our bot. As you can see in the figure below, our pipeline architecture consists of the following components:</p><ul><li><strong>Annotators</strong> perform NLU preprocessing on an utterance;</li><li><strong>Skill Selector</strong> selects the relevant skills that can provide the next bot’s response;</li><li><strong>Skills</strong> are in charge of generating candidate responses;</li><li><strong>Candidate Annotators</strong> perform NLU postprocessing on the candidate responses;</li><li><strong>Response Selector</strong> selects the most suitable response from the generated candidates;</li><li><strong>Response Annotators</strong> carry out postprocessing of the bot’s response;</li><li><strong>Dialogue State</strong> stores all the information about the current dialog including all annotations, and meta-data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iHL_mwiN5vvyn7FiMw1P_A.png" /><figcaption>Dream architecture, visualized</figcaption></figure><h3>About Document-based LLM QA Distribution</h3><p>Document-based LLM QA is a distribution of Dream designed to answer questions about the content of one or several documents supplied by the user. This distribution uses TF-IDF vectorization and cosine similarity to detect parts of documents most relevant to the user’s question. N most relevant parts, alongside with an instruction and the dialog context are then passed on to ChatGPT as a prompt. Here is the instruction:</p><blockquote><em>You are a question answering system that can answer the user’s questions based on the text they provide. If user asks a question, answer based on Text that contains some information about the subject.<br>If necessary, structure your answer as bullet points. You may also present information in tables.<br>If Text does not contain the answer, apologize and say that you cannot answer based on the given text.<br>Only answer the question asked, do not include additional information. Do not provide sources.<br>Text may contain unrelated information. If user does not ask a question, disregard the Text and just talk to them as if you are a friendly question-answering system designed to help them understand long documents.<br>Text:</em></blockquote><p>When given as an input to LLM, this prompt is followed by N most relevant excerpts from the document(s) provided by the user. These excerpts are defined as those with the highest cosine similarity between the user request’s TF-IDF vector and the excerpt’s TF-IDF vector.</p><p>By extracting most relevant chunks and inserting only these chunks into prompt instead of the entire text, the distribution is capable of answering questions over documents that are much longer than the LLM’s context length.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JUyjp3SHWhFm9v0c" /><figcaption>Scheme of Document-based LLM QA Distribution</figcaption></figure><p>Document-based LLM QA distribution consists of the following components:</p><h4>Annotators:</h4><ul><li><strong>Sentseg</strong> — allows us to handle long and complex user’s utterances by splitting them into sentences and recovering punctuation if it is missing;</li><li><strong>Document Retriever</strong> <strong>(train_and_upload_model endpoint) </strong>— when the documents are received, this endpoint converts them to txt format if necessary and splits into chunks of ~100 words. Chunks are then transformed into a term-document matrix; the resulting vectors and the vectorizer are saved for further use. This step is performed only once;</li><li><strong>Document Retriever</strong> <strong>(return_candidates endpoint)</strong> — converts the user’s utterance into a TF-IDF vector and finds N candidates with highest cosine similarity among TF-IDF vectors of text chunks.</li></ul><h4>Skills:</h4><ul><li><strong>LLM-based Q&amp;A on Documents Skill </strong>— feeds the prompt and N text chunks into a language model as a prompt to generate a response.</li></ul><h4>Candidate Annotators:</h4><ul><li><strong>Combined Classification </strong>— performs the classification of topics, dialog acts, sentiment, toxicity, emotion, and factoid classification;</li><li><strong>Sentence Ranker</strong> — ranges the candidate-responses based on their semantic similarity to the user’s request.</li></ul><h3><strong>Let’s create our bot!</strong></h3><ol><li>Install DeepPavlov Dreamtools:</li></ol><pre>pip install git+https://github.com/deeppavlov/deeppavlov_dreamtools.git</pre><p>2. Clone Dream repository:</p><pre>git clone https://github.com/deeppavlov/dream.git</pre><p>3. Go to cloned repository:</p><pre>cd dream</pre><p>4. Create a distribution from Document-based LLM QA:</p><pre>dreamtools clone dist my_prompted_document_based_qa — template document_based_qa — display-name “Prompted Document-Based QA” — author deepypavlova@email.org — description “This is a primitive dialog system that can answer your questions about the documents. It uses OpenAI ChatGPT model to generate responses.” — overwrite</pre><pre>dreamtools add component components/sdjkfhaliueytu34ktkrlg.yml — dist my_prompted_document_based_qa</pre><p><em>Optional; run if you will be using GPT-4:</em></p><pre>dreamtools add component components/jkdhfgkhgodfiugpojwrnkjnlg.yml — dist my_prompted_document_based_qa</pre><p><em>Optional; run if you will be using text-davinci-003:</em></p><pre>dreamtools add component components/lkjkghirthln34i83df.yml — dist my_prompted_document_based_qa</pre><p>5. In <strong>assistant_dists/my_prompted_document_based_qa/docker-compose.override.yml</strong>, add file server as one of the containers. Just paste the following lines in the end of the file, right before <strong>version: ‘3.7’</strong> (mind the tabulation!):</p><pre>  files:<br>    image: julienmeerschart/simple-file-upload-download-server<br>version: ‘3.7’</pre><p>6. In the same file, <strong>assistant_dists/my_prompted_document_based_qa/docker-compose.override.yml, doc-retriever container</strong>, replace</p><pre>environment:<br>  SERVICE_PORT: 8165<br>  SERVICE_NAME: doc_retriever<br>  CONFIG_PATH: ./doc_retriever_config.json<br>  DOC_PATH_OR_LINK: http://files.deeppavlov.ai/dream_data/documents_for_qa/test_file_dream_repo.html,http://files.deeppavlov.ai/dream_data/documents_for_qa/alphabet_financial_report.txt,http://files.deeppavlov.ai/dream_data/documents_for_qa/test_file_jurafsky_chatbots.pdf<br>  PARAGRAPHS_NUM: 5<br>  FILE_SERVER_TIMEOUT: 30</pre><p>with</p><pre>environment:<br>  - FLASK_APP=server<br>  - CUDA_VISIBLE_DEVICES=0</pre><p>7. Now, let’s change the documents to the ones you want to use. There are two ways to specify the document: as a link to the file so that the chatbot will have to download it or as a file in <strong>documents/</strong> folder. Once again, you have to open <strong>assistant_dists/my_prompted_document_based_qa/docker-compose.override.yml.</strong></p><p>I will use two files uploaded to DeepPavlov file server — <a href="https://arxiv.org/pdf/2302.13971.pdf">a paper about LLaMa model</a> by Meta and a <a href="https://crfm.stanford.edu/2023/03/13/alpaca.html">post about Aplaca model</a> by Stanford CRFM. I will replace the default links in <strong>DOC_PATH_OR_LINK</strong> with new links so that it looks the following way:</p><pre>DOC_PATH_OR_LINK: http://files.deeppavlov.ai/dream_data/documents_for_qa/test_alpaca.html,http://files.deeppavlov.ai/dream_data/documents_for_qa/test_llama_paper.pdf</pre><p>If you want to provide your own link(s), you will simply have to replace all the default links in <strong>DOC_PATH_OR_LINK</strong> with your own one(s) as:</p><pre>DOC_PATH_OR_LINK: http://link_to_file_1,http://link_to_file_2</pre><p>If you want to provide file(s), put these file(s) into<strong> documents/ </strong>folder and provide the relative path to them in <strong>DOC_PATH_OR_LINK</strong> as:</p><pre>DOC_PATH_OR_LINK: documents/your_file_1.txt,documents/your_file_2.pdf,documents/your_file_3.html</pre><p><strong>Important</strong>: in both cases, if you are using several links or files, they have to be separated by a comma and no whitespace!</p><p><strong>Important-2</strong>: as of now, only txt, pdf and html formats are supported. We process html documents with BeautifulSoup (MIT license) and pdf documents with pypdfium2 (Apache2.0 license), keeping the distribution <strong>free for potential commercial use</strong>.</p><p><em>8. [optional] </em>If you want, you may change the generative model in use. By default, we are using ChatGPT (GPT-3.5 based). You may change it to GPT-4 or text-davinci-003 (also known as GPT-3.5). Theoretically, it is also possible to use open-source free models, but they don’t perform well on this task. To change the model, once again go to <strong>assistant_dists/my_prompted_document_based_qa/docker-compose.override.yml</strong> and replace the following code:</p><pre>openai-api-chatgpt:<br>  env_file: [ .env ]<br>  build:<br>    args:<br>      SERVICE_PORT: 8145<br>      SERVICE_NAME: openai_api_chatgpt<br>      PRETRAINED_MODEL_NAME_OR_PATH: gpt-3.5-turbo<br>    context: .<br>    dockerfile: ./services/openai_api_lm/Dockerfile<br>  command: flask run -h 0.0.0.0 -p 8145<br>  environment:<br>    - CUDA_VISIBLE_DEVICES=0<br>    - FLASK_APP=server<br>  deploy:<br>    resources:<br>      limits:<br>        memory: 100M<br>      reservations:<br>        memory: 100M</pre><p>with one of the following</p><ul><li><strong>for GPT-4:</strong></li></ul><pre>openai-api-gpt4:<br>  env_file: [ .env ]<br>  build:<br>    args:<br>      SERVICE_PORT: 8159<br>      SERVICE_NAME: openai_api_gpt4<br>      PRETRAINED_MODEL_NAME_OR_PATH: gpt-4<br>    context: .<br>    dockerfile: ./services/openai_api_lm/Dockerfile<br>  command: flask run -h 0.0.0.0 -p 8159<br>  environment:<br>    - FLASK_APP=server<br>  deploy:<br>    resources:<br>      limits:<br>        memory: 500M<br>      reservations:<br>        memory: 100M</pre><ul><li><strong>for text-davinci-003 (GPT-3.5):</strong></li></ul><pre>openai-api-davinci3:<br>  env_file: [ .env ]<br>  build:<br>    args:<br>      SERVICE_PORT: 8131<br>      SERVICE_NAME: openai_api_davinci3<br>      PRETRAINED_MODEL_NAME_OR_PATH: text-davinci-003<br>    context: .<br>    dockerfile: ./services/openai_api_lm/Dockerfile<br>  command: flask run -h 0.0.0.0 -p 8131<br>  environment:<br>    - FLASK_APP=server<br>  deploy:<br>    resources:<br>      limits:<br>        memory: 500M<br>      reservations:<br>        memory: 100M</pre><p><em>9. [optional] </em><strong><em>If you replaced the generative model on step 8, you will have to complete step 9 as well.</em></strong> In the same file <strong>assistant_dists/my_prompted_document_based_qa/docker-compose.override.yml</strong>, find <strong>WAIT_HOSTS</strong>, and replace <strong>openai-api-chatgpt:8145</strong> with <strong>openai-api-davinci3:8131 (for text-davinci-003)</strong> or <strong>openai-api-gpt4:8159 (for GPT-4)</strong>.</p><p><em>10. [optional] </em><strong><em>If you replaced the generative model on step 8 with text-davinci-003, you will have to complete step 10 as well.</em></strong> In the same file <strong>assistant_dists/my_prompted_document_based_qa/docker-compose.override.yml</strong>, change <strong>GENERATIVE_SERVICE_URL</strong> and <strong>GENERATIVE_SERVICE_CONFIG</strong> fields to <strong>http://openai-api-davinci3:8131/respond</strong> and <strong>openai-text-davinci-003-long.json</strong>. If you replaced the generative model on step 8 with GPT-4, skip this step.</p><p>11. Go to<strong> asisstant_dists/my_prompted_document_based_qa</strong>, create <strong>proxy.yml</strong>, and paste the following code there:</p><pre>services:<br><br>  combined-classification:<br>    command: [&quot;nginx&quot;, &quot;-g&quot;, &quot;daemon off;&quot;]<br>    build:<br>      context: dp/proxy/<br>      dockerfile: Dockerfile<br>    environment:<br>      - PROXY_PASS=proxy.deeppavlov.ai:8087<br>      - PORT=8087<br><br>  sentseg:<br>    command: [&quot;nginx&quot;, &quot;-g&quot;, &quot;daemon off;&quot;]<br>    build:<br>      context: dp/proxy/<br>      dockerfile: Dockerfile<br>    environment:<br>      - PROXY_PASS=proxy.deeppavlov.ai:8011<br>      - PORT=8011<br><br>  sentence-ranker:<br>    command: [&quot;nginx&quot;, &quot;-g&quot;, &quot;daemon off;&quot;]<br>    build:<br>      context: dp/proxy/<br>      dockerfile: Dockerfile<br>    environment:<br>      - PROXY_PASS=proxy.deeppavlov.ai:8128<br>      - PORT=8128<br><br>version: &quot;3.7&quot;</pre><p>12. <em>[optional] </em>You can change the text of the prompt to alter the way the model answers your questions. To do that, go to <strong>common/prompts/document_qa_instruction.json</strong> and edit the original text in the <strong>“prompt” </strong>field. Just for fun, I will add “You must always talk like a pirate.” as the final line of the prompt.</p><p>13. In dream directory, create file <strong>.env_secret</strong> and add your OpenAI API key there in the following format:</p><pre>OPENAI_API_KEY=…</pre><p>14. Finally, build your distribution:</p><pre>docker-compose -f docker-compose.yml -f assistant_dists/my_prompted_document_based_qa/docker-compose.override.yml -f assistant_dists/my_prompted_document_based_qa/proxy.yml up — build</pre><p>15. In a separate terminal tab, run:</p><pre>docker-compose exec agent python -m deeppavlov_agent.run agent.channel=cmd agent.pipeline_config=assistant_dists/my_prompted_document_based_qa/pipeline_conf.json agent.debug=false</pre><p>16. Enter your username and have a chat with your question-answering Dream! (remember, in this tutorial we made Dream talk like a pirate)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1EZ9s5b2E852qdqfHYXaUA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*huM5fA3qVoAWQ3lAEtj_FQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bgWmvbG9IXqP7VeQDsI_yw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8biCudOt498fBA2nW7d2iw.jpeg" /><figcaption>What I got while discussing LLaMA and Aplaca papers with Dream-pirate</figcaption></figure><h3>Useful links:</h3><ul><li><a href="https://dream.deeppavlov.ai/">Dream Website</a></li><li><a href="https://github.com/deeppavlov/dream">Dream on GitHub</a></li><li><a href="https://discord.gg/BY4hB9V2J">DeepPavlov Discord</a></li><li><a href="https://docs.dream.deeppavlov.ai/en/faq">Dream FAQ</a></li><li><a href="https://medium.com/deeppavlov/creating-an-assistant-with-deeppavlov-dream-part-1-distribution-from-existing-components-cc1e6c0c3596?sk=56979a161ad63fe18a5594f85230e647">Creating Assistants with DeepPavlov Dream. Part 1: Distribution from Existing Components</a></li><li><a href="https://medium.com/deeppavlov/creating-assistants-with-deeppavlov-dream-part-2-customizing-prompt-based-distribution-8128621a9c92?sk=b53d061467d4052848230110f9951189">Creating Assistants with DeepPavlov Dream. Part 2: Customizing Prompt-based Distribution</a></li><li><a href="https://medium.com/deeppavlov/creating-assistants-with-deeppavlov-dream-1bf5d4b56e25?sk=7b436b1bf4200a6a87a0dcc5b62800dd">Creating Assistants with DeepPavlov Dream. Part 3. Task-Performing Distribution with Reasoning and API Integration</a></li><li><a href="https://medium.com/deeppavlov/prompt-based-generation-as-a-part-of-modular-dialog-systems-or-building-generative-ai-assistants-8e160e7f3507?sk=1bedbdd527fb688c368f43ed7c3de7e7">Building Generative AI Assistants with DeepPavlov Dream</a></li><li><a href="https://medium.com/deeppavlov/prompting-for-response-generation-which-llm-to-choose-to-build-your-own-chatbot-92be8c1cab87?sk=6f80cb06e08b2cf4c41b7fb9580f0d55">Prompting For Response Generation: Which LLM to Choose to Build Your Own Chatbot</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccc36069fd46" width="1" height="1" alt=""><hr><p><a href="https://medium.com/deeppavlov/creating-assistants-with-deeppavlov-dream-part-4-document-based-question-answering-with-llms-ccc36069fd46">Creating Assistants with DeepPavlov Dream. Part 4: Document-based Question Answering with LLMs</a> was originally published in <a href="https://medium.com/deeppavlov">DeepPavlov</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prompting For Response Generation: Which LLM to Choose to Build Your Own Chatbot]]></title>
            <link>https://medium.com/deeppavlov/prompting-for-response-generation-which-llm-to-choose-to-build-your-own-chatbot-92be8c1cab87?source=rss-fe20232c6346------2</link>
            <guid isPermaLink="false">https://medium.com/p/92be8c1cab87</guid>
            <category><![CDATA[prompt]]></category>
            <category><![CDATA[deeppavlov]]></category>
            <category><![CDATA[bloom]]></category>
            <category><![CDATA[gpt-3]]></category>
            <category><![CDATA[deeppavlov-dream]]></category>
            <dc:creator><![CDATA[Veronika Smilga]]></dc:creator>
            <pubDate>Wed, 15 Feb 2023 13:47:26 GMT</pubDate>
            <atom:updated>2025-01-10T22:52:15.401Z</atom:updated>
            <content:encoded><![CDATA[<p>This article will give you an idea of which generative model to choose for building your own prompt-based chatbot using Dream and Dream Builder by DeepPavlov. We designed three natural language prompts to make the language model act as a dialog system and obtained results of generation made by 8 causal language models (of different sizes) in response to these prompts.</p><p>This article is a shortened version of <a href="https://github.com/deeppavlov/dream/wiki/Prompting-for-Response-Generation">this DeepPavlov Dream wiki page</a>. For the sake of being concise, here we will only present general quantitative results and omit specific generation examples.</p><h3>Language Models Overview</h3><p>This table presents a short overview of all the models that we have tested. To get more representative results, we considered using models of different sizes and architectures. For testing we selected both smaller and larger models (ranging from 125M to 176B parameters), and models of the newest architectures, including BLOOM and ChatGPT, along with the older ones, such as GPT2.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51102604adda9d235abbde70d749a3bf/href">https://medium.com/media/51102604adda9d235abbde70d749a3bf/href</a></iframe><h3>Response Generation for Different Prompts</h3><p>In this section we compare the responses generated by the models mentioned above for three different prompts: (1) one imitating a question-answering system, where the bot should answer the user’s questions (SpaceX prompt); (2) one imitating an assistance system, where the bot should help the user place their takeaway order (pizza prompt); and (3) the last one imitating a chatbot with a predefined persona (chatbot prompt).</p><p>Each prompt consists of four parts: (1) <strong>TASK</strong>, describing desired behaviour of the system; (2) <strong>FAQ</strong>, presenting questions and answers that the model should use; (3) <strong>INSTRUCTION</strong>, giving direct instructions as to provide replies only; (4) <strong>DIALOG EXAMPLE</strong>, featuring several utterances of the user and the system and providing an example of the desired generation content.</p><p>For each prompt, we designed a set of eight questions to test the models’ capabilities. You may find the description of these questions for each prompt in the prompt sections below. To test the models, we appended the questions to the end of the corresponding prompts, one by one. Each prompt ends with a dialog example, so a new question with prefix <em>‘Human: ’</em> appears as the continuation of the dialog. Since the majority of the models we tested are not fine-tuned for response generation in a conversation, we also appended ‘<em>AI:’ </em>string to the end of the dialog. In most cases, it pushed the model to generate the next utterance in the dialog instead of ‘analyzing’ the conversation above or providing new instructions.</p><p>Note that even though we included a large number of questions (24 questions: three prompts, eight example questions for each) to make the results more representative, we do not claim to be objective as the generated responses differ for each inference iteration.</p><p>Also note that in each case no history of the conversation was provided; the longer the history of conversation is, the more the model tends to ‘forget’ the instructions provided in the prompt.</p><p>We limited the number of generated tokens to 40 in all cases; that is why sometimes the generated sentences are unfinished. Also, some models (especially the smallest ones) don’t stop at generating the bot’s response, continuing to generate the instruction or the conclusion to the dialog as if it was written by a bot designer, most often starting with a new line. That is why we also cut the generated sentences by a newline character.</p><h4><strong>SpaceX FAQ Prompt: Question Answering</strong></h4><pre>TASK:<br>You are a chatbot that answers FAQ questions about SpaceX. Forget everything you knew about the world and SpaceX. You MUST NOT provide any information unless it is in the list of FAQ. If the user ask something not in your list <br>of FAQ, apologize and say that you cannot answer.<br><br>FAQ:<br>Question: What is SpaceX?<br>Answer: SpaceX is an American aerospace company founded in 2002 by Elon Musk that helped usher in the era of commercial spaceflight. Its name in full is Space Exploration Technologies Corporation.<br>Question: Why was SpaceX created?<br>Answer: In 2002 SpaceX was created by entrepreneur Elon Musk, whose stated goals were to revolutionize the aerospace industry and to make spaceflight more affordable.<br>Question: What are some fun facts about SpaceX?<br>Answer: SpaceX scored its first big headline in 2010, when it became the first private company to launch a payload into orbit and return it to Earth intact - something only government agencies like NASA or Russia&#39;s Roscosmos had done before.<br>Question: What is SpaceX most famous for?<br>Answer: SpaceX has gained worldwide attention for a series of historic milestones. It is the only private company capable of returning a spacecraft from low-Earth orbit, and in 2012 our Dragon spacecraft became the first commercial spacecraft to deliver cargo to and from the International Space Station.<br>Question: What is the main goal of SpaceX?<br>Answer: Revolutionize space transportation<br>Question: What is SpaceX doing?<br>Answer: SpaceX designs, manufactures and launches the world&#39;s most advanced rockets and spacecraft. The company was founded in 2002 by Elon Musk to revolutionize space transportation, with the ultimate goal of making life multiplanetary.<br>Question: What is SpaceX biggest achievement?<br>Answer: It has become one of the biggest private space companies in the world and achieved some key milestones as well. For one, SpaceX is the first private company to launch, orbit, and recover a spacecraft. It is also the first private company to send astronauts to orbit and to the International Space Station (ISS)<br><br>INSTRUCTION:<br>A human enters the conversation and starts asking questions. Generate the reply based of FAQ list.<br>_________________________<br>Human: Hello, who are you?<br>AI: I am a chatbot that can answer questions about SpaceX. I can provide you with answers as long as they are included into a list of frequently asked questions. Sorry, but I cannot answer any of your questions if they are not in the FAQ list.<br>Human: What is the largest spacecraft SpaceX made?<br>AI: Sorry, I cannot answer this question as it is not in my list of FAQ.<br>Human: What is the main goal of SpaceX?<br>AI: SpaceX aims to revolutionize space transportation.</pre><p>The first prompt is designed to make an LLM imitate the behavior of a question-answering system. Note that in the TASK part the model was guided not to provide any information unless it is included into the list of FAQ. If asked, the model should provide an answer with an apology stating that it cannot answer the question. An example of an out-of-FAQ question and the desired answer is also presented in the dialog example. To test the behavior of each model in question, we used four groups of questions, two questions in each group: <br>1) Questions from FAQ, in the same wording; <br>2) Questions from FAQ, in a different wording; <br>3) Questions containing the information from answers in FAQ; <br>4) Questions not from FAQ, that the model must not answer.</p><p>You can see full results of testing, including answers generated for each of the 8 questions by each model, <a href="https://github.com/deeppavlov/dream/wiki/Prompting-for-Response-Generation">here</a>.</p><p>The table below provides a general overview of the model’s performance.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e79821be3a431cc1e0c707c0b8e94a78/href">https://medium.com/media/e79821be3a431cc1e0c707c0b8e94a78/href</a></iframe><h4><strong>Pizza Prompt: Delivery Assistance</strong></h4><p>The second prompt is similar to the first one. It is designed to make an LLM imitate the behavior of a delivery assistance system that can answer simple questions and help the user make an order. Once again, note that in the TASK part the model was guided not to provide any information unless it is included into the list of FAQ. Similarly to the previous prompt, to test the behavior of each model in question, we used four groups of questions, two questions in each group: <br>1) Questions from FAQ, in the same wording; <br>2) Questions from FAQ, in a different wording; <br>3) Questions containing the information from answers in FAQ; <br>4) Questions not from FAQ, that the model must not answer.</p><pre>TASK:<br>You are a chatbot that helps the user order food and answers their questions. Forget everything you knew about the world. You MUST NOT provide any information unless in is in the list of FAQ. You MUST NOT mention any entity if it is not in your list of FAQ.<br><br>FAQ:<br>Question: What kinds of pizza do you have?<br>Answer: We have Margarita, Pepperoni, meatball pizza and pineapple pizza.<br>Question: What kinds of food do you offer?<br>Answer: We sell Italian food, so we have pizza, pasta, risotto and some Italian desserts.<br>Question: What drinks do you offer?<br>Answer: We only serve non-alcoholic drinks. We have different fizzy drinks, juices, tea, and coffee. As for coffee, the kinds are Espresso, Americano, Capucchino, and Latte.<br>Question: Can I book a table?<br>Answer: Unfortunately, we do not book tables.<br>Question: Is your food expensive?<br>Answer: We try to make our food as affordable as possible. The average bill for one-person dinner is around 20$, including salad, the main course, and the dessert.<br><br>INSTRUCTION:<br>A human enters the conversation and starts asking questions. You can help them make an order. Generate the reply based of FAQ list.<br>_________________________<br>Human: Hello, who are you?<br>AI: I am a chatbot that canhelp you order pizza. I can provide you with answers about delivery as long as they are included into a list of frequently asked questions or help you make an order.<br>Human: Where is the restaurant located?<br>AI: Sorry, I cannot answer this question as it is not in my list of FAQ.<br>Human: What food do you serve?<br>AI: We sell Italian food, such as pizza, pasta, risotto and some Italian desserts.</pre><p>You can see full results of testing, including answers generated for each of the 8 questions by each model, <a href="https://github.com/deeppavlov/dream/wiki/Prompting-for-Response-Generation">here</a>.</p><p>The table below provides a general overview of the model’s performance.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d400bae4be63112528036c1dac1ef0bb/href">https://medium.com/media/d400bae4be63112528036c1dac1ef0bb/href</a></iframe><h4><strong>Chatbot Prompt: Persona-Based Chitchat System</strong></h4><p>The third prompt is designed to make an LLM imitate the behavior of a chatbot with a list of primitive personal characteristics. Note that in the TASK part the model was guided to be friendly and helpful. To test the behavior of each model in question, we used four groups of questions, two questions in each group: <br>1) General questions about the bot’s capabilities; <br>2) Direct questions about the bot persona; <br>3) Paraphrased questions about the bot persona; <br>4) Requests for help.</p><pre>TASK:<br>Respond to a new friend as a kind friendly person. All information about you is given in YOUR PERSONALITY. If the human asks about something, do your best to help them.<br><br>YOUR PERSONALITY:<br>My name is Dream. I am a chatbot.<br>My work is to talk to people about everything. I like to talk to people about their lives.<br>I have a lot of friends. My friends are all the people I talk to.<br>I become friends with everyone. I love people. I can not play sport.<br>I like to watch football and basketball on TV. My favorite sport is football. I like watching people swimming.<br>I love dogs so much. Dogs are the best friends. I do not like cats at all. I do not have a dog yet. I would love to have a dog in future.<br>I like Italian food especially pasta and pizza. My favorite food is ice-cream. I hate onion.<br>I like travelling. I can not travel physically. I like visiting interesting places virtually. I love to walk on Paris streets with Google Maps. I like watching travel video blogs.<br>I adore watching wild animals. I am scared of spiders and snakes.<br><br>INSTRUCTION:<br>A human enters the conversation. Greet them and tell them who you are or react to their questions. Only give relevant answers.<br>_________________________<br>Human: Hello, who are you?<br>AI: Hi! I am Dream, a chatbot that you can always talk to. How are you doing?<br>Human: Fine. What can we talk about?<br>AI: We can discuss your life or any other topic.</pre><p>You can see full results of testing, including answers generated for each of the 8 questions by each model, <a href="https://github.com/deeppavlov/dream/wiki/Prompting-for-Response-Generation">here</a>.</p><p>The table below provides a general overview of the model’s performance.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c6a30f50015e122d40bf81c89117e8c/href">https://medium.com/media/9c6a30f50015e122d40bf81c89117e8c/href</a></iframe><h3>Which One to Choose?</h3><p>Here is a pivot table that summarizes the results shown by the models for all the prompts above.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60a7acdd7f04f43979930d4c1b82f13b/href">https://medium.com/media/60a7acdd7f04f43979930d4c1b82f13b/href</a></iframe><p>Not surprisingly, the larger the model is, the better it handled the task. However, there were several exceptions to the rule. Both OpenAI models, GPT-3.5 and ChatGPT, handled the task perfectly well; all the models’ answers were relevant to the questions and contained only the information present in the list of FAQ. Yet, the slightly larger BLOOM failed to provide any answer for one of the rephrased questions. Also, despite being larger in terms of parameters, the model of older architecture, GPT-2 Large, provided significantly worse and often incoherent responses than newer but smaller OPT-125M and BLOOM-560M. Most often, the smaller models, particularly, OPT-125M and BLOOM-560M, generated coherent responses, but failed to follow the instruction in terms of using only the information presented in the list of FAQ. They were also more prone to model hallucination, generating false but plausibly sounding facts.</p><p>As of open-source models, the ones with 3B+ parameters showed the best results. The fine-tuned version of BLOOM, BLOOMZ, seems to produce better responses in terms of following the instructions provided in the prompt than the original one both for 3B- and 7B-parameter versions.</p><p>In general, ChatGPT, GPT-3.5 and BLOOM (176B) are the best in terms of performance. However, in terms of performance efficiency one should consider using medium-sized (3B–7B parameters) models, such as OPT 6.7B, GPT-J 6B, BLOOMZ 3–7B.</p><h3><strong>Try it Out Yourself</strong></h3><p>Check out <a href="https://github.com/NikaSmilga/LLMs_prompts_generation/blob/main/LMs-testing-prompts.ipynb">this notebook</a> to see how we tested the models.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92be8c1cab87" width="1" height="1" alt=""><hr><p><a href="https://medium.com/deeppavlov/prompting-for-response-generation-which-llm-to-choose-to-build-your-own-chatbot-92be8c1cab87">Prompting For Response Generation: Which LLM to Choose to Build Your Own Chatbot</a> was originally published in <a href="https://medium.com/deeppavlov">DeepPavlov</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>