Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tut] Alien Technology: Catching Up on LLMs, Prompting, ChatGPT Plugins & Embeddings

#1
[Tut] Alien Technology: Catching Up on LLMs, Prompting, ChatGPT Plugins & Embeddings

<div>
<div class="kk-star-ratings kksr-auto kksr-align-left kksr-valign-top" data-payload='{&quot;align&quot;:&quot;left&quot;,&quot;id&quot;:&quot;1553158&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;top&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;2&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;Rate this post&quot;,&quot;legend&quot;:&quot;5\/5 - (2 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;Alien Technology: Catching Up on LLMs, Prompting, ChatGPT Plugins &amp; Embeddings&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;{score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>
<div class="kksr-stars">
<div class="kksr-stars-inactive">
<div class="kksr-star" data-star="1" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="2" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="3" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="4" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="5" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
<div class="kksr-stars-active" style="width: 142.5px;">
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
</div>
<div class="kksr-legend" style="font-size: 19.2px;"> 5/5 – (2 votes) </div>
</p></div>
<h2 class="wp-block-heading">What is a LLM?</h2>
<p class="has-global-color-8-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> From a technical standpoint, a <strong>large language model (LLM)</strong> can be seen as a massive file on a computer, containing billions or even trillions of numerical values, known as <em>parameters</em>. These parameters are fine-tuned through extensive training on diverse datasets, capturing the statistical properties of human language.</p>
<p>However, such a dry description hardly does justice to the magic of LLMs. From another perspective, they function almost like an oracle. You call upon them with a query, such as <code>llm("What is the purpose of life")</code>, and they may respond with something witty, insightful, or enigmatic, like <code>"42"</code> (a humorous nod to Douglas Adams’ <em>The Hitchhiker’s Guide to the Galaxy</em>).</p>
<p>By the way, you can check out my article on using LLMs like this in the command line here: <img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f447.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<div class="wp-block-image">
<figure class="aligncenter size-large"><a href="https://blog.finxter.com/how-to-run-large-language-models-llms-in-your-command-line/" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="1024" height="576" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-169-1024x576.png" alt="" class="wp-image-1555959" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-169-1024x576.png 1024w, https://blog.finxter.com/wp-content/uplo...00x169.png 300w, https://blog.finxter.com/wp-content/uplo...68x432.png 768w, https://blog.finxter.com/wp-content/uplo...ge-169.png 1282w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>
</div>
<p class="has-base-2-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a rel="noreferrer noopener" href="https://blog.finxter.com/how-to-run-large-language-models-llms-in-your-command-line/" data-type="URL" data-id="https://blog.finxter.com/how-to-run-large-language-models-llms-in-your-command-line/" target="_blank">How to Run Large Language Models (LLMs) in Your Command Line?</a></p>
<p>Isn’t it wild to think about how Large Language Models (LLMs) can turn math into something almost magical? It’s like they’re blending computer smarts with human creativity, and the possibilities are just getting started.</p>
<p>Now, here’s where it gets really cool. </p>
<p>These LLMs take all kinds of complex patterns and knowledge and pack them into binary files full of numbers. We don’t really understand what these numbers represent but together they encode a deep understanding of the world. LLMs are densely compressed human wisdom, knowledge, and intelligence. Now imagine having these files and being able to <strong>copy them millions of times, running them all at once</strong>. </p>
<p>It’s like having a huge team of super-smart people, but they’re all in your computer.</p>
<p>So picture this: <strong>Millions of brainy helpers in your pocket, working day and night on anything you want.</strong></p>
<p class="has-global-color-8-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f468-200d-2695-fe0f.png" alt="?‍⚕️" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You know how doctors are always trying to figure out the best way to treat illnesses? Imagine having millions of super-smart helpers to quickly find the answers. </p>
<p><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4c8.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Or think about your savings and investments; what if you had a team of top financial experts guiding you 24/7 to make the smartest choices with your money? </p>
<p><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f3eb.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> And for kids in school, picture having a personal tutor for every subject, making sure they understand everything perfectly. LLMs is like having an army of geniuses at your service for anything you need.</p>
<figure class="wp-block-image size-full"><img decoding="async" loading="lazy" width="735" height="735" src="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_multidimensional_vector_space_1831155e-b10e-48a4-abe1-323aa76cfff3.png" alt="" class="wp-image-1556062" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_multidimensional_vector_space_1831155e-b10e-48a4-abe1-323aa76cfff3.png 735w, https://blog.finxter.com/wp-content/uplo...00x300.png 300w, https://blog.finxter.com/wp-content/uplo...50x150.png 150w" sizes="(max-width: 735px) 100vw, 735px" /></figure>
<p>LLMs, what <a rel="noreferrer noopener" href="https://simonwillison.net/2023/Aug/3/weird-world-of-llms/" data-type="URL" data-id="https://simonwillison.net/2023/Aug/3/weird-world-of-llms/" target="_blank">Willison</a> calls <strong><em>alien technology</em></strong>, have brought us closer to solving the riddle of intelligence itself, turning what was once the exclusive domain of human cognition into something that can be copied, transferred, and harnessed like never before. </p>
<p>I’d go as far as to say that the age-old process of <strong><em>reproducing human intelligence has been transcended</em></strong>. Intelligence is solved. LLMs will only become smarter from now on. Like the Internet, LLMs will stay and proliferate and penetrate every single sector of our economy.</p>
<h2 class="wp-block-heading">How Do LLMs Work?</h2>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" loading="lazy" width="735" height="735" src="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_alien_technology_utopia_9aa17f57-90a9-4c45-bbb2-b9a65755005d.png" alt="" class="wp-image-1556054" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_alien_technology_utopia_9aa17f57-90a9-4c45-bbb2-b9a65755005d.png 735w, https://blog.finxter.com/wp-content/uplo...00x300.png 300w, https://blog.finxter.com/wp-content/uplo...50x150.png 150w" sizes="(max-width: 735px) 100vw, 735px" /></figure>
</div>
<p>The underlying mechanism of Large Language Models (LLMs) might seem almost counterintuitive when you delve into how they operate. At their core, LLMs are essentially <strong>word-prediction machines</strong>, fine-tuned to anticipate the most likely next <em>word</em> (more precisely: <em>token</em>) in a sequence.</p>
<p>For example consider ChatGPT’s LLM chat interface that has reached product market fit and is used by hundreds of millions of users. The ingenious “hack” that allows LLMs to participate in a chat interface is all about how the input is framed. In essence, the model isn’t inherently conversing with a user; it’s continuing a text, based on a conversational pattern it has learned from vast amounts of data.</p>
<p>Consider this simplified example:</p>
<pre class="wp-block-preformatted"><code>You are a helpful assistant User: What is the purpose of life?
Assistant: 42
User: Can you elaborate?
Assistant:</code>
</pre>
<p>Here’s what’s happening under the hood:</p>
<ol>
<li><strong>Setting the Scene</strong>: The introductory line, <code>"You are a helpful assistant"</code> sets a <em>context </em>for the LLM. It provides an instruction to guide its responses, influencing its <em>persona</em>.</li>
<li><strong>User Input</strong>: The following lines are framed as a dialogue, but to the LLM, it’s all part of a text it’s trying to continue. When the user asks, <code>"What is the purpose of life?"</code> the LLM looks at this as the next part of a story, or a scene in a play, and attempts to predict the next word or phrase that makes the most sense.</li>
<li><strong>Assistant Response</strong>: The assistant’s response, <code>"42"</code> is the model’s guess for the next word, given the text it has seen so far. It’s a clever completion, reflecting the model’s training on diverse and creative texts. In the second run, however, the whole conversation is used as input and the LLM just completes the conversation. </li>
<li><strong>Continuing the Conversation</strong>: When the user follows up with <code>"Can you elaborate?"</code> the LLM is once again seeking to continue the text. It’s not consciously leading a conversation but following the statistical patterns it has learned, which, in this context, would typically lead to an elaboration.</li>
</ol>
<p>The magic is in how all these elements come together to create an illusion of a conversation. In reality, the LLM doesn’t understand the conversation or its participants. It’s merely predicting the next word, based on an intricately crafted pattern.</p>
<p>This “dirty little hack” transforms a word-prediction engine into something that feels interactive and engaging, demonstrating the creative application of technology and the power of large-scale pattern recognition. It’s a testament to human ingenuity in leveraging statistical learning to craft experiences that resonate on a very human level.</p>
<p class="has-global-color-8-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Prompt Engineering</strong> is a clever technique used to guide the behavior of Large Language Models (LLMs) by crafting specific inputs, or prompts, that steer the model’s responses. It’s akin to creatively “hacking” the model to generate desired outputs. </p>
<p>For example, if you want the LLM to act like a Shakespearean character, you might begin with a prompt like <code>"Thou art a poet from the Elizabethan era"</code>. The model, recognizing the pattern and language style, will respond in kind, embracing a Shakespearean tone. </p>
<p>This trickery through carefully designed prompts transforms a word-prediction machine into a versatile and interactive tool that can mimic various styles and tones, all based on how you engineer the initial prompt.</p>
<h2 class="wp-block-heading">Prompt Engineering with Python and OpenAI</h2>
<figure class="wp-block-image size-full"><a href="https://academy.finxter.com/university/prompt-engineering-with-python-and-openai/" target="_blank" rel="noreferrer noopener"><img decoding="async" loading="lazy" width="799" height="350" src="https://blog.finxter.com/wp-content/uploads/2023/06/image-288.png" alt="" class="wp-image-1463464" srcset="https://blog.finxter.com/wp-content/uploads/2023/06/image-288.png 799w, https://blog.finxter.com/wp-content/uplo...00x131.png 300w, https://blog.finxter.com/wp-content/uplo...68x336.png 768w" sizes="(max-width: 799px) 100vw, 799px" /></a></figure>
<p>You can check out the whole <a href="https://academy.finxter.com/university/prompt-engineering-with-python-and-openai/" data-type="URL" data-id="https://academy.finxter.com/university/prompt-engineering-with-python-and-openai/" target="_blank" rel="noreferrer noopener">course on OpenAI Prompt Engineering using Python on the Finxter academy</a>. We cover topics such as:</p>
<ul>
<li>Embeddings</li>
<li>Semantic search</li>
<li>Web scraping</li>
<li>Query embeddings</li>
<li>Movie recommendation</li>
<li>Sentiment analysis</li>
</ul>
<p class="has-base-2-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f468-200d-1f4bb.png" alt="?‍?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Academy</strong>: <a href="https://academy.finxter.com/university/prompt-engineering-with-python-and-openai/" data-type="URL" data-id="https://academy.finxter.com/university/prompt-engineering-with-python-and-openai/" target="_blank" rel="noreferrer noopener">Prompt Engineering with Python and OpenAI</a></p>
<h2 class="wp-block-heading">What’s the Secret of LLMs?</h2>
<p>The secret to the magical capabilities of Large Language Models (LLMs) seems to lie in a simple and perhaps surprising element: <strong>scale</strong>. <img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f447.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p class="has-global-color-8-background-color has-background"><strong>The colossal nature of these models is both their defining characteristic and the key to their unprecedented performance.</strong></p>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" loading="lazy" width="735" height="735" src="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_alien_technology_utopia_589cfca8-617a-4fbf-b044-3fd0dc38b50a.png" alt="" class="wp-image-1556055" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_alien_technology_utopia_589cfca8-617a-4fbf-b044-3fd0dc38b50a.png 735w, https://blog.finxter.com/wp-content/uplo...00x300.png 300w, https://blog.finxter.com/wp-content/uplo...50x150.png 150w" sizes="(max-width: 735px) 100vw, 735px" /></figure>
</div>
<p>Tech giants like Meta, Google, and Microsoft have dedicated immense resources to developing LLMs. How immense? We’re talking about millions of dollars spent on cutting-edge computing power and terabytes of textual data to train these models. It’s a gargantuan effort that converges in a matrix of numbers — the model’s parameters — that represent the learned patterns of human language.</p>
<p>The scale here isn’t just large; it’s virtually unprecedented in computational history. These models consist of billions or even trillions of parameters, fine-tuned across diverse and extensive textual datasets. By throwing such vast computational resources at the problem, these corporations have been able to capture intricate nuances and create models that understand and generate human-like text.</p>
<p>However, this scale comes with challenges, including the enormous energy consumption of training such models, the potential biases embedded in large-scale data, and the barrier to entry for smaller players who can’t match the mega corporations’ resources.</p>
<p>The story of LLMs is a testament to the “bigger is better” philosophy in the world of artificial intelligence. It’s a strategy that seems almost brute-force in nature but has led to a qualitative leap in machine understanding of human language. It illustrates the power of scale, paired with ingenuity and extensive resources, to transform a concept into a reality that pushes the boundaries of what machines can achieve.</p>
<h2 class="wp-block-heading">Attention Is All You Need</h2>
<p>The 2017 paper by Google <em><a href="https://arxiv.org/abs/1706.03762" data-type="URL" data-id="https://arxiv.org/abs/1706.03762" target="_blank" rel="noreferrer noopener">“Attention is All You Need”</a></em> marked a significant turning point in the world of artificial intelligence. It introduced the concept of transformers, a novel architecture that is uniquely scalable, allowing training to be run across many computers in parallel both efficiently and easily.</p>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" loading="lazy" width="821" height="922" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-67.png" alt="" class="wp-image-1556013" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-67.png 821w, https://blog.finxter.com/wp-content/uplo...67x300.png 267w, https://blog.finxter.com/wp-content/uplo...68x862.png 768w" sizes="(max-width: 821px) 100vw, 821px" /></figure>
</div>
<p>This was not just a theoretical breakthrough but a practical realization that the model could continually improve with <strong>more and more compute and data</strong>. </p>
<p class="has-global-color-8-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Key Insight</strong>: By using <strong>unprecedented amount of compute</strong> on <strong>unprecedented amount of data</strong> on a simple neural network architecture (transformers), intelligence seems to emerge as a natural phenomenon.</p>
<p>Unlike other algorithms that may plateau in performance, transformers seemed to exhibit emerging properties that nobody fully understood at the time. They could understand intricate language patterns, even developing coding-like abilities. The more data and computational power thrown at them, the better they seemed to perform. They didn’t converge or flatten out in effectiveness with increased scale, a behavior that was both fascinating and mysterious.</p>
<p>OpenAI, under the guidance of Sam Altman, recognized the immense potential in this architecture and decided to push it farther than anyone else. The result was a series of models, culminating in state-of-the-art transformers, trained on an unprecedented scale. By investing in massive computational resources and extensive data training, OpenAI helped usher in a new era where large language models could perform tasks once thought to be exclusively human domains.</p>
<p>This story highlights the surprising and yet profound nature of innovation in AI. </p>
<p><em><strong>A simple concept, scaled to extraordinary levels, led to unexpected and groundbreaking capabilities.</strong></em> It’s a reminder that sometimes, the path to technological advancement isn’t about complexity but about embracing a fundamental idea and scaling it beyond conventional boundaries. In the case of transformers, scale was not just a means to an end but a continually unfolding frontier, opening doors to capabilities that continue to astonish and inspire.</p>
<h2 class="wp-block-heading">Ten Tips to Use LLMs Effectively</h2>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" loading="lazy" width="735" height="735" src="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_alien_technology_utopia_7d20feaa-398f-4042-8f55-926c96144eee.png" alt="" class="wp-image-1556056" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_alien_technology_utopia_7d20feaa-398f-4042-8f55-926c96144eee.png 735w, https://blog.finxter.com/wp-content/uplo...00x300.png 300w, https://blog.finxter.com/wp-content/uplo...50x150.png 150w" sizes="(max-width: 735px) 100vw, 735px" /></figure>
</div>
<p>As powerful and versatile as Large Language Models (LLMs) are, harnessing their full potential can be a complex endeavor. </p>
<p>Here’s a series of tricks and insights to help tech enthusiasts like you use them effectively:</p>
<ol>
<li><strong>Accept that No Manual Exists</strong>: There’s no step-by-step guide to mastering LLMs. The field is still relatively new, and best practices are continually evolving. Flexibility and a willingness to experiment are essential.</li>
<li><strong>Iterate and Refine</strong>: Don’t reject the model’s output too early. Your first output might not be perfect, but keep iterating. Anyone can get an answer from an LLM, but extracting good answers requires persistence and refinement. You can join our <a rel="noreferrer noopener" href="https://academy.finxter.com/university/prompt-engineering-an-introduction/" data-type="URL" data-id="https://academy.finxter.com/university/prompt-engineering-an-introduction/" target="_blank">prompt engineering beginner</a> and <a rel="noreferrer noopener" href="https://academy.finxter.com/university/prompt-engineering-with-python-and-openai/" data-type="URL" data-id="https://academy.finxter.com/university/prompt-engineering-with-python-and-openai/" target="_blank">expert courses</a> to push your own understanding to the next level.</li>
<li><strong>Leverage Your Domain Knowledge</strong>: If you know coding, use LLMs to assist with coding tasks. If you’re a marketer, apply them for content generation. Your expertise in a particular area will allow you to maximize the model’s capabilities.</li>
<li><strong>Understand How the Model Works</strong>: A rough understanding of the underlying mechanics can be immensely beneficial. Following tech news, like our <a href="https://blog.finxter.com/email-academy/" data-type="page" data-id="12278" target="_blank" rel="noreferrer noopener">daily Finxter emails</a>, can keep you informed and enhance your ability to work with LLMs.</li>
<li><strong>Gain Intuition by Experimenting</strong>: Play around with different prompts and settings. Daily hands-on practice can lead to an intuitive feel for what works and what doesn’t.</li>
<li><strong>Know the Training Cut-off Date</strong>: Different models have different cut-off dates. For example, OpenAI’s GPT-3.5 models were trained until September 2021, while <a rel="noreferrer noopener" href="https://blog.finxter.com/claude-2-read-ten-papers-in-one-prompt-with-massive-200k-token-context/" data-type="post" data-id="1493779" target="_blank">Claude 2 Anthropic</a> and <a rel="noreferrer noopener" href="https://blog.finxter.com/deep-dive-google-med-palm-2-generative-ai-in-healthcare/" data-type="post" data-id="1524094" target="_blank">Google PaLM 2</a> are more recent. This can affect the accuracy and relevance of the information they provide.</li>
<li><strong>Understand Context Length</strong>: Models have limitations on the number of tokens (words, characters, spaces) they can handle. It’s 4000 tokens for GPT-3, 8000 for GPT-4, and <a href="https://blog.finxter.com/claude-2-read-ten-papers-in-one-prompt-with-massive-200k-token-context/" data-type="URL" data-id="https://blog.finxter.com/claude-2-read-ten-papers-in-one-prompt-with-massive-200k-token-context/" target="_blank" rel="noreferrer noopener">100k for Claude 2</a>. Tailoring your input to these constraints will yield better results.</li>
<li><strong>Develop a “Sixth Sense” for Hallucinations</strong>: Sometimes, LLMs may generate information that seems plausible but is incorrect or <em><a href="https://blog.finxter.com/hallucinations-in-ai-with-chatgpt-examples/" data-type="post" data-id="1239087" target="_blank" rel="noreferrer noopener">hallucinated</a></em>. Developing an intuition for recognizing and avoiding these instances is key to reliable usage.</li>
<li><strong>Stay Engaged with the Community</strong>: Collaborate with others, join forums, and stay abreast of the latest developments. The collective wisdom of the community is a powerful asset in mastering these technologies.</li>
<li><strong>Be Creative</strong>: Prompt the model for creative ideas (e.g., <code>"Give me 20 ideas on X"</code>). The first answers might be obvious, but further down the list, you might find a spark of brilliance.</li>
</ol>
<h2 class="wp-block-heading">Retrieval Augmented Generation</h2>
<p class="has-global-color-8-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Retrieval Augmented Generation (RAG)</strong> represents an intriguing intersection between the vast capabilities of Large Language Models (LLMs) and the power of information retrieval. It’s a technique that marries the best of both worlds, offering a compelling approach to generating information and insights.</p>
<p>Here’s how it works and why it’s making waves in the tech community:</p>
<h3 class="wp-block-heading">What is Retrieval Augmented Generation?</h3>
<p>RAG is a method that, instead of directly training a model on specific data or documents, leverages the vast information already available on the internet. By searching for relevant content, it pulls this information together and uses it as a foundation for asking an LLM to generate an answer.</p>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" loading="lazy" width="1024" height="475" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-68-1024x475.png" alt="" class="wp-image-1556026" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-68-1024x475.png 1024w, https://blog.finxter.com/wp-content/uplo...00x139.png 300w, https://blog.finxter.com/wp-content/uplo...68x356.png 768w, https://blog.finxter.com/wp-content/uplo...36x713.png 1536w, https://blog.finxter.com/wp-content/uplo...48x950.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption"><em><strong>Figure</strong>: Example of a simple RAG procedure pasting Wikipedia data into the context of a ChatGPT LLM prompt to extract useful information.</em></figcaption></figure>
</div>
<h3 class="wp-block-heading">How Does RAG Work?</h3>
<ol>
<li><strong>Search for Information</strong>: First, a search is conducted for content relevant to the query or task at hand. This could involve scouring databases, the web, or specialized repositories.</li>
<li><strong>Prepend the Retrieved Data</strong>: The content found is then prepended to the original query or prompt. Essentially, it’s added to the beginning of the question or task you’re posing to the LLM.</li>
<li><strong>Ask the Model to Answer</strong>: With this combined prompt, the LLM is then asked to generate an answer or complete the task. The prepended information guides the model’s response, grounding it in the specific content retrieved.</li>
</ol>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" loading="lazy" width="735" height="735" src="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_multidimensional_vector_space_c3602a10-6223-41ce-ace3-2ed93b127194.png" alt="" class="wp-image-1556061" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_multidimensional_vector_space_c3602a10-6223-41ce-ace3-2ed93b127194.png 735w, https://blog.finxter.com/wp-content/uplo...00x300.png 300w, https://blog.finxter.com/wp-content/uplo...50x150.png 150w" sizes="(max-width: 735px) 100vw, 735px" /></figure>
</div>
<h3 class="wp-block-heading">Why is RAG Valuable?</h3>
<ul>
<li><strong>Customization</strong>: It allows for tailored responses based on real-world data, not just the general patterns an LLM has learned from its training corpus.</li>
<li><strong>Efficiency</strong>: Rather than training a specialized model, which can be costly and time-consuming, RAG leverages existing models and augments them with relevant information.</li>
<li><strong>Flexibility</strong>: It can be applied to various domains, from coding to medical inquiries, by merely adapting the retrieval component to the area of interest.</li>
<li><strong>Quality</strong>: By guiding the model with actual content related to the query, it often results in more precise and contextually accurate responses.</li>
</ul>
<p>Retrieval Augmented Generation represents an elegant solution to some of the challenges in working with LLMs. It acknowledges that no model, no matter how large, can encapsulate the entirety of human knowledge. By dynamically integrating real-time information retrieval, RAG opens new horizons for LLMs, making them even more versatile and responsive to specific and nuanced inquiries.</p>
<p>In a world awash with information, the fusion of search and generation through RAG offers a sophisticated tool for navigating and extracting value. Here’s my simple formula for RAG:</p>
<pre class="wp-block-preformatted"><strong><code>USEFULNESS ~ LLM_CAPABILITY * CONTEXT_DATA</code></strong> <em>or more simply: </em><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f447.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" />
<strong><code>USEFULNESS ~ Intelligence * Information</code></strong></pre>
<p>Let’s examine an advanced and extremely powerful technique to provide helpful context to LLMs and, thereby, get the most out of it: <img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f447.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<h2 class="wp-block-heading">Embeddings and Vector Search: A Special Case of Retrieval Augmented Generation (RAG)</h2>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" loading="lazy" width="735" height="735" src="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_multidimensional_vector_space_6ecea198-d6f9-42a6-a9fe-6d10ee6ffc6b.png" alt="" class="wp-image-1556063" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_multidimensional_vector_space_6ecea198-d6f9-42a6-a9fe-6d10ee6ffc6b.png 735w, https://blog.finxter.com/wp-content/uplo...00x300.png 300w, https://blog.finxter.com/wp-content/uplo...50x150.png 150w" sizes="(max-width: 735px) 100vw, 735px" /></figure>
</div>
<p>In the broader context of RAG, a specialized technique called <strong>“Embeddings and Vector Search”</strong> takes text-based exploration to a new level, allowing for the construction of semantic search engines that leverage the capabilities of LLMs. </p>
<p>Here’s how it works:</p>
<h3 class="wp-block-heading">Transforming Text into Embeddings</h3>
<ol>
<li><strong>Text to Vector Conversion</strong>: Any string of text, be it a sentence, paragraph, or document, can be transformed into an array of floating-point numbers, or an “embedding”. <strong>This embedding encapsulates the semantic meaning of the text</strong> based on the LLM’s mathematical model of human language.</li>
<li><strong>Dimensionality</strong>: These embeddings are positioned in a high-dimensional space, e.g., 1,536 dimensions. Each dimension represents a specific aspect of the text’s semantic content, allowing for a nuanced representation.</li>
</ol>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" loading="lazy" width="735" height="735" src="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_multidimensional_vector_space_dcce585d-2b5d-4764-b0ed-23a965c7978a.png" alt="" class="wp-image-1556060" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/Finxter_multidimensional_vector_space_dcce585d-2b5d-4764-b0ed-23a965c7978a.png 735w, https://blog.finxter.com/wp-content/uplo...00x300.png 300w, https://blog.finxter.com/wp-content/uplo...50x150.png 150w" sizes="(max-width: 735px) 100vw, 735px" /></figure>
</div>
<h3 class="wp-block-heading">Example: Building a Semantic Search Engine</h3>
<ol>
<li><strong>Cosine Similarity Distance</strong>: To find the closest matches to a given query, the cosine similarity distance between vectors is calculated. This metric measures how closely the semantic meanings align between the query and the existing embeddings.</li>
<li><strong>Combining the Brain (LLM) with Application Data (Embedding)</strong>: By pairing the vast understanding of language embedded in LLMs with specific application data through embeddings, you create a bridge between generalized knowledge and specific contexts.</li>
<li><strong>Retrieval and Augmentation</strong>: The closest matching embeddings are retrieved, and the corresponding text data is prepended to the original query. This process guides the LLM’s response, just as in standard RAG.</li>
</ol>
<h3 class="wp-block-heading">Why is this Technique Important?</h3>
<p>You can use embeddings as input to LLM prompts to provide context in a highly condensed and efficient form. This solves one half of the problem of using LLMs effectively!</p>
<ul>
<li><strong>Precision</strong>: It offers a finely-tuned mechanism for retrieving content that semantically resonates with a given query.</li>
<li><strong>Scalability</strong>: The method can be applied to vast collections of text, enabling large-scale semantic search engines.</li>
<li><strong>Customization</strong>: By building embeddings from specific data sources, the search process can be tailored to the unique needs and contexts of different applications.</li>
</ul>
<p class="has-base-2-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Embeddings</strong> are a powerful extension of the RAG paradigm, enabling a deep, semantic understanding of text. By translating text into numerical vectors and leveraging cosine similarity, this technique builds bridges between the abstract mathematical understanding of language within LLMs and the real-world applications that demand precise, context-aware responses.</p>
<p>Using embeddings in OpenAI is as simple as running the following code:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">response = openai.Embedding.create( input="Your text string goes here", model="text-embedding-ada-002"
)
embeddings = response['data'][0]['embedding']</pre>
<p>Possible output:</p>
<pre class="wp-block-preformatted"><code>{ "data": [ { "embedding": [ -0.006929283495992422, -0.005336422007530928, ... -4.547132266452536e-05, -0.024047505110502243 ], "index": 0, "object": "embedding" } ], "model": "text-embedding-ada-002", "object": "list", "usage": { "prompt_tokens": 5, "total_tokens": 5 }
}</code></pre>
<p>If you want to dive deeper into embeddings, I recommend checking out our blog post and the detailed <a href="https://platform.openai.com/docs/guides/embeddings/what-are-embeddings" data-type="URL" data-id="https://platform.openai.com/docs/guides/embeddings/what-are-embeddings" target="_blank" rel="noreferrer noopener">OpenAI guide</a>!</p>
<figure class="wp-block-image size-large"><a href="https://blog.finxter.com/what-are-embeddings-in-openai-a-concise-explanation/" target="_blank" rel="noreferrer noopener"><img decoding="async" loading="lazy" width="1024" height="569" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-291-1024x569.png" alt="" class="wp-image-1555905" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-291-1024x569.png 1024w, https://blog.finxter.com/wp-content/uplo...00x167.png 300w, https://blog.finxter.com/wp-content/uplo...68x427.png 768w, https://blog.finxter.com/wp-content/uplo...ge-291.png 1290w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>
<p class="has-base-2-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a href="https://blog.finxter.com/what-are-embeddings-in-openai-a-concise-explanation/" data-type="URL" data-id="https://blog.finxter.com/what-are-embeddings-in-openai-a-concise-explanation/" target="_blank" rel="noreferrer noopener">What Are Embeddings in OpenAI?</a></p>
<h2 class="wp-block-heading">ChatGPT Plugins</h2>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" loading="lazy" width="1024" height="637" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-66-1024x637.png" alt="" class="wp-image-1555951" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-66-1024x637.png 1024w, https://blog.finxter.com/wp-content/uplo...00x187.png 300w, https://blog.finxter.com/wp-content/uplo...68x478.png 768w, https://blog.finxter.com/wp-content/uplo...age-66.png 1318w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>
<p>OpenAI has recently announced the initial support for plugins in ChatGPT. As part of the gradual rollout of these tools, the intention is to <strong>augment language models with capabilities that extend far beyond their existing functionalities. </strong></p>
<p class="has-global-color-8-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>ChatGPT plugins</strong> are tools specifically designed for language models to access up-to-date information, run computations, or use third-party services such as Expedia, Instacart, Shopify, Slack, Wolfram, and more.</p>
<p>The implementation of plugins opens up a vast range of possible use cases. From giving parents superpowers with Milo Family AI to enabling restaurant bookings through OpenTable, the potential applications are expansive. Examples like searching for flights with KAYAK or ordering groceries from local stores via Instacart highlight the practical and innovative utilization of these plugins.</p>
<p>OpenAI is also hosting two plugins, a <strong>web browser</strong> and a <strong>code interpreter</strong> (see below) to broaden the model’s reach and increase its functionality. An experimental browsing model will allow ChatGPT to access recent information from the internet, further expanding the content it can discuss with users.</p>
<p><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a href="https://blog.finxter.com/top-5-llm-python-libraries/" data-type="URL" data-id="https://blog.finxter.com/top-5-llm-python-libraries/" target="_blank" rel="noreferrer noopener">Top 5 LLM Python Libraries Like OpenAI, LangChain, Pinecone</a></p>
<h2 class="wp-block-heading">ChatGPT Code Interpreter: What Is It and How Does It Work?</h2>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://blog.finxter.com/wp-content/uploads/2023/07/data_vis_code_interpreter.gif" alt=""/></figure>
</div>
<p>The <a href="https://blog.finxter.com/gpt-4-code-interpreter-how-to-run-python-plot-data-in-chatgpt/" data-type="URL" data-id="https://blog.finxter.com/gpt-4-code-interpreter-how-to-run-python-plot-data-in-chatgpt/" target="_blank" rel="noreferrer noopener">ChatGPT Code Interpreter</a> is a revolutionary feature added to OpenAI’s GPT-4 model, enabling users to execute Python code within the ChatGPT environment. </p>
<p>It functions as a sandboxed Python environment where tasks ranging from PDF conversion using OCR to video trimming and mathematical problem-solving can be carried out. </p>
<p>Users can upload local files in various formats, including TXT, PDF, JPEG, and more, as the Code Interpreter offers temporary disk space and supports over 300 preinstalled Python packages. </p>
<p>Whether it’s data analysis, visualization, or simple file manipulations, the Code Interpreter facilitates these actions within a secure, firewalled environment, transforming the chatbot into a versatile computing interface. </p>
<p>Accessible to ChatGPT Plus subscribers, this feature amplifies the range of possibilities for both coders and general users, blending natural language interaction with direct code execution.</p>
<p>Here’s a list of tasks that can be solved by Code Interpreter that were previously solved by specialized data scientists:</p>
<ol>
<li><strong>Explore Your Data:</strong> You can upload various data files and look into them. It’s a handy way to see what’s going on with your numbers.</li>
<li><strong>Clean Up Your Data:</strong> If your data’s a little messy, you can tidy it up by removing duplicates or filling in missing parts.</li>
<li><strong>Create Charts and Graphs:</strong> Visualize your data by making different types of charts or graphs. It’s a straightforward way to make sense of complex information.</li>
<li><strong>Try Out Machine Learning:</strong> Build your own machine learning models to predict outcomes or categorize information. It’s a step into the more advanced side of data handling.</li>
<li><strong>Work with Text:</strong> Analyze texts to find out what’s being said or how it’s being expressed. It’s an interesting dive into natural language processing.</li>
<li><strong>Convert and Edit Files:</strong> Whether it’s PDFs, images, or videos, you can convert or modify them as needed. It’s quite a practical feature.</li>
<li><strong>Gather Data from Websites:</strong> You can pull data directly from web pages, saving time on collecting information manually.</li>
<li><strong>Solve Mathematical Problems:</strong> If you have mathematical equations or problems, you can solve them here. It’s like having a calculator that can handle more complex tasks.</li>
<li><strong>Experiment with Algorithms:</strong> Write and test your algorithms for various purposes. It’s a useful way to develop custom solutions.</li>
<li><strong>Automate Tasks:</strong> If you have repetitive or routine tasks, you can write scripts to handle them automatically.</li>
<li><strong>Edit Images and Videos:</strong> Basic editing of images and videos is possible, allowing for some creative applications.</li>
<li><strong>Analyze IoT Device Data:</strong> If you’re working with Internet of Things (IoT) devices, you can analyze their data in this environment.</li>
</ol>
<p>Here’s an example run in my ChatGPT environment:</p>
<figure class="wp-block-image"><img decoding="async" loading="lazy" width="706" height="965" src="https://blog.finxter.com/wp-content/uploads/2023/07/image-167.png" alt="" class="wp-image-1496247" srcset="https://blog.finxter.com/wp-content/uploads/2023/07/image-167.png 706w, https://blog.finxter.com/wp-content/uplo...19x300.png 219w" sizes="(max-width: 706px) 100vw, 706px" /></figure>
<p>Yay you can now run Python code and plot scripts in your ChatGPT environment!</p>
<p>If you click on the “Show work” button above, it toggles the code that was executed:</p>
<figure class="wp-block-image"><img decoding="async" loading="lazy" width="748" height="1024" src="https://blog.finxter.com/wp-content/uploads/2023/07/image-168-748x1024.png" alt="" class="wp-image-1496248" srcset="https://blog.finxter.com/wp-content/uploads/2023/07/image-168-748x1024.png 748w, https://blog.finxter.com/wp-content/uplo...19x300.png 219w, https://blog.finxter.com/wp-content/uplo...8x1052.png 768w, https://blog.finxter.com/wp-content/uplo...ge-168.png 801w" sizes="(max-width: 748px) 100vw, 748px" /></figure>
<p>A simple feature but powerful — using ChatGPT has now become even more convincing for coders like you and me.</p>
<p>To keep learning about OpenAI and Python, you can download our cheat sheet here:</p>
<div class="wp-block-image">
<figure class="aligncenter size-large"><a href="https://blog.finxter.com/openapi-cheat-sheet/" target="_blank" rel="noreferrer noopener"><img decoding="async" loading="lazy" width="1024" height="565" src="https://blog.finxter.com/wp-content/uploads/2023/07/image-87-1024x565.png" alt="" class="wp-image-1483904" srcset="https://blog.finxter.com/wp-content/uploads/2023/07/image-87-1024x565.png 1024w, https://blog.finxter.com/wp-content/uplo...00x165.png 300w, https://blog.finxter.com/wp-content/uplo...68x424.png 768w, https://blog.finxter.com/wp-content/uplo...age-87.png 1300w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>
</div>
<p class="has-base-2-background-color has-background"><img decoding="async" src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f517.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a href="https://blog.finxter.com/openapi-cheat-sheet/" data-type="URL" data-id="https://blog.finxter.com/openapi-cheat-sheet/" target="_blank" rel="noreferrer noopener">Python OpenAI API Cheat Sheet (Free)</a></p>
<p><strong>Resources:</strong></p>
<ul>
<li><a href="https://openai.com/blog/chatgpt-plugins" target="_blank" rel="noreferrer noopener">https://openai.com/blog/chatgpt-plugins</a></li>
<li><a rel="noreferrer noopener" href="https://simonwillison.net/2023/Aug/3/weird-world-of-llms/" target="_blank">https://simonwillison.net/2023/Aug/3/weird-world-of-llms/</a></li>
<li><a href="https://beebom.com/chatgpt-code-interpreter/" target="_blank" rel="noreferrer noopener">https://beebom.com/chatgpt-code-interpreter/</a></li>
<li><a href="https://chat.openai.com" target="_blank" rel="noreferrer noopener">https://chat.openai.com</a></li>
</ul>
<p>The post <a rel="nofollow" href="https://blog.finxter.com/alien-technology-catching-up-on-llms-prompting-chatgpt-plugins-embeddings-code-interpreter/">Alien Technology: Catching Up on LLMs, Prompting, ChatGPT Plugins & Embeddings</a> appeared first on <a rel="nofollow" href="https://blog.finxter.com">Be on the Right Side of Change</a>.</p>
</div>


https://www.sickgaming.net/blog/2023/08/...mbeddings/
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016