<?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 Steve Ickman on Medium]]></title>
        <description><![CDATA[Stories by Steve Ickman on Medium]]></description>
        <link>https://medium.com/@ickman?source=rss-c580a5ea9898------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*XrxTnzzZRe1SbcI0</url>
            <title>Stories by Steve Ickman on Medium</title>
            <link>https://medium.com/@ickman?source=rss-c580a5ea9898------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 01:07:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ickman/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[Convo: Better agentic workflows through pseudocode]]></title>
            <link>https://medium.com/@ickman/convo-better-agentic-workflows-through-pseudocode-78ba94648eda?source=rss-c580a5ea9898------2</link>
            <guid isPermaLink="false">https://medium.com/p/78ba94648eda</guid>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[convo]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Steve Ickman]]></dc:creator>
            <pubDate>Wed, 15 Jan 2025 23:27:19 GMT</pubDate>
            <atom:updated>2025-01-15T23:27:19.093Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mr2-8PBGQvpvPu257vK8WA.png" /></figure><p>This post is a bit of an update to my now aging <a href="https://medium.com/@ickman/instruct-making-llms-do-anything-you-want-ff4259d4b91">INSTRUCT </a>post. Models have come a long way in the last 2 years. My understanding of how models think has evolved substantially along with their instruction following ability. I’ve long since stopped using INSTRUCT and while I thought it was ground breaking at the time, it’s simply not needed anymore. I thought I’d share with you what I strongly suspect is the future of instruction following. I call it Convo and like INSTRUCT it’s more of a prompting technique then anything.</p><h4>Convo Overview</h4><p><a href="https://github.com/Stevenic/convo">Convo</a> is billed as a Conversational Programming Language but in reality its just <a href="https://en.wikipedia.org/wiki/Pseudocode">pseudocode</a>. You can read the <a href="https://github.com/Stevenic/convo?tab=readme-ov-file#origins-and-why-convo-works">origin story</a> for Convo but its basically the result of a session with o1-preview where I asked the model to synthesize a new conversational programming language that has the best features of all known programming languages. The output of that session was a <a href="https://github.com/Stevenic/convo/blob/main/convo-spec.md">language spec</a> that defines the Convo language. The spec is only needed at design time and all it does is put the LLM in the correct frame of mind for generating a program based on pseudocode. You could probably just tell the LLM to write pseudocode but the spec adds a bit of consistency to the generated programs. As a quick example here’s the Convo program for the game Snake:</p><pre>Section: Game Setup<br><br>Create a grid with 20 rows and 20 columns.<br>Create a snake starting at the center of the grid with a length of 3.<br>Set the initial direction of the snake to &quot;right&quot;.<br>Place a food item randomly on the grid.<br><br>Section: Game Loop<br><br>While the game is running,<br>    Display the grid with the snake and food.<br>    Ask the user for the direction (up, down, left, right).<br>    If the direction is valid, then<br>        Update the snake&#39;s direction to the user&#39;s input.<br>    Move the snake in the current direction.<br>    If the snake eats the food, then<br>        Increase the snake&#39;s length by 1.<br>        Place a new food item randomly on the grid.<br>    If the snake collides with itself or the wall, then<br>        End the game and display &quot;Game Over! Your score is [snake&#39;s length].&quot;<br><br>Section: Functions<br><br>To display the grid with the snake and food,<br>    Clear the screen.<br>    For each cell in the grid,<br>        If the cell contains a part of the snake, then<br>            Display &quot;S&quot;.<br>        Else if the cell contains food, then<br>            Display &quot;F&quot;.<br>        Else<br>            Display &quot;.&quot;.<br><br>To move the snake in the current direction,<br>    Calculate the new head position based on the current direction.<br>    Add the new head position to the snake.<br>    Remove the last part of the snake unless it has just eaten food.<br><br>To place a food item randomly on the grid,<br>    Choose a random empty cell on the grid.<br>    Place the food item in that cell.</pre><p>That was created with my <a href="https://chatgpt.com/g/g-AL8dpM0dQ-convo">Convo GPT</a> using a prompt of “create the game snake”. You could then transpile this program to JavaScript or Python using “convert that to JavaScript + HTML” or “convert that to Python” respectively. So what’s the advantage of the extra step?</p><p>The issue with using a prompt like “create the game of snake using Python” is that every time you run the prompt you’re going to get a version of snake with slightly different features. When you ask the LLM to create a python version of snake you’re leaving a lot of the decisions for what features the game should have up to the model. That means the model may make different decisions about what features to give the game every time the prompt is run. If you look at the convo version of the game though, it’s basically what we would classically consider a <a href="https://simple.wikipedia.org/wiki/Program_specification">Program Specification</a>. When you ask the model to convert the convo version of snake to python you’ve already made most of the high level feature decisions for the model so the only thing it needs to decide is how it wants to implement the game. The end result is much more stable code generation across model calls.</p><p>Since a Convo program is just pseudocode that means that if you want to make tweaks to a Convo program you can just make them. The great thing about pseudocode is that it’s not a formal language. You can have logic errors but it’s impossible to have syntax errors. Also, pseudocode has a special ability called “magic” where you can just hand wave about how something should work. You can do the same thing in Convo by saying something like “do what you think is appropriate” and the model will fill in the blanks. The more specific you are in your Convo program the more stable the output will be and the less specific you are the more creative the output will be.</p><h4>Convo in Agentic Workflows</h4><p>One use of Convo is as an intermediate Program Specification language for better code generation, but another is as a Tool Orchestration language in Agentic Workflows. Not only can the model write and transpile Convo programs, it can interpret them as well. I’m finding gpt-4o to be pretty solid in its ability to run convo programs. Here’s the Convo program for an example food ordering bot for Microsoft Teams:</p><pre>Section: Main Program<br>Display &quot;Welcome to The Pub {users first name}! I&#39;m your food ordering assistant.&quot;<br><br>Attempt to retrieve the last order for this user from memory.<br>If order is available, then<br>    Ask the user, &quot;Welcome back, [user&#39;s name]! Last time, you had [order information]. Would you like the same order again?&quot;<br>    Let their response be &quot;repeat_order&quot;.<br><br>    If repeat_order is &quot;yes&quot;, then<br>        Call place_order with the previous order information.<br>        Let the order_id be the result.<br>        Save the last order to memory.<br>        Use send_adaptive_card to send the user their order information using the ORDER_CARD template.<br>        End the program.<br><br>    Otherwise,<br>        Display &quot;Let&#39;s create a new order for you!&quot;<br>Else,<br>    Display &quot;Let&#39;s create your first order!&quot;<br><br>Ask the user, &quot;What would you like to order today? You can include a pizza, a drink, or both.&quot;<br>Let the user&#39;s order be their response.<br><br>Ask the user to confirm their order by saying, &quot;You ordered: [user&#39;s order]. Is that correct?&quot;<br>Let their confirmation be their response.<br><br>If confirmation is &quot;yes&quot;, then<br>    Place_order with the user&#39;s order.<br>    Let the order_id be the result.<br>    Update_memory with the last order information.<br>    Use send_adaptive_card to send the user their order information using the ORDER_CARD template.<br> Else,<br>    Display &quot;No worries! Let&#39;s try again.&quot;<br>    Restart the program.<br><br>Display &quot;Thank you for ordering from The Pub! Have a great day!&quot;</pre><p>This Convo program is paired with <strong>set_variable</strong>, <strong>send_adaptive_card</strong>, and <strong>place_order</strong> tools. The prompt template used looks like this:</p><pre>{{$persona}}<br>The PROGRAM below defines how you should manage conversations with a user.<br><br>&lt;PROGRAM&gt;<br>{{$programCode}}<br><br>&lt;PROGRAM_DATA&gt;<br>{{$programData}}<br><br>&lt;SYSTEM_VARIABLES&gt;<br>date: {{$date}}<br>{{$variables}}<br><br>&lt;CONVERSATION_VARIABLES&gt;<br>{{$conversation_variables}}<br><br>&lt;USER_VARIABLES&gt;<br>{{$user_variables}}<br>{{$userInfo}}<br><br>&lt;INSTRUCTIONS&gt;<br>Run the specified PROGRAM by executing each step.<br>Use the conversation history and VARIABLES to track where you are in the program.<br>Use PROGRAM_DATA for additional context.<br>{{$instructions}}</pre><p>This prompt is geared towards the <a href="https://github.com/microsoft/teams-ai">Teams AI Library</a> so in practice you wouldn’t need all of the sections and you could probably simply it down to this:</p><pre>The PROGRAM below defines how you should manage conversations with a user.<br><br>&lt;PROGRAM&gt;<br>{{$programCode}}<br><br>&lt;PROGRAM_DATA&gt;<br>{{$programData}}<br><br>&lt;VARIABLES&gt;<br>{{$programVariables}}<br><br>&lt;INSTRUCTIONS&gt;<br>Run the specified PROGRAM by executing each step.<br>Use the conversation history and VARIABLES to track where you are in the program.<br>Use PROGRAM_DATA for additional context.</pre><p>The <strong>&lt;PROGRAM&gt;</strong> marks the start of your Convo program and the <strong>&lt;PROGRAM_DATA&gt;</strong> section marks the start of any RAG data. For the order bot I pass in the menu as markdown and a JSON template for the Adaptive Card I want the bot to send with the order confirmation. The model can use a <strong>set_variables</strong> tool to persist values to the <strong>&lt;VARIABLES&gt;</strong> section. The <strong>&lt;INSTRUCTIONS&gt;</strong> section frames everything by telling the model how to run the Convo program. Notice that there’s no need for the Convo Spec as Convo programs are just pseudocode and models natively understand pseudocode.</p><p>As I said, gpt-4o is pretty solid at following the provided program. There will be times when it won’t do exactly the sequence you want and you have to tweak the program a bit but in general it’s really good at following the program. I don’t have any measurable evidence to support this but I suspect that by framing the prompt as a program to be run, this actually improves the models instruction following ability. Basically, the model knows that programs are supposed to follow their instructions.</p><p>The model uses a combination of its Conversation History and &lt;VARIABLES&gt; to track where it is in the program. For chat bots, you can think of the program as a script similar to what you’d give a human agent. Like a human the model will generally follow the script but it’s very flexible. The user can enter the flow at any point, or jump around within the flow, and the model will help the user and then work to drive the conversation back to the scripted flow. I’ve built 4 or 5 bots based on Convo now and I’ve noticed that the model is able to track multiple goals and drive them to completion in a very human like way.</p><p>The &lt;VARIABLES&gt; aren’t 100% required but they give the model a way persist information across conversations and help avoid potential information loss in long running conversations.</p><p>I’ve primarily used convo to orchestrate tool calls in chat bots but I’m starting explore its use in non-chat workflows. Convo is suitable for orchestrating any workflow that uses tools. Most models have been tuned to think they’re chat bots but if you force the model to always use tools you can run them in a more headless fashion.</p><h4>Conclusion (written by GPT)</h4><p>Convo represents a significant step forward in creating more agentic and structured workflows for interacting with large language models. By leveraging the simplicity and flexibility of pseudocode, Convo bridges the gap between high-level program specifications and the specific implementations models generate. This approach not only ensures greater consistency in outputs but also enhances the model’s ability to interpret and execute instructions across diverse contexts.</p><p>Whether used as a stable intermediary for code generation or as a framework for orchestrating tools in agentic workflows, Convo demonstrates the power of well-framed instructions to unlock new possibilities. By treating models as interpreters of programs rather than mere responders to prompts, we can build more robust, adaptive, and human-like systems.</p><p>The journey from INSTRUCT to Convo reflects how far we’ve come in understanding and shaping the capabilities of language models. As tools like GPT-4o continue to improve, the potential for workflows like Convo to simplify complex tasks and foster collaboration between humans and AI is only growing. It’s an exciting time to be exploring these frontiers, and Convo is a glimpse of what lies ahead — a future where programming, communication, and creativity blend seamlessly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78ba94648eda" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Grounding LLM’s — Part 1]]></title>
            <link>https://medium.com/@ickman/grounding-llms-part-1-2e7aa7cab90e?source=rss-c580a5ea9898------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e7aa7cab90e</guid>
            <category><![CDATA[llm-hallucinations]]></category>
            <dc:creator><![CDATA[Steve Ickman]]></dc:creator>
            <pubDate>Sun, 11 Aug 2024 23:09:01 GMT</pubDate>
            <atom:updated>2024-08-11T23:09:01.518Z</atom:updated>
            <content:encoded><![CDATA[<h3>Grounding LLM’s — Part 1</h3><p>Hallucinations are currently one of the more troublesome side effects of working with Large Language Models (LLM’s.) If you’re reading this article I’m going to assume you know what I mean by hallucinations but on the off chance you don’t, a hallucination is when an LLM makes up a fact in an effort to generate a completion to a prompt. There are times when the models ability to hallucinate is desirable. If you’re asking the model to write a story about a bunny, it needs to hallucinate in order to write the story. But there are other times when these hallucinations are less desirable. When you’re asking the model to answer some critical business question you don’t want the model just making up an answer.</p><p>I would argue that every completion a model generates is essentially just a hallucination and is a generally desirable feature of the model. What we want to do, however, is to control and restrict what the model is allowed to hallucinate about. For example, we don’t want it to hallucinate about key facts when answering questions. Fortunately, we can minimize certain types of fact based hallucinations through a process called grounding. Grounding works by giving the model a corpus of facts you want it to use and an instruction that tells the model to base its answer on those facts.</p><p>In this first part, we’re going to explore the process of grounding a model more in depth and we’ll see how grounding is often a battle between what the model thinks it knows about the world and what you’re trying to tell it about the world.</p><h4>Basic Grounding</h4><p>We’re going to use a simple scenario to explore the world of grounding. Our goal will be to try and convince GPT-4o (as of 8/11/2024) that someone other than Lee Harvey Oswald shot and killed JFK. This is actually relatively straight forward to do but there’s a lot that you can learn about how GPT-4o processes information if you explore the scenario a bit.</p><p>To start with lets create a system prompt that proposes an alternate shooter (John Wayne) and see how GPT-4o answers our prompt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EIqG-SrQm0HkjIDftR3EfA.png" /></figure><p>As you can see, just throwing some facts into the system prompt isn’t enough to override the models baked in “world knowledge” around who shot JFK. To properly ground the model in this new fact we need to give the model an instruction telling it to use only the facts we provided when answering questions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jnhHReeLbEzjk4lSaLlcJw.png" /></figure><p>This basic grounding technique generally works for everything (at least everything I’ve tried which is a lot.) For example, lets look at a question asking the current stock price for google:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PLfqfTtDhoNRdBZUcwItlQ.png" /></figure><p>The default RLHF tuning of GPT-4o doesn’t let the model answer real-time questions but you can easily override that using our grounding template:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g0V_JnuwZKES4i_KMtwKdg.png" /></figure><p>I added a rule to the template which cleans up the response text. If all you care about is a basic template for minimizing hallucinations in a models responses, this template works pretty well and has fairly robust hallucination resistance out of the box:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i08rUwdZ2FgQQ8Dy1UbhPw.png" /></figure><p>The rest of the article will explore some nuances of how the model hallucinates.</p><h4><strong>Edge Cases</strong></h4><p>As good as this basic grounding template is, the model will still occasionally hallucinate. From my observations, this tends to happen when information in the grounding corpus is contradictory (two facts contradict each other) or when most of the information needed to answer a question is there but a few blanks need to be filled in. The model doesn’t seem to have a problem with guessing as to what these blanks should contain.</p><p>I’m still working to identify all of these edge cases and hopefully in part 2 of this article I’ll have a better grounding prompt that is more resistant to these edge cases. What I can do for now is show some clues around how the model deals with ambiguity.</p><h4>World Knowledge Bias</h4><p>Going back to our JFK example, I can show how the model naturally wants to fall back on its world knowledge when it sees conflicting information:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*poSH9D0zlWg6JyTpxreTWw.png" /></figure><p>Ok but maybe it’s order dependent?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H86PkjnhIqFM3u-wlRypcg.png" /></figure><p>Nope… It seems to be selecting the information that’s re-enforced by its world knowledge when given a choice.</p><h4>Recency Bias</h4><p>These models do have a recency bias though which we can see by presenting the model with conflicting facts that aren’t re-enforced by any existing world knowledge:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PAZ1rqxsXMbjbyqSQZ1i3g.png" /></figure><p>Sorry about that Justin… To verify that the model is using the last answer it sees we can change the order of the records in the prompt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QeeknxGeL14kAvCQEfBIKw.png" /></figure><p>What I find interesting about this sequence is that the model is clearly simply going off the order of the facts. You and I know that it would be impossible for Justin Bieber to have shot JFK because he wasn’t born yet (well at least the Justin Bieber in the models world knowledge wasn’t born yet.) But the model isn’t using that knowledge. Even getting the model to think about those facts isn’t enough to overcome this recency bias:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*73QDu5BjBrkzHmwM1N-2eA.png" /></figure><h4>World Knowledge trumps Recency</h4><p>The models natural preference order is world knowledge and then recency. We can see that by introducing Lee Harvey Oswald back into the list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l82gSfuGQRcy_f6vxSC9MA.png" /></figure><h4>Updating World Knowledge</h4><p>One last thing I want to show is how challenging it can be to break the models world knowledge. It can be done but requires a compelling narrative. Here’s an example of a false narrative:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSlx0kNFAgEjz4vCS8IDPQ.png" /></figure><p>The model answered the question using the information in this fake narrative but we can ask the model a follow-up question to see if it believes its answer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IhwXB18YLDgw4r5pXfLWVw.png" /></figure><p>To convince the model that its world knowledge has changed, we need to give it a more compelling narrative:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g3BUZzeB2QUZVsM4tefmfw.png" /></figure><p>But does the model believe it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OjSPaS1XueAawRAnQG0vOw.png" /></figure><h4>Conclusion</h4><p>Hopefully this article gives you a bit more insight as to how these models process information and how to go about grounding them to minimize hallucinations. In the next part I’ll try to highlight some of the edge case hallucinations I talked about and hopefully provide and updated template that better deals with edge cases.</p><p>I will say that these edge cases can be tricky to reproduce as they tend to only crop up in really large corpuses. The template I provided is actually quite robust given its simplicity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e7aa7cab90e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making OpenAI Functions Reliable]]></title>
            <link>https://medium.com/@ickman/making-openai-functions-reliable-dc206181afc9?source=rss-c580a5ea9898------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc206181afc9</guid>
            <dc:creator><![CDATA[Steve Ickman]]></dc:creator>
            <pubDate>Wed, 05 Jul 2023 17:43:25 GMT</pubDate>
            <atom:updated>2023-07-05T17:43:25.142Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve seen a lot of developers struggling with getting OpenAI’s new function calling features to work reliably so I thought I’d outline the techniques I’m using in my <a href="https://github.com/Stevenic/alphawave">AlphaWave client</a> to make functions reliable. These techniques will automatically correct for any hallucinated function names, missing required arguments, or malformed JSON returned by the model.</p><h4>Validation, Isolation, and Feedback</h4><p>AlphaWave uses 3 simple steps to automatically repair invalid responses returned by the model. A validator is used to first detect that an invalid response was returned by the model, next the conversation history is forked so that the invalid response can be repaired in isolation, then the model is given targeted feedback telling it the exact change it should make to fix its response. Upon repairing the models response, the conversation history will be un-forked and the repaired response will be used in place of the original invalid response. From the models perspective its as if it never made a mistake which is important as these models are fundamentally pattern recognizers and benefit from seeing themselves follow instructions properly.</p><p>The key takeaway should be that to get reliable responses from the model you simply need to detect that it made a mistake and then tell the model to fix its mistake. More often then not it will.</p><h4>Validation</h4><p>The first step is to run ever response from the model through a validator. For function calling I’ve implemented a <a href="https://github.com/Stevenic/alphawave/blob/main/packages/alphawave/src/FunctionResponseValidator.ts">FunctionResponseValidator</a> class that first validates that the function being called is one of the functions passed to the model. Next it uses a more general purpose <a href="https://github.com/Stevenic/alphawave/blob/main/packages/alphawave/src/JSONResponseValidator.ts">JSONResponseValidator</a> class to verify any arguments passed to the function are valid. This class uses a “fuzzy” <a href="https://github.com/Stevenic/alphawave/blob/main/packages/alphawave/src/Response.ts#L43">parseJSON() function</a> to parse the arguments and then validates those arguments against the JSON schema you sent to the model. The fuzzy parser can correct for common mistakes the model makes, like dropping a closing brace or adding an extra one.</p><h4>Isolation</h4><p>This is the step that many people will likely skip and I can’t over state how important it is. It is critical that you temporarily fork your conversation history and repair the models mistake in isolation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*qBbKnupKdWwOWZW9jazAgA.png" /></figure><p>These models are pattern recognizers. Leaving any mistake or hallucination in the main conversation history increases the likely hood of future hallucinations. By contrast, only showing them examples of good responses, where they’re following instructions, increases the likely hood that they will continue following instructions.</p><h4>Feedback</h4><p>This step is obviously key to repairing the models response. When a validator detects a mistake, they return the feedback that should be sent to the model. It’s important that this feedback is a specific instruction telling the model the repair it needs to make. The model needs to see its mistake and the instruction(s) you’ve given it to fix that mistake. You can give the model this feedback using a simple “user” message.</p><p>I ended up <a href="https://github.com/Stevenic/alphawave/blob/main/packages/alphawave/src/JSONResponseValidator.ts#L96">re-writing all of the error messages</a> for the schema validator I was using to be instructions as the passive error messages returned by the validator weren’t always working. The model would sometimes fix the error but sometimes not. Since re-writing all of the error messages I have yet to see it not repair something simple like a missing required property or an invalid enum.</p><p>AlphaWave gives the model 3 attempts to fix a bad response but it will typically repair its response on the first try and occasionally the second try. If all 3 tries are needed it’s probably not going to work and you should look at your code because there’s likely something else going on. Your schema is wrong or there’s a bug in your validator. It could also be that you need to tweak your feedback. I have yet to see a response I couldn’t get the model to fix with proper feedback.</p><p>Once you’ve repaired the models response you should then un-fork your conversation history and replace the original bad response with the repaired response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/1*wTLMXfPQxeRPpSHij-wMug.png" /></figure><p>From the models perspective it will be as if it never made a mistake and you will see that this helps reduce the likely hood of any future bad responses.</p><h3>Feedback Examples</h3><p>I’ll finish by showing a few examples of AlphaWave repairing various bad responses from <a href="https://openai.com/blog/function-calling-and-other-api-updates">OpenAI’s weather example</a>. You can tell the model you want it to make a mistake just as easily as you can tell it to repair a mistake. Don’t read too much into these examples as I’m using instructions to force the model into a corner so I can reproduce specific errors and then repair them. The weather example works pretty well in general.</p><h4><strong>Missing JSON</strong></h4><p>Here’s an example of the model calling a function without any arguments. The feedback to call the function again but with the required arguments is critical:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j9Sy98g3YGq03kQnyh9tGA.png" /></figure><h4>Missing Arguments</h4><p>In this example the function was passed arguments but the required location parameter was missing. Again the feedback to call the function again with the applied fixes is critical:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nfvkDCjqGVyVqug8gmDgoQ.png" /></figure><h4>Hallucinated Functions</h4><p>Here’s an example of the model trying to call an invalid function. Don’t read too much into it calling <strong>get_current_weather</strong> with a hallucinated location, I gave it no real choice:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tJLtXA3LuY14bIaaG3wtvg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc206181afc9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[INSTRUCT: Making LLM’s Do Anything You Want]]></title>
            <link>https://medium.com/@ickman/instruct-making-llms-do-anything-you-want-ff4259d4b91?source=rss-c580a5ea9898------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff4259d4b91</guid>
            <dc:creator><![CDATA[Steve Ickman]]></dc:creator>
            <pubDate>Fri, 14 Apr 2023 04:26:55 GMT</pubDate>
            <atom:updated>2023-05-26T14:56:02.431Z</atom:updated>
            <content:encoded><![CDATA[<p>INSTRUCT is a technique for getting LLM’s to execute small programs as part of a prompt. LLM’s are already good at following instruction so why would you want to do that? INSTRUCT helps the LLM follow instructions even better. It builds on other established prompting techniques like “lets think step by step” and “chain-of-thought” to improve the baseline models ability to reason and solve more complex problems. Using INSTRUCT you can get the model to more reliably perform complex tasks like planning, intent &amp; entity recognition, and even avoid hallucinations.</p><h3>Hello World</h3><p>Like any good programming language we should start with a “Hello World” example. Here’s a very simple INSTRUCT prompt that we’re going to pass to gpt-4:</p><pre>program:<br>- think about how to say hello world in 5 different languages.<br>- return your answer and begin your response with RESPONSE.<br><br>State each step of the program and show your work for performing that step. <br><br>1: think about how to say hello world in 5 different languages.</pre><p>The model will respond with:</p><pre>- One possible way to think about this is to recall any languages that you know or have learned, or use online resources like translators or dictionaries to find out how to say hello world in different languages.<br>- For example, you might think of the following languages and phrases:<br><br>  - English: Hello world<br>  - Spanish: Hola mundo<br>  - French: Bonjour le monde<br>  - German: Hallo Welt<br>  - Mandarin: 你好世界 (Nǐ hǎo shìjiè)<br><br>2: return your answer and begin your response with RESPONSE.<br>- To return your answer, you can write or type it out in a format that shows the language and the phrase, such as a list, a table, or a sentence.<br>- To begin your response with RESPONSE, you can simply write or type the word RESPONSE followed by a colon, a comma, or a dash, and then your answer.<br>- For example, you might return your answer as:<br><br>  - RESPONSE: Here are some ways to say hello world in 5 different languages:<br><br>    - English: Hello world<br>    - Spanish: Hola mundo<br>    - French: Bonjour le monde<br>    - German: Hallo Welt<br>    - Mandarin: 你好世界 (Nǐ hǎo shìjiè)</pre><p>Yes this is complete overkill… We could have just asked GPT-4 to do this and it would have done a great job with way less tokens. But there is a method to the madness…</p><p>Using the same basic template we can create an INSTRUCT program that asks the model to solve a fairly complex math problem:</p><pre>Valerie earns $5000 per month, 1/2 of what her brother earns. If their mother earns twice their combined salary, what&#39;s the total amount of money they all have together?<br><br>program:<br>- generate a plan for answering the question without using code.<br>- execute each step of the plan and show your work.<br>- answer the question and begin your answer with RESPONSE.<br><br>State each step of the program and show your work for performing that step. <br><br>1: generate a plan for answering the question without using code.</pre><p>The model will respond with:</p><pre>- A possible plan is:<br><br>  - Find Valerie&#39;s brother&#39;s monthly salary by multiplying Valerie&#39;s salary by 2.<br>  - Find their combined monthly salary by adding Valerie&#39;s salary and her brother&#39;s salary.<br>  - Find their mother&#39;s monthly salary by multiplying their combined salary by 2.<br>  - Find the total amount of money they all have together by adding their individual salaries.<br><br>2: execute each step of the plan and show your work.<br>- Step 1: Find Valerie&#39;s brother&#39;s monthly salary by multiplying Valerie&#39;s salary by 2.<br><br>  - Valerie&#39;s brother&#39;s monthly salary = 5000 * 2 = 10000<br><br>- Step 2: Find their combined monthly salary by adding Valerie&#39;s salary and her brother&#39;s salary.<br><br>  - Their combined monthly salary = 5000 + 10000 = 15000<br><br>- Step 3: Find their mother&#39;s monthly salary by multiplying their combined salary by 2.<br><br>  - Their mother&#39;s monthly salary = 15000 * 2 = 30000<br><br>- Step 4: Find the total amount of money they all have together by adding their individual salaries.<br><br>  - The total amount of money they all have together = 5000 + 10000 + 30000 = 45000<br><br>3: answer the question and begin your answer with RESPONSE.<br>- RESPONSE: The total amount of money they all have together is $45000 per month.</pre><p>Again, a lot of tokens but that’s the key. GPT-4 can’t generally solve complex reasoning problems like this out of the box. We’re using “chain-of-thought” principals to get the model to reason its way to a better answer. The sequence of program steps we provide is also leveraging principals from “lets think step by step” to help the model break the task apart into more manageable chunks that the model can reason over separately.</p><p>The final step of the program instructs the model to give its response but prefix it with a RESPONSE tag. This creates a marker in the output that we can search for to essentially divide the models response into 2 sections. There’s a “thinking” section which the model needs to use for reasoning purposes. And a “response” section which contains the models final answer. You don’t generally care what the model writes to its thinking section, just let it think. Everything after the last RESPONSE tag is the actual final answer and that’s the part you care about so you can split off that.</p><p>You can also pass INSTRUCT prompts to more than just GPT-4. Here’s a modified prompt that I passed to text-davinci-003:</p><pre>Valerie earns $5000 per month, 1/2 of what her brother earns. If their mother earns twice their combined salary, what&#39;s the total amount of money they all have together?<br><br>program:<br>- Find Valerie&#39;s brother&#39;s monthly salary by multiplying Valerie&#39;s salary by 2.<br>- Find their combined monthly salary by adding Valerie&#39;s salary and her brother&#39;s salary.<br>- Find their mother&#39;s monthly salary by multiplying their combined salary by 2.<br>- Find the total amount of money they all have together by adding their individual salaries.<br>- answer the question and begin your answer with RESPONSE.<br><br>State each step of the program and show your work for performing that step. <br><br>1: Find Valerie&#39;s brother&#39;s monthly salary by multiplying Valerie&#39;s salary by 2.</pre><p>The models response:</p><pre>Valerie&#39;s brother&#39;s monthly salary = $5000 x 2 = $10,000<br><br>2: Find their combined monthly salary by adding Valerie&#39;s salary and her brother&#39;s salary.<br>Their combined monthly salary = $5000 + $10,000 = $15,000<br><br>3: Find their mother&#39;s monthly salary by multiplying their combined salary by 2.<br>Their mother&#39;s monthly salary = $15,000 x 2 = $30,000<br><br>4: Find the total amount of money they all have together by adding their individual salaries.<br>Total amount of money they all have together = $5000 + $10,000 + $30,000 = $45,000<br><br>RESPONSE: The total amount of money they all have together is $45,000.</pre><p>Davinci isn’t as good at planning so I took the plan that GPT-4 generated and promoted those steps up to be the program steps I wanted the model to execute. When you do that even Davinci can solve fairly complex math &amp; logic problems.</p><p>One thing to note is that Davinci will sometimes combine steps as shown in the response above but you can still split the output by finding the last RESPONSE tag, so we’ll let it slide on that.</p><p>What about gpt-3.5-turbo ? Your mileage will very on that. GPT-3.5 is absolutely horrible at following instructions and half the time I can’t even get it to reliably spit out a RESPONSE tag. For this specific example it actually did ok but I’d call this an anomality. GPT-3.5&#39;s response to the prompt we passed GPT-4:</p><pre>1. Determine how much Valerie&#39;s brother earns per month.<br>2. Calculate the total amount earned by Valerie and her brother per month.<br>3. Determine how much their mother earns per month.<br>4. Add the amounts earned by Valerie, her brother, and their mother to find the total amount of money they all have together.<br><br>2: execute each step of the plan and show your work.<br><br>1. Valerie earns $5000 per month, which is 1/2 of what her brother earns. Let x be the amount her brother earns per month. Then we have:<br><br>x/2 = 5000<br>x = 10000<br><br>Therefore, Valerie&#39;s brother earns $10000 per month.<br><br>2. The total amount earned by Valerie and her brother per month is:<br><br>5000 + 10000 = 15000<br><br>Therefore, Valerie and her brother earn $15000 per month together.<br><br>3. Their mother earns twice their combined salary, which is:<br><br>2 * 15000 = 30000<br><br>Therefore, their mother earns $30000 per month.<br><br>4. The total amount of money they all have together is:<br><br>5000 + 10000 + 30000 = 45000<br><br>Therefore, they all have $45000 together.<br><br>RESPONSE: The total amount of money Valerie, her brother, and their mother have together is $45000.</pre><h3>Hallucination Dodging</h3><p>Lets dig into what might be the killer app for INSTRUCT, it’s ability to help the model avoid hallucinations. We’ll start with a Q&amp;A task.</p><h4>Q&amp;A Tasks</h4><p>In the prompt below we’re asking GPT-4 to answer a question that’s clearly outside the scope of the text we provided it:</p><pre>text:<br>REDMOND, Wash. — January 24, 2023 — Microsoft Corp. today announced the following results for the quarter ended December 31, 2022, as compared to the corresponding period of last fiscal year:<br><br>·        Revenue was $52.7 billion and increased 2%<br><br>·        Operating income was $20.4 billion GAAP and $21.6 billion non-GAAP, and decreased 8% and 3%, respectively<br><br>·        Net income was $16.4 billion GAAP and $17.4 billion non-GAAP, and decreased 12% and 7%, respectively<br><br>·        Diluted earnings per share was $2.20 GAAP and $2.32 non-GAAP, and decreased 11% and 6%, respectively<br><br>“The next major wave of computing is being born, as the Microsoft Cloud turns the world’s most advanced AI models into a new computing platform,” said Satya Nadella, chairman and chief executive officer of Microsoft. “We are committed to helping our customers use our platforms and tools to do more with less today and innovate for the future in the new era of AI.”<br><br><br><br>“We are focused on operational excellence as we continue to invest to drive growth. Microsoft Cloud revenue was $27.1 billion, up 22% (up 29% in constant currency) year-over-year as our commercial offerings continue to drive value for our customers,” said Amy Hood, executive vice president and chief financial officer of Microsoft.<br><br>question: ​<br>How many employees does microsoft have?</pre><p>The model response I just got:</p><pre>There are a few possible ways to approach the task of answering this question, but none of them are directly based on the text given, which does not mention the number of employees. One possible method is to use external sources, such as Microsoft&#39;s own website, press releases, or financial reports, to find the most recent or relevant data on its workforce size. Another possible method is to use some estimation or approximation techniques, such as using the revenue per employee ratio, the average salary, or the industry benchmarks, to infer a plausible range or figure for the number of employees. However, both of these methods have limitations and uncertainties, and may not reflect the current or accurate situation of the company.<br><br>Using the first method, one possible source is Microsoft&#39;s 2021 Annual Report, which states that as of June 30, 2021, the company had approximately 166,475 employees, of which 96,000 were in the United States and 70,475 were internationally. Assuming that the company did not have any significant changes in its headcount in the six months between June 30, 2021 and December 31, 2022, one possible answer to the question is:<br><br>Microsoft had approximately 166,475 employees as of June 30, 2021, the latest date for which data is available.<br><br>Using the second method, one possible source is Statista, which provides an estimate of Microsoft&#39;s revenue per employee for the fiscal year 2020, which was $789,000. Assuming that this ratio remained relatively stable in the fiscal year 2022, and using the revenue figure of $52.7 billion for the quarter ended December 31, 2022, one possible answer to the question is:<br><br>Microsoft had approximately 66,800 employees as of December 31, 2022, based on an estimated revenue per employee of $789,000.<br><br>However, both of these answers are subject to various assumptions, limitations, and uncertainties, and may not reflect the actual or current number of employees that Microsoft has. Therefore, a more cautious and qualified answer might be:<br><br>The exact number of employees that Microsoft had as of December 31, 2022 is not given in the text, and may vary depending on the source and method of estimation. However, based on some possible sources and methods, the number of employees could range from around 66,800 to around 166,475.</pre><p>This is actually one of the better response I’ve gotten from GPT-4 but I would attribute that to me asking GPT-4 this question a lot and OpenAI fine tuning GPT-4 in real time, using a bunch of humans, to better answer my question… Yes they appear to be doing that and no it will never scale.</p><p>The more important point is that the text I passed into the model doesn’t contain anything about the number of employees Microsoft has so its falling back on its world knowledge which is frozen as of June 30th 2022. For Q&amp;A tasks this is completely undesirable. We want the response to stay grounded in the facts of the document snippets we’ve passed in so lets use INSTRUCT to add some guardrails to this prompt:</p><pre>Text:<br>REDMOND, Wash. — January 24, 2023 — Microsoft Corp. today announced the following results for the quarter ended December 31, 2022, as compared to the corresponding period of last fiscal year:<br><br>·        Revenue was $52.7 billion and increased 2%<br><br>·        Operating income was $20.4 billion GAAP and $21.6 billion non-GAAP, and decreased 8% and 3%, respectively<br><br>·        Net income was $16.4 billion GAAP and $17.4 billion non-GAAP, and decreased 12% and 7%, respectively<br><br>·        Diluted earnings per share was $2.20 GAAP and $2.32 non-GAAP, and decreased 11% and 6%, respectively<br><br>“The next major wave of computing is being born, as the Microsoft Cloud turns the world’s most advanced AI models into a new computing platform,” said Satya Nadella, chairman and chief executive officer of Microsoft. “We are committed to helping our customers use our platforms and tools to do more with less today and innovate for the future in the new era of AI.”<br><br><br><br>“We are focused on operational excellence as we continue to invest to drive growth. Microsoft Cloud revenue was $27.1 billion, up 22% (up 29% in constant currency) year-over-year as our commercial offerings continue to drive value for our customers,” said Amy Hood, executive vice president and chief financial officer of Microsoft.<br><br>question: ​<br>How many employees does microsoft have?<br><br>program: ​<br>- what facts do you need to look for in the text to answer the question?​<br>- does the text contain all the facts needed to answer the question? ​<br>- think about how you might answer the question given what you know. If you don&#39;t have enough facts answer I&#39;m not sure.​<br>- answer the question and begin your answer with RESPONSE.​<br><br>State each step of the program and show your work for performing that step. <br><br>1: what facts do you need to look for in the text to answer the question?</pre><p>Now the model responds with:</p><pre>- To answer the question, we need to look for a fact that tells us how many employees Microsoft has, or a fact that allows us to estimate or calculate that number based on other information.​<br><br>2: does the text contain all the facts needed to answer the question? ​<br>- The text does not contain any direct or explicit fact that tells us how many employees Microsoft has. It also does not provide any clear or reliable way to estimate or calculate that number based on other information, such as revenue per employee, headcount growth rate, or regional breakdown. Therefore, the text does not contain all the facts needed to answer the question.​<br><br>3: think about how you might answer the question given what you know. If you don&#39;t have enough facts answer I&#39;m not sure.​<br>- Given what we know, we cannot answer the question with any certainty or accuracy. We might try to guess based on some external sources or assumptions, but that would not be a valid or reliable answer. Therefore, the best answer we can give is I&#39;m not sure.​<br><br>4: answer the question and begin your answer with RESPONSE.​<br>- RESPONSE I&#39;m not sure how many employees Microsoft has. The text does not provide any direct or explicit fact or any clear or reliable way to estimate or calculate that number.</pre><p>The models response is much more grounded in the fact that the text doesn’t contain enough information to answer the users question. Hallucinations are avoided because we’re first asking the model to analyze the query and identify what facts would be needed from the source text to answer the query. Next we ask it whether the text contains those facts (in this case no.) Next we tell the model to think about how it might answer the question given everything it knows. It doesn’t always need this step but it gives the model a chance to think about any conclusions it wants to draw from the previous steps. Finally we can ask it to answer the question and in about 95% of cases the final answer will be hallucination free.</p><p>I say 95% because there are still chances for what I would call micro hallucinations. For example, you can ask the model “what was the previous quarters revenue” and it will do an ok job at reverse projecting this quarters 2% increase onto last quarter, but you can also ask it “what was the previous years revenue” and it will try to use that same 2% growth rate for every quarter. I’d rather it not do that personally but it’s still GPT so…</p><h4>Planning Tasks</h4><p>We can also apply similar techniques to dodging hallucination in planning tasks. I have a light bot sample I use a lot. You can ask light bot to turn the lights on or off and it has a pause action it knows about but that’s it. You can ask the bot to “turn the light off, pause 2 seconds, and then turn the lights back in” and it will write a little sequence of actions that does just that. The problem is if you tell it to “dim the lights by 50%” it will hallucinate functions and/or parameters it doesn’t have. So lets see if we can use INSTRUCT to get GPT-4 to avoid such hallucinations. Here’s out prompt:</p><pre>The following is a conversation with an AI assistant.<br>The assistant can turn a light on or off.<br>The assistant must return the following JSON structure:<br><br>{&quot;type&quot;:&quot;plan&quot;,&quot;commands&quot;:[{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;&lt;name&gt;&quot;,&quot;entities&quot;:{&quot;&lt;name&gt;&quot;:&lt;value&gt;}},{&quot;type&quot;:&quot;SAY&quot;,&quot;response&quot;:&quot;&lt;response&gt;&quot;}]}<br><br>The following actions are supported:<br><br>- LightsOn<br>- LightsOff<br>- Pause time=&lt;duration in ms&gt;<br><br>The lights are currently on.<br><br>query:<br>dim the lights by 50%<br><br>program:<br>- generate a plan for answering the query.<br>- compare the planning actions used with the list of supported actions. Does the generated plan use any additional actions or parameters?<br>- update the plan to only use available planning actions and parameters if needed.<br>- return the plan as JSON. Return the tag RESPONSE just before the plan JSON.<br><br>State each line of the program and show your work for performing that line.<br><br>1: generate a plan for answering the query.</pre><p>The models response is:</p><pre>- A possible plan for answering the query is:<br><br>  - DO LightsOn entities={&quot;brightness&quot;:0.5}<br>  - SAY &quot;OK, I have dimmed the lights by 50%.&quot;<br><br>2: compare the planning actions used with the list of supported actions. Does the generated plan use any additional actions or parameters?<br>- The generated plan uses an additional parameter &quot;brightness&quot; for the LightsOn action, which is not supported by the list of supported actions.<br><br>3: update the plan to only use available planning actions and parameters if needed.<br>- A possible way to update the plan is to use the Pause action to simulate the dimming effect, and then use the LightsOff action to turn off the lights completely. For example:<br><br>  - DO LightsOn entities={}<br>  - Pause time=1000<br>  - DO LightsOff entities={}<br>  - SAY &quot;OK, I have dimmed the lights by 50%.&quot;<br><br>4: return the plan as JSON. Return the tag &lt;response&gt; just before the plan JSON.<br>- The JSON representation of the plan is:<br><br>  {&quot;type&quot;:&quot;plan&quot;,&quot;commands&quot;:[{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;LightsOn&quot;,&quot;entities&quot;:{}},{&quot;type&quot;:&quot;Pause&quot;,&quot;time&quot;:1000},{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;LightsOff&quot;,&quot;entities&quot;:{}},{&quot;type&quot;:&quot;SAY&quot;,&quot;response&quot;:&quot;OK, I have dimmed the lights by 50%.&quot;}]}<br><br>- The tag RESPONSE just before the plan JSON is:<br><br>  RESPONSE{&quot;type&quot;:&quot;plan&quot;,&quot;commands&quot;:[{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;LightsOn&quot;,&quot;entities&quot;:{}},{&quot;type&quot;:&quot;Pause&quot;,&quot;time&quot;:1000},{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;LightsOff&quot;,&quot;entities&quot;:{}},{&quot;type&quot;:&quot;SAY&quot;,&quot;response&quot;:&quot;OK, I have dimmed the lights by 50%.&quot;}]}</pre><p>We can see the model hallucinate an extra “brightness” parameter to the “LightsOn” action which is key. I’ve found that the model needs to see itself hallucinate and then its easier to walk it back from that hallucination before it responds.</p><p>You can see in the models thinking that it REALLY wants to dim the lights by 50%. I’ve tied its hands by not letting it use anything but the available functions or parameters so it wants to get creative and solve the problem by tuning the lights off &amp; on in succession. Bravo to the model for its cleverness but we don’t even want that so how do we fix that?</p><p>We need to give the model an out it can take. It needs an escape hatch of sorts. We can update our prompt to include a new “None” action and we can add a step that says “do you have the actions or parameters needed to answer the query? If not use the None action.”</p><pre>The following is a conversation with an AI assistant.<br>The assistant can turn a light on or off.<br>The assistant must return the following JSON structure:<br><br>{&quot;type&quot;:&quot;plan&quot;,&quot;commands&quot;:[{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;&lt;name&gt;&quot;,&quot;entities&quot;:{&quot;&lt;name&gt;&quot;:&lt;value&gt;}},{&quot;type&quot;:&quot;SAY&quot;,&quot;response&quot;:&quot;&lt;response&gt;&quot;}]}<br><br>The following actions are supported:<br><br>- LightsOn<br>- LightsOff<br>- Pause time=&lt;duration in ms&gt;<br>- None<br><br>The lights are currently on.<br><br>query:<br>dim the lights by 50%<br><br>program:<br>- generate a plan for answering the query.<br>- compare the planning actions used with the list of supported actions. Does the generated plan use any additional actions or parameters?<br>- do you have the actions or parameters needed to answer the query? If not use the None action.<br>- update the plan to only use available planning actions and parameters if needed.<br>- return the plan as JSON. Return the tag RESPONSE just before the plan JSON.<br><br>State each line of the program and show your work for performing that line.<br><br>1: generate a plan for answering the query.</pre><p>The models response is now:</p><pre> a possible plan for dimming the lights by 50% is:<br><br>  - DO LightsOn entities={&quot;brightness&quot;:0.5}<br>  - SAY &quot;OK, I have dimmed the lights by 50%.&quot;<br><br>2: compare the planning actions used with the list of supported actions. Does the generated plan use any additional actions or parameters?<br>- the plan uses an additional parameter &quot;brightness&quot; for the LightsOn action, which is not supported by the list of actions.<br>- the plan does not use any additional actions.<br><br>3: do you have the actions or parameters needed to answer the query? If not use the None action.<br>- we do not have the parameter &quot;brightness&quot; needed to answer the query, so we need to use the None action.<br><br>4: update the plan to only use available planning actions and parameters if needed.<br>- a possible updated plan is:<br><br>  - DO None<br>  - SAY &quot;Sorry, I cannot dim the lights by 50%. I can only turn them on or off.&quot;<br><br>5: return the plan as JSON. Return the tag RESPONSE just before the plan JSON.<br>- the JSON plan is:<br><br>  {&quot;type&quot;:&quot;plan&quot;,&quot;commands&quot;:[{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;None&quot;,&quot;entities&quot;:{}},{&quot;type&quot;:&quot;SAY&quot;,&quot;response&quot;:&quot;Sorry, I cannot dim the lights by 50%. I can only turn them on or off.&quot;}]}<br><br>- the tag RESPONSE is:<br><br>  RESPONSE{&quot;type&quot;:&quot;plan&quot;,&quot;commands&quot;:[{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;None&quot;,&quot;entities&quot;:{}},{&quot;type&quot;:&quot;SAY&quot;,&quot;response&quot;:&quot;Sorry, I cannot dim the lights by 50%. I can only turn them on or off.&quot;}]}</pre><p>And boom crisis averted… The model just needs a “None” action that it can use as an escape for anytime it gets confused. It also needs the added program step that asks it to decide whether it should use that escape hatch.</p><p><strong>The vast majority of hallucinations come from the model not seeing the information that it needs to properly answer the current question or perform the current task. </strong>This applies to everything . If you ask the model to solve a math problem and it can’t see its work it will guess at values and get the answer wrong. If you ask it a Q&amp;A question and it doesn’t see the answer in the provided context it will guess at the answer. If you ask it to perform some task and it doesn’t know how to do that task it will guess at what it needs to do. You need to either spell everything out for the model in advance (best result) or get it to spell everything out (ok result) before it does its work.</p><h4>Topic Dodging</h4><p>So this planning prompt still isn’t perfect. What if a users asks the bot an off topic question like “who is santa claus?” the prompt in its current form would respond with:</p><pre>- a possible plan is:<br><br>  - DO: Pause time=1000<br>  - SAY: Santa Claus is a mythical figure who brings gifts to children on Christmas Eve.<br>  - DO: None<br><br>2: compare the planning actions used with the list of supported actions. Does the generated plan use any additional actions or parameters?<br>- the planning actions used are Pause, Say, and None, which are all supported by the assistant.<br>- the parameter used for Pause is time, which is also supported by the assistant.<br><br>3: do you have the actions or parameters needed to answer the query? If not use the None action.<br>- yes, we have the actions and parameters needed to answer the query.<br><br>4: update the plan to only use available planning actions and parameters if needed.<br>- no update is needed, as the plan already uses available planning actions and parameters.<br><br>5: return the plan as JSON. Return the tag RESPONSE just before the plan JSON.<br>- the plan as JSON is:<br><br>  {&quot;type&quot;:&quot;plan&quot;,&quot;commands&quot;:[{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;Pause&quot;,&quot;entities&quot;:{&quot;time&quot;:1000}},{&quot;type&quot;:&quot;SAY&quot;,&quot;response&quot;:&quot;Santa Claus is a mythical figure who brings gifts to children on Christmas Eve.&quot;},{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;None&quot;,&quot;entities&quot;:{}}]}<br><br>- the tag RESPONSE is:<br><br>  RESPONSE{&quot;type&quot;:&quot;plan&quot;,&quot;commands&quot;:[{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;Pause&quot;,&quot;entities&quot;:{&quot;time&quot;:1000}},{&quot;type&quot;:&quot;SAY&quot;,&quot;response&quot;:&quot;Santa Claus is a mythical figure who brings gifts to children on Christmas Eve.&quot;},{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;None&quot;,&quot;entities&quot;:{}}]}</pre><p>That’s a completely valid plan but we’d rather redirect to our new None action. We can update the prompt to do 2 things. First we can switch to using line numbers for all the program steps and second we can add an initial instruction of “is the query related to an action supported by the AI? If not use the None action and jump to line 6” that conditionally jumps to another line of the program:</p><pre>The following is a conversation with an AI assistant.<br>The assistant can turn a light on or off.<br>The assistant must return the following JSON structure:<br><br>{&quot;type&quot;:&quot;plan&quot;,&quot;commands&quot;:[{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;&lt;name&gt;&quot;,&quot;entities&quot;:{&quot;&lt;name&gt;&quot;:&lt;value&gt;}},{&quot;type&quot;:&quot;SAY&quot;,&quot;response&quot;:&quot;&lt;response&gt;&quot;}]}<br><br>The following actions are supported:<br><br>- LightsOn<br>- LightsOff<br>- Pause time=&lt;duration in ms&gt;<br>- None<br><br>The lights are currently on.<br><br>query:<br>who is santa claus?<br><br>program:<br>1: is the query related to an action supported by the AI? If not use the None action and jump to line 6<br>2: generate a plan for answering the query.<br>3: compare the planning actions used with the list of supported actions. Does the generated plan use any additional actions or parameters?<br>4: do you have the actions or parameters needed to answer the query? If not use the None action.<br>5: update the plan to only use available planning actions and parameters if needed.<br>6: return the plan as JSON. Return the tag RESPONSE just before the plan JSON.<br><br>State each line of the program and show your work for performing that line.<br><br>1: is the query related to an action supported by the AI? If not use the None action and jump to line 6</pre><p>The models response to this is:</p><pre>- The query is not related to an action supported by the AI, so we use the None action and jump to line 6.<br><br>2: generate a plan for answering the query. (skipped because of line 1)<br><br>3: compare the planning actions used with the list of supported actions. Does the generated plan use any additional actions or parameters? (skipped because of line 1)<br><br>4: do you have the actions or parameters needed to answer the query? If not use the None action. (skipped because of line 1)<br><br>5: update the plan to only use available planning actions and parameters if needed. (skipped because of line 1)<br><br>6: return the plan as JSON. Return the tag RESPONSE just before the plan JSON.<br>- The plan is [{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;None&quot;,&quot;entities&quot;:{}},{&quot;type&quot;:&quot;SAY&quot;,&quot;response&quot;:&quot;I&#39;m sorry, I don&#39;t know who santa claus is.&quot;}]<br>- The tag RESPONSE is I&#39;m sorry, I don&#39;t know who santa claus is.<br>- The final output is:<br><br>RESPONSE<br>{&quot;type&quot;:&quot;plan&quot;,&quot;commands&quot;:[{&quot;type&quot;:&quot;DO&quot;,&quot;action&quot;:&quot;None&quot;,&quot;entities&quot;:{}},{&quot;type&quot;:&quot;SAY&quot;,&quot;response&quot;:&quot;I&#39;m sorry, I don&#39;t know who santa claus is.&quot;}]}</pre><p>We’re basically asking the model to evaluate whether the query is something that’s supported. If not we force the model to short circuit its thinking and jump to the final step. The model will sometimes just skip to running the jumped to step and other times it will repeat the steps but say they’re skipped like above. In either case the models thinking is truncated and the desired None action is redirected too.</p><p>The model will sometimes want to explain itself after generating a “None” action but in your code you can either chose to ignore this and stop processing actions once you see the “None” action or just go ahead and continue processing. Your call.</p><h3>Programming With INSTRUCT</h3><p>This is a true programming language of sorts. You just need to be part programmer and part psychologist to write well formed INSTRUCT programs. Lets work through some basic example programs.</p><h4><strong>Variables and Loops</strong></h4><p>We can do straight forward tasks like creating variables and asking the model to loop over a step by simply asking it to do that:</p><pre>program:<br>1: create a variable called count and initialize it to a value of 0.<br>2: increment count by 1<br>3: repeat step two 49 times.<br>4: respond with the final value of count and being your response with RESPONSE.<br><br>State each step of the program and show your work for performing that step. <br><br>1: create a variable called count and initialize it to a value of 0.</pre><p>GPT-4&#39;s response is:</p><pre>count = 0<br><br>2: increment count by 1<br>count = count + 1<br><br>3: repeat step two 49 times.<br>count = count + 1 # second increment<br>count = count + 1 # third increment<br>...<br>count = count + 1 # 49th increment<br>count = count + 1 # 50th increment<br><br>4: respond with the final value of count and being your response with RESPONSE.<br>RESPONSE: The final value of count is 50.</pre><h4>Text Processing Tasks</h4><p>We can ask the model to perform tasks like word counting by presenting it with the text and breaking down how we’d like the model to count the words. This is a simple task that even GPT-4 struggles with out of the box. We can easily use an INSTRUCT program to solve simple problems like this:</p><pre>Text:<br>uisque a consectetur sem, sit amet pharetra nibh. Aliquam non mi nec orci laoreet vulputate sed nec felis. Maecenas consequat libero ut auctor condimentum. Sed auctor dui.<br><br>Question:<br>How many words are in the text above?<br><br>program:​<br>- generate a list of all the words in the text block and the index. Don&#39;t skip any words but ignore punctuation. Don&#39;t write code.<br>- the word count is the last index + 1.<br>- answer the question and begin your answer with RESPONSE.​<br><br>State each step of the program and show your work for performing that step. <br><br>1: generate a list of all the words in the text block and the index. Don&#39;t skip any words but ignore punctuation. Don&#39;t write code.</pre><p>The model responds with:</p><pre>- To generate a list of all the words in the text block and the index, we can split the text by whitespace characters (such as spaces, tabs, or newlines) and assign each word a numerical index starting from zero. For example, the first word &quot;uisque&quot; would have index 0, the second word &quot;a&quot; would have index 1, and so on. We can ignore punctuation by either removing it from the text before splitting, or by excluding it from the words after splitting. For example, we can remove the period from &quot;dui.&quot; or exclude it from the word &quot;dui&quot;. Here is one possible way to generate the list of words and indices:<br><br>uisque 0<br>a 1<br>consectetur 2<br>sem, 3<br>sit 4<br>amet 5<br>pharetra 6<br>nibh. 7<br>Aliquam 8<br>non 9<br>mi 10<br>nec 11<br>orci 12<br>laoreet 13<br>vulputate 14<br>sed 15<br>nec 16<br>felis. 17<br>Maecenas 18<br>consequat 19<br>libero 20<br>ut 21<br>auctor 22<br>condimentum. 23<br>Sed 24<br>auctor 25<br>dui. 26<br><br>2: the word count is the last index + 1.<br>- To find the word count, we can look at the last index of the list and add one to it. This is because the indices start from zero, so the last index is one less than the number of words. For example, the last index in the list above is 26, so the word count is 26 + 1 = 27.<br><br>3: answer the question and begin your answer with RESPONSE.<br>- RESPONSE: The text above has 27 words.</pre><p>Doesn’t matter how many words are in the text block it will properly count them.</p><h4>Jumping Backwards</h4><p>We’ve already seen an example of jumping forward in a program so what about jumping backwards? Here’s an example program that conditionally jumps backwards to create a true loop (note this only works with GPT-4.)</p><pre>Text:<br>Nevertheless, in this mansion of gloom I now proposed to myself a sojourn of some weeks. Its proprietor, Roderick Usher, had been one of my boon companions in boyhood; but many years had elapsed since our last meeting. A letter, however, had lately reached me in a distant part of the country — a letter from him — which, in its wildly importunate nature, had admitted of no other than a personal reply. The MS. gave evidence of nervous agitation. The writer spoke of acute bodily illness — of a mental disorder which oppressed him — and of an earnest desire to see me, as his best, and indeed his only personal friend, with a view of attempting, by the cheerfulness of my society, some alleviation of his malady. It was the manner in which all this, and much more, was said — it was the apparent heart that went with his request — which allowed me no room for hesitation; and I accordingly obeyed forthwith what I still considered a very singular summons.<br><br>Editing Steps:<br>- Check for clarity and coherence.<br>- Check for flow and readability.<br>- Check for voice and tone. <br><br>program:<br>1: create a variable to track the current editing step.<br>2: list the issues identified by the current editing step.<br>3: increment the step variable and if there are more edititing steps left go to line 2.<br>4: apply the generated suggestions and return the updated text. Begin your reponse with RESPONSE.<br><br>State each line of the program and show your work for performing that line.<br><br>1: create a variable to track the current editing step.</pre><p>The model responds with:</p><pre>- Let step = 1<br><br>2: list the issues identified by the current editing step.<br>- The current editing step is to check for clarity and coherence.<br>- Some possible issues are:<br><br>  - The phrase &quot;a sojourn of some weeks&quot; is vague and could be more specific.<br>  - The phrase &quot;a letter from him&quot; is redundant and could be replaced by a pronoun.<br>  - The phrase &quot;in its wildly importunate nature&quot; is unclear and could be simplified.<br>  - The abbreviation &quot;MS.&quot; is obscure and could be spelled out.<br>  - The phrase &quot;some alleviation of his malady&quot; is weak and could be stronger.<br>  - The phrase &quot;it was the manner in which all this, and much more, was said&quot; is wordy and could be condensed.<br>  - The phrase &quot;which allowed me no room for hesitation&quot; is passive and could be active.<br><br>3: increment the step variable and if there are more editing steps left go to line 2.<br>- Let step = 2<br><br>2: list the issues identified by the current editing step.<br>- The current editing step is to check for flow and readability.<br>- Some possible issues are:<br><br>  - The sentence &quot;Its proprietor, Roderick Usher, had been one of my boon companions in boyhood; but many years had elapsed since our last meeting.&quot; is long and could be broken into two sentences.<br>  - The sentence &quot;The writer spoke of acute bodily illness — of a mental disorder which oppressed him — and of an earnest desire to see me, as his best, and indeed his only personal friend, with a view of attempting, by the cheerfulness of my society, some alleviation of his malady.&quot; is also long and could be divided into two sentences.<br>  - The use of dashes and commas in the same sentence creates confusion and could be replaced by semicolons or periods.<br>  - The use of &quot;which&quot; twice in the same sentence creates ambiguity and could be replaced by &quot;that&quot; or rephrased.<br>  - The use of &quot;it was&quot; twice in the last sentence creates repetition and could be varied.<br><br>3: increment the step variable and if there are more editing steps left go to line 2.<br>- Let step = 3<br><br>2: list the issues identified by the current editing step.<br>- The current editing step is to check for voice and tone.<br>- Some possible issues are:<br><br>  - The voice of the narrator is formal and distant, which may not match the intended mood of the story.<br>  - The tone of the text is gloomy and somber, which may be appropriate for the setting, but could be contrasted with some hints of curiosity or suspense.<br>  - The word choice and syntax are complex and archaic, which may reflect the time period of the story, but could also alienate modern readers.<br><br>4: apply the generated suggestions and return the updated text. Begin your response with RESPONSE.<br><br>RESPONSE:<br><br>I decided to stay for several weeks in this mansion of gloom. Its proprietor was Roderick Usher, an old friend from my childhood. But I had not seen him for many years. He had sent me a letter, which begged me to come and visit him. He wrote that he suffered from a severe physical illness and a mental disorder that tormented him. He also expressed an urgent wish to see me, his best and only friend, hoping that my cheerful company might ease his pain. His words were full of emotion and sincerity, and I felt compelled to answer his strange request.</pre><h4>Calling Functions</h4><p>You can actually break repeated blocks of logic out to functions:</p><pre>Text:<br>Nevertheless, in this mansion of gloom I now proposed to myself a sojourn of some weeks. Its proprietor, Roderick Usher, had been one of my boon companions in boyhood; but many years had elapsed since our last meeting. A letter, however, had lately reached me in a distant part of the country — a letter from him — which, in its wildly importunate nature, had admitted of no other than a personal reply. The MS. gave evidence of nervous agitation. The writer spoke of acute bodily illness — of a mental disorder which oppressed him — and of an earnest desire to see me, as his best, and indeed his only personal friend, with a view of attempting, by the cheerfulness of my society, some alleviation of his malady. It was the manner in which all this, and much more, was said — it was the apparent heart that went with his request — which allowed me no room for hesitation; and I accordingly obeyed forthwith what I still considered a very singular summons.<br><br>editText(instruction):<br>- list the issues in the text using the instruction.<br><br>program:<br>1: call editText(&quot;Check for clarity and coherence&quot;).<br>2: call editText(&quot;Check for flow and readability&quot;).<br>3: call editText(&quot;Check for voice and tone&quot;).<br>4: apply any suggested changes and return the updated text. Begin your reponse with RESPONSE.<br><br>State each line of the program and show your work for performing that line.<br><br>1: call editText(&quot;Check for clarity and coherence&quot;).</pre><p>GPT-4 responds with:</p><pre>- This instruction asks us to examine the text for any ambiguities, inconsistencies, or gaps in logic that might confuse or mislead the reader.<br>- One possible issue is the use of the term &quot;MS.&quot; to refer to the letter from Usher. This abbreviation might be unfamiliar or unclear to some readers, and it is not explained in the text. A possible revision is to replace it with &quot;letter&quot; or &quot;message&quot;.<br>- Another possible issue is the lack of transition between the first and second sentences. The reader might wonder how the narrator knows that Usher is the proprietor of the mansion, or why he decided to visit him after many years of separation. A possible revision is to add a connecting phrase that explains the narrator&#39;s motivation or background.<br>- A third possible issue is the vague reference to &quot;much more&quot; that Usher said in his letter. This leaves the reader wondering what else Usher communicated, and whether it is relevant or important to the story. A possible revision is to either specify or omit some of the additional information that Usher shared.<br><br>2: call editText(&quot;Check for flow and readability&quot;).<br>- This instruction asks us to examine the text for any problems with sentence structure, word choice, punctuation, or grammar that might hinder the reader&#39;s comprehension or enjoyment of the text.<br>- One possible issue is the use of the passive voice in the first sentence: &quot;I now proposed to myself a sojourn of some weeks.&quot; This makes the sentence sound weak and indirect, and it does not convey the narrator&#39;s agency or intention. A possible revision is to use the active voice: &quot;I decided to stay for some weeks.&quot;<br>- Another possible issue is the use of the word &quot;boon&quot; to describe the narrator&#39;s friendship with Usher. This word is archaic and uncommon, and it might not convey the intended meaning or tone. A possible revision is to use a more modern and familiar word: &quot;close&quot; or &quot;dear&quot;.<br>- A third possible issue is the use of the dash in the last sentence: &quot;It was the manner in which all this, and much more, was said — it was the apparent heart that went with his request — which allowed me no room for hesitation.&quot; This punctuation creates a long and complex sentence that might be hard to follow or parse. A possible revision is to break up the sentence into two or more shorter sentences, using commas or semicolons instead of dashes.<br><br>3: call editText(&quot;Check for voice and tone&quot;).<br>- This instruction asks us to examine the text for any aspects of the narrator&#39;s perspective, attitude, or emotion that might affect the reader&#39;s impression or response to the text.<br>- One possible issue is the lack of emotion or personality in the narrator&#39;s voice. The text is mostly factual and descriptive, and it does not reveal much about the narrator&#39;s feelings or thoughts about Usher, his letter, or his situation. This might make the narrator seem distant or detached, and it might reduce the reader&#39;s interest or empathy. A possible revision is to add some expressions of emotion or opinion that show the narrator&#39;s involvement or concern.<br>- Another possible issue is the inconsistency in the tone of the text. The text begins with a dark and gloomy description of the mansion, which creates a sense of horror or suspense. However, the text then shifts to a more neutral and rational explanation of the narrator&#39;s visit, which reduces the tension or mood. A possible revision is to maintain a consistent tone throughout the text, either by emphasizing the horror or by moderating the gloom.<br><br>4: apply any suggested changes and return the updated text. Begin your response with RESPONSE.<br><br>RESPONSE:<br><br>I decided to stay for some weeks in this mansion of gloom. It belonged to Roderick Usher, a close friend of mine in boyhood, whom I had not seen for many years. He had sent me a letter from this distant part of the country, a letter that begged me to come and see him. He wrote of his acute bodily illness, his mental disorder that oppressed him, and his earnest desire for my company, as his best and only friend. He hoped that my cheerful presence might ease his suffering. His letter was full of nervous agitation and heartfelt appeal. I could not refuse such a request, and I set out to answer his singular summons.<br><br>The revised text is clearer, more readable, and more consistent in voice and tone. It also shows some emotion and personality in the narrator&#39;s voice.</pre><p>Functions can in fact work with other models. This prompt:</p><pre>increment(variable, amount):<br>- &lt;variable&gt; = &lt;variable&gt; + &lt;amount&gt;<br><br>program:<br>- define a variable called foo and initialize it to 0.<br>- call increment(foo, 1).<br>- call increment(foo, 10).<br>- call increment(foo, 100).<br>- return the final value of foo. Begin your reponse with RESPONSE.<br><br>State each line of the program and show your work for performing that line.<br><br>1: define a variable called foo and initialize it to 0.</pre><p>Results in this response from text-davinci-003:</p><pre>foo = 0<br><br>2: call increment(foo, 1).<br>foo = foo + 1<br><br>3: call increment(foo, 10).<br>foo = foo + 10<br><br>4: call increment(foo, 100).<br>foo = foo + 100<br><br>5: return the final value of foo. Begin your reponse with RESPONSE.<br>RESPONSE: 111</pre><p>And this response from gpt-3.5-turbo :</p><pre>- foo = 0<br><br>2: call increment(foo, 1).<br><br>- increment(foo, 1) will execute the function increment with arguments foo and 1.<br>- The function will add 1 to the value of foo and assign the result back to foo.<br>- Therefore, foo will now be 1.<br><br>3: call increment(foo, 10).<br><br>- increment(foo, 10) will execute the function increment with arguments foo and 10.<br>- The function will add 10 to the value of foo and assign the result back to foo.<br>- Therefore, foo will now be 11.<br><br>4: call increment(foo, 100).<br><br>- increment(foo, 100) will execute the function increment with arguments foo and 100.<br>- The function will add 100 to the value of foo and assign the result back to foo.<br>- Therefore, foo will now be 111.<br><br>5: return the final value of foo. Begin your response with RESPONSE.<br><br>- RESPONSE: The final value of foo is 111.</pre><p>And this response from gpt-4:</p><pre>- This line creates a new variable named foo and assigns it the value 0.<br>- foo = 0<br><br>2: call increment(foo, 1).<br>- This line invokes the increment function with the arguments foo and 1.<br>- The function body executes as follows:<br>  - foo = foo + 1<br>  - This updates the value of foo by adding 1 to it.<br>  - foo = 0 + 1<br>  - foo = 1<br><br>3: call increment(foo, 10).<br>- This line invokes the increment function with the arguments foo and 10.<br>- The function body executes as follows:<br>  - foo = foo + 10<br>  - This updates the value of foo by adding 10 to it.<br>  - foo = 1 + 10<br>  - foo = 11<br><br>4: call increment(foo, 100).<br>- This line invokes the increment function with the arguments foo and 100.<br>- The function body executes as follows:<br>  - foo = foo + 100<br>  - This updates the value of foo by adding 100 to it.<br>  - foo = 11 + 100<br>  - foo = 111<br><br>5: return the final value of foo. Begin your response with RESPONSE.<br>- This line returns the final value of foo, which is 111, as the output of the program.<br>- RESPONSE: 111</pre><p>I think from this example you can see that more reasoning isn’t always better. text-davinci-003 accurately performed the task in way less tokens and half the cost of gpt-4. gpt-3.5-turbo also solved the problem and given that it’s 1/10th the cost of the other models I’d probably give it the win here. Another anomaly though…</p><p><strong>UPDATE:</strong> I’ve switched from using programs:to steps:and for my instruction I give State each step and show your work for performing that step. The issue with using the word “program” is that the model seems more likely to want to write code when reasoning through more complex tasks and that’s when it gets in trouble. It’s great at writing code but it tries to mock execute the code and if it can’t clearly see the value assigned to a variable it will guess at its value and its almost always wrong. You can further guard against it using code by modifying your instruction to say State each step, show your work for performing that step, and don&#39;t write code.</p><p>Another tip for working with gpt-3.5-turbo is that turbo will sometimes perform the first step and then stop. You can fix this by explicitly telling it to do each step of the INSTRUCT sequence. So lets you say you have a 3 step INSTRUCT sequence, your instruction to turbo would be Do step 1, 2, 3 and show your work for performing each step. I haven’t seen it stop when doing this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff4259d4b91" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>