{"id":353,"date":"2024-01-30T19:06:05","date_gmt":"2024-01-30T18:06:05","guid":{"rendered":"https:\/\/sii.ua\/blog\/?p=353"},"modified":"2024-02-16T09:44:13","modified_gmt":"2024-02-16T08:44:13","slug":"how-to-build-custom-chatgpt","status":"publish","type":"post","link":"https:\/\/sii.ua\/blog\/en\/how-to-build-custom-chatgpt\/","title":{"rendered":"How to build Custom ChatGPT?"},"content":{"rendered":"\n<p>ChatGPT is a sensational new chatbot technology that has taken the internet by storm. It is a cutting-edge AI-based chatbot that can interact with humans using natural language processing (NLP). It uses machine learning algorithms to learn and understand human language patterns and adapt to different conversation styles.<\/p>\n\n\n\n<p>The core of ChatGPT is constituted by GPT-3 \u2013 the third iteration of the generative pre-trained transformer model. &nbsp;It is significantly larger and more powerful than its predecessor and comes with 175 billion parameters compared to 1.5 billion parameters in GPT-2. The additional parameters bring outstanding capabilities of text comprehension and generation.<\/p>\n\n\n\n<p>In addition, GPT-3 was trained on a broader range of data, including books, articles, and websites, whereas GPT-2 was trained mainly on web pages. These factors have contributed to ChatGPT&#8217;s superior performance and make it the most advanced and capable chatbot technology.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/What-is-ChatGPT.png\"><img decoding=\"async\" width=\"698\" height=\"95\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/What-is-ChatGPT.png\" alt=\"\" class=\"wp-image-354\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/What-is-ChatGPT.png 698w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/What-is-ChatGPT-300x41.png 300w\" sizes=\"(max-width: 698px) 100vw, 698px\" \/><\/a><\/figure>\n\n\n\n<p>However, what brings ChatGPT conversational capabilities to the next level is learning from human feedback through so-called <strong>reinforcement learning<\/strong> \u2013 an AI technique where an agent learns by receiving feedback in the form of rewards or penalties.<\/p>\n\n\n\n<p>As a finetuning step, users interact with ChatGPT, to provide it with feedback in the form of a reward or penalty, depending on the quality of its responses. This helps ChatGPT learn and adapt to the user&#8217;s preferences over time and mimic human language very accurately.<\/p>\n\n\n\n<p>The aforementioned capabilities have made it a popular choice for creating blog posts, songs, poetry and many more. However, despite its advanced capabilities, ChatGPT comes with certain limitations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Limitations of ChatGPT<\/strong><\/h2>\n\n\n\n<p>One of the major issues is that it can sometimes generate &#8220;<strong>hallucinations<\/strong>&#8221; or incorrect responses that do not follow the \u201ctruth\u201d. The hallucinations arise because of the nature of the large language model \u2013 they can generate responses that are not grounded in reality. This can happen when the model does not have enough information to generate a valid response or when it relies too heavily on its own internal biases.<\/p>\n\n\n\n<p>Another limitation of ChatGPT is its <strong>inability to handle custom datasets<\/strong>. The model is pre-trained on a vast amount of text data, but it cannot be extended or limited to work with just a specific data source. This can limit the chatbot&#8217;s effectiveness in business use cases where domain-specific knowledge is essential.<\/p>\n\n\n\n<p>While ChatGPT has the potential to revolutionize the way we interact with chatbots, <strong>its limitations make it impossible to use in critical applications<\/strong>. &nbsp;However, it\u2019s still possible to build an accurate system with outstanding conversational capabilities.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>A domain-specific search engine<\/strong><\/h2>\n\n\n\n<p>As we know from above GPT-3 is pre-trained on the \u201centire internet\u201d and it\u2019s working well for general-propose questions. But what about domain-specific tasks like legal or pharmacy? Is it possible to build a highly accurate system relying on pre-trained Large Language Models?<br><br>The answer is yes, and it might be achieved by applying a hybrid approach <strong>combining semantic search engine and\/or Question-Answering<\/strong>. These two technologies can work together to provide more accurate, compute-efficient search results.<\/p>\n\n\n\n<p>The goal of a semantic search engine is to retrieve documents that are semantically related to the query rather than simply matching specific query keywords. In other words<strong>, a semantic search engine can understand the meaning and intention<\/strong> of the queries and match them with relevant documents.<\/p>\n\n\n\n<p>Meanwhile, question answering <strong>extracts the answer<\/strong> from the identified text passages. Modern Question Answering systems are usually based on the retriever-reader (with ranker) architecture.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Retriever<\/strong><\/h3>\n\n\n\n<p><strong>Retriever<\/strong> is responsible for retrieving relevant text passages for a given query containing the answer. There are two kinds of retrievers:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>sparse \u2013 use word frequencies to construct sparse vectors and on methods like TF-IDF or BM25,<\/li>\n\n\n\n<li>dense \u2013 requires constructing and training a deep neural network to embed both documents and queries in the same semantic space. However, it\u2019s also capable of capturing the user intentions and meaning of the queries, rather than relying solely on the keywords.<\/li>\n<\/ul>\n\n\n\n<p>On the other hand, the <strong>reader<\/strong> is responsible for extracting answers from the text passages provided by the <strong>retriever<\/strong> by selecting a text span with the exact answer.<\/p>\n\n\n\n<p>However, such a system still doesn\u2019t come with conversational capabilities and requires one more modification, such as the one described in the Retrieval-Augumented Generation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Custom ChatGPT<\/strong><\/h2>\n\n\n\n<p class=\"has-text-align-center\"><strong>Information Retrieval + Text Generation = Retrieval-Augmented Text Generation<\/strong><\/p>\n\n\n\n<p>Retrieval-augmented generation (RAG) models combine pre-trained dense retrieval and text generation models. In other words, found text passages are passed to a language generation model to enable conversation-like interactions. The above concept was introduced in \u201c<a href=\"https:\/\/proceedings.neurips.cc\/paper\/2020\/file\/6b493230205f780e1bc26945df7481e5-Paper.pdf\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\" rel=\"nofollow\" >Retrieval-Augumented Generation for Knowledge-Insensitive Tasks<\/a>\u201d (2020) by Patrick Lewis et. al.<\/p>\n\n\n\n<p>To simplify the idea, imagine that you are looking for some particular concept using your favourite search engine. However, it appears there is no single webpage answering your query, but rather you need to collect information from multiple sites by clicking on links and comprehending the information and synthesizing the answer by yourself. That\u2019s literally <strong>what RAG\u2019s approach does.<\/strong><\/p>\n\n\n\n<p>To sum up, current the above approach provides more accurate answers, while still preserving great conversational capabilities.&nbsp; The RAG method modifies the retriever-reader architecture by incorporating a generation component that can <strong>deliver an experience similar to speaking with a human expert.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/1-4-1024x384-1.png\"><img decoding=\"async\" width=\"1024\" height=\"384\" src=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/1-4-1024x384-1.png\" alt=\"\" class=\"wp-image-356\" srcset=\"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/1-4-1024x384-1.png 1024w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/1-4-1024x384-1-300x113.png 300w, https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/1-4-1024x384-1-768x288.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Fig. 1 Architecture retriever-reader architecture with GPT<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Summary<\/strong><\/h2>\n\n\n\n<p>In Sii, we have an extensive experience in semantic search engines and information retrieval systems. Currently, we\u2019ve been working on benefiting from RAG\u2019s approaches in order to push our search solutions one step forward and enable human-like interactions. But unlike ChatGPT, our solutions are free of the issue of hallucinations and provide highly accurate answers.<\/p>\n\n\n\n<p><\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-left kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;left&quot;,&quot;id&quot;:&quot;353&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;0&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;0&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;2&quot;,&quot;greet&quot;:&quot;&quot;,&quot;legend&quot;:&quot;0\\\/5&quot;,&quot;size&quot;:&quot;30&quot;,&quot;title&quot;:&quot;How to build Custom ChatGPT?&quot;,&quot;width&quot;:&quot;0&quot;,&quot;_legend&quot;:&quot;{score}\\\/5&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 0px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 2px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 30px; height: 30px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 24px;\">\n            <span class=\"kksr-muted\"><\/span>\n    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>ChatGPT is a sensational new chatbot technology that has taken the internet by storm. It is a cutting-edge AI-based chatbot &hellip; <a class=\"continued-btn\" href=\"https:\/\/sii.ua\/blog\/en\/how-to-build-custom-chatgpt\/\">Continued<\/a><\/p>\n","protected":false},"author":31,"featured_media":358,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","inline_featured_image":false,"footnotes":""},"categories":[10],"tags":[45,44,81],"class_list":["post-353","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-soft-development","tag-ai","tag-chatgpt","tag-tools"],"acf":[],"aioseo_notices":[],"featured_media_url":"https:\/\/sii.ua\/blog\/wp-content\/uploads\/2024\/01\/What-is-ChatGPT.jpg","category_names":["Soft development"],"_links":{"self":[{"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/posts\/353"}],"collection":[{"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/comments?post=353"}],"version-history":[{"count":2,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/posts\/353\/revisions"}],"predecessor-version":[{"id":361,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/posts\/353\/revisions\/361"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/media\/358"}],"wp:attachment":[{"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/media?parent=353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/categories?post=353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sii.ua\/blog\/en\/wp-json\/wp\/v2\/tags?post=353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}