Learning Library

← Back to Library

Advanced Prompting: Self‑Correction Techniques

Key Points

  • Advanced prompting relies on building self‑correction systems that push models to critique and refine their own outputs rather than just generate a single pass.
  • “Chain of verification” embeds a verification loop in the same prompt, forcing the model to identify potential gaps, cite supporting text, and revise its conclusions.
  • “Adversarial prompting” takes this further by obligating the model to actively hunt for weaknesses or vulnerabilities, ensuring thoroughness in high‑stakes tasks like security reviews.
  • Strategic edge‑case learning is used when distinguishing boundary conditions is difficult, guiding the model to explore and understand rare or extreme scenarios for more robust responses.

Full Transcript

# Advanced Prompting: Self‑Correction Techniques **Source:** [https://www.youtube.com/watch?v=GTEz5WWbfiw](https://www.youtube.com/watch?v=GTEz5WWbfiw) **Duration:** 00:13:21 ## Summary - Advanced prompting relies on building self‑correction systems that push models to critique and refine their own outputs rather than just generate a single pass. - “Chain of verification” embeds a verification loop in the same prompt, forcing the model to identify potential gaps, cite supporting text, and revise its conclusions. - “Adversarial prompting” takes this further by obligating the model to actively hunt for weaknesses or vulnerabilities, ensuring thoroughness in high‑stakes tasks like security reviews. - Strategic edge‑case learning is used when distinguishing boundary conditions is difficult, guiding the model to explore and understand rare or extreme scenarios for more robust responses. ## Sections - [00:00:00](https://www.youtube.com/watch?v=GTEz5WWbfiw&t=0s) **Self‑Correction in Advanced Prompting** - The speaker outlines how expert prompt engineers overcome single‑pass generation limits by embedding verification loops—such as chain‑of‑verification—to force the model to critique and refine its own outputs. - [00:04:06](https://www.youtube.com/watch?v=GTEz5WWbfiw&t=246s) **Meta Prompting and Self‑Correction** - The speaker explains how advanced prompting methods—including reverse prompting, edge‑case learning, adversarial prompting, and chain‑of‑verification—help models distinguish appearance from reality, self‑correct, and generate optimal prompts for tasks such as analyzing quarterly earnings reports. - [00:07:30](https://www.youtube.com/watch?v=GTEz5WWbfiw&t=450s) **Over-Instruction and Zero-Shot CoT** - The passage explains how giving ultra‑detailed prompts and using blank‑step templates forces language models to expose their reasoning, enabling thorough problem analysis and debugging. - [00:12:02](https://www.youtube.com/watch?v=GTEz5WWbfiw&t=722s) **Simulating Temperature via Roleplay** - The speaker explains how to emulate low‑ and high‑temperature model behavior in chat by prompting the model to adopt contrasting personas—a cautious analyst and a confident expert—and then synthesizing their outputs. ## Full Transcript
0:00Teaching AI is really hard. Teaching 0:02advanced prompting is even harder. This 0:04video will make it easier. My goal is to 0:06equip you with an understanding of the 0:09mental models, the principles that 0:10advanced prompters use. We're going to 0:12go beyond the level of a prompt. I don't 0:14have a specific magical prompt to give 0:17you here. I will have lots of examples 0:19in the writeup, but my goal with this 0:21video is to actually lay out what are 0:24the principles that advanced prompters 0:26use that are not widely known, right? 0:29that that you might not be aware of but 0:32that underly a lot of these advanced 0:33prompting techniques. Let's dive into 0:35the first one. Advanced prompters build 0:38self-correction systems. And so the 0:40first category here that we're talking 0:41about is about how you force models to 0:44attack their own outputs and to get past 0:46the fundamental limitation of single 0:49pass generation. which is a fancy way of 0:52saying you want to push the model to get 0:55past the initial generation step into 0:57thinking about what it's done. One way 0:59to do this is called chain of 1:01verification where you in the prompt 1:04require a verification loop inside the 1:08same conversational turn. So this might 1:10look like you know analyze this 1:12acquisition agreement list your three 1:14most important findings that's not 1:16special. Now, same prompt. Identify 1:19three ways your analysis might be 1:20incomplete. For each, cite the specific 1:23language that confirms or refutes the 1:25concern and then revise your findings 1:27based on all of this thinking or this 1:28verification. That's a very easy example 1:31of chain of verification. It can 1:32obviously get more complex. The key 1:34thing to realize is you're not asking 1:36the model to be more careful. That's too 1:38vague. You're structuring the generation 1:41process to include self-critique as a 1:44mandatory step. and that advocate 1:47activates verification patterns that the 1:48model was trained on but you probably 1:50wouldn't have gotten into by default. 1:52Another technique in this same bucket is 1:54adversarial prompting. And so if chain 1:56of verification asks models to verify 1:59their work, adversarial prompting is a 2:02lot more aggressive. It demands that a 2:04model finds problems even it if it needs 2:06to stretch. And so use this when you 2:09really really need to be sure. A good 2:11example of this would be you need to be 2:13sure that your security architecture 2:15review is as complete as possible. So 2:17you might say something like please 2:19attack your previous design. You need to 2:21identify five specific ways it could be 2:23compromised. For each vulnerability you 2:26need to assess likelihood. You need to 2:27assess impact etc. These these 2:31approaches are designed to be tools that 2:34you use in specific situations. And 2:36that's why I'm giving you these short 2:37examples is I want to give you a sense 2:39of not just the mental model, not just 2:41the principle, but where advanced 2:43prompters tend to use these techniques. 2:45Let's go to the next one. Strategic 2:47edgecase learning. Let's say you're 2:50having trouble distinguishing edge cases 2:52or boundary conditions around a 2:54particular problem set and you're trying 2:56to describe it in words and it's not 2:58working well. One of the ways to handle 3:01this is called fshot examples or fshot 3:05prompting. And what you're trying to do 3:06is you're trying to include examples of 3:09common failure modes and boundary cases 3:11so that you can teach the model how to 3:15distinguish those gray spaces, those 3:16edges in the situation. And so one 3:19example of how to do this is to show 3:22let's say you're trying to prevent a SQL 3:24injection attack, right? The first 3:25example might be a very obvious 3:28injection with a raw string 3:29concatenation. It's a baseline. The 3:32model should pick this up. The second 3:34example might be a parameterized query 3:37that looks safe but has some sort of 3:39second order injection stored somewhere, 3:42right? Maybe stored in XSS, etc. The 3:45failure mode would fool a naive 3:48analysis, but you're trying to teach the 3:49model through the example that this is 3:52the kind of thing to look for in this 3:54edge case. And so by including examples 3:56of subtle failure modes, it doesn't have 3:57to be SQL, right? I picked SQL because 3:59that's a really interesting one. But you 4:01can really use subtle failure modes for 4:02much less technical subjects as well. 4:04The model learns to distinguish what 4:06looks secure from what is secure or what 4:08looks correct from what is correct. And 4:10that enables you to drop your false 4:12negatives when you're trying to use the 4:14model for this kind of correct 4:15categorization work really 4:17significantly. So those particular sort 4:19of principles, edge case learning, 4:21adversarial prompting, chain of 4:23verification, those are all around sort 4:24of how we build selfcorrection systems. 4:26That's the larger bucket these fall 4:28into. Advanced prompters also do meta 4:30prompting. And I've talked about this 4:32before. It's worth talking about again. 4:35People do not realize how powerful meta 4:38prompting is until they try it. And I 4:40want to give you a couple of specific 4:42techniques that advanced prompters use 4:44that you can try as well. The first one 4:46is reverse prompting. So this technique 4:48exploits the model's meta knowledge 4:50about what makes prompts effective. The 4:52model's been trained on a lot of prompt 4:53engineering conversation and you can ask 4:55it to design an optimal prompt. And the 4:58funny thing is people don't realize 4:59this. You can ask it to define the 5:02prompt to solve a particular defined 5:04task and it will just write its own 5:06prompt and execute on it. And so one of 5:08the ways that you can do this is to say 5:10you're an expert prompt designer. Please 5:12design the single most effective prompt 5:15to analyze quarterly earnings reports 5:17for early warning signs of financial 5:19distress. Consider what details matter, 5:21what output format is most actionable, 5:23what reasoning steps are essential, then 5:25execute that prompt on this particular 5:28route. You see how we've included a 5:31request for specific outputs along with 5:35a request for the prompt. You can 5:37totally do that. You can ask for a 5:39prompt with certain characteristics and 5:41the model can use best practice, look at 5:44the output, formulate the prompt, keep 5:46in mind what you're looking for, and 5:48then run it. People don't realize you 5:49can do this, but it sure opens up a lot 5:52of power in the model. Another one is 5:53recursive prompt optimization. So, this 5:56is a situation where you can say, 5:58"You're a recursive prompt optimizer. My 6:00current prompt is here. Your goal is 6:02this. I need you to go through multiple 6:04iterations with me, right? For version 6:06one, just add the missing constraints. 6:08For version two, please resolve 6:10ambiguities. And for version three, 6:12enhance reasoning depth. You can pick 6:14what the versions do. But the point is 6:16you are starting to define aspects of 6:18the prompt you care about. You're not 6:20saying what the new prompt will be. 6:22That's up to the model. And you are 6:24giving the model multiple iterations in 6:26one pass. And so it's going back over 6:28the prompt again and again and again. 6:30And this can force a kind of structure 6:34and constraint that improves the quality 6:36of the prompt on the specific axes that 6:39you care about. So those are a couple 6:40techniques for metaring. Another 6:42advanced technique that I want to call 6:44out or advanced principle that we get 6:46into with prompting is reasoning 6:48scaffolds. How do you structure 6:50prompting? How do you structure 6:52interaction with the AI for deeper and 6:54more comprehensive analysis? So self-cut 6:57correction can catch mistakes. Meta 6:58prompting can improve prompt design. 7:00Reasoning is really controlling how the 7:03model thinks and changing it by 7:05providing a structure that forces 7:07thorough analysis. One technique that is 7:09not often practiced is deliberate over 7:11instruction. So basic prompts and a lot 7:14of the model training around token 7:16optimization compress outputs. There's a 7:19lot of be concise, summarize briefly, 7:21etc. And when models are trained that 7:23way, they may prematurely collapse their 7:25reasoning chains. You may not want that. 7:27And so one way to fight it is to append 7:30at the end of your ask a really clear 7:32definition of over instruction. Do not 7:35summarize. You might say expand every 7:37single point with implementation 7:39details, with edge cases, with failure 7:41modes, with historical context. You just 7:44go on and on, right? And then say like, 7:46I really need exhaustive depth here. I 7:48don't need an executive summary. I don't 7:50need conciseness. Please prioritize 7:52completeness. The reason you do this is 7:55because you want to expose the model's 7:57reasoning to examine it. I want to 7:59emphasize that this is about thinking 8:01with the model. You're not doing this to 8:03take what the model writes and just copy 8:05paste it. This is one of those tools 8:07that you use when you really want to 8:09understand the problem space and the 8:10model's thinking and respond back 8:12effectively. So deliberate over 8:14instruction is a big one. Another one is 8:15called zeroot chain of thought 8:17structure. And so this technique 8:19exploits how LLMs are trained to 8:21continue patterns. And so what you might 8:24do if you're thinking about pushing the 8:25model's thinking in a certain direction 8:27is provide a template with blank steps 8:30that triggers a chain of thought 8:32automatically because the model's 8:34objective immediately becomes filling 8:36the structure you've laid out and that 8:38would require decomposing the problem. 8:40So let's say you're root causing a 8:42technical issue and you have a series of 8:45questions you know the model needs to 8:46think through if it's going to do this 8:48correctly. You can literally list the 8:50question with a blank in sequence in the 8:52order you think it should be correctly 8:54done and the model will start to 8:55structure its thinking around that 8:57scaffolding. So this is really effective 9:00for problems that are quantitative for 9:02technical problems because it creates a 9:04natural progression from the breakdown 9:06of the problem to the solution. And that 9:08makes it much easier to understand what 9:10the model is thinking and to find out if 9:12you're actually in the right territory 9:14from a structure of thought perspective. 9:17Is the model on the right track here or 9:18not? Reference class priming is another 9:21advanced technique here. Reference class 9:23priming provides examples of reasoning 9:25quality and asks the model to match that 9:27explicit reasoning bar. So let's say 9:29you're using the model's own best output 9:31as a quality benchmark rather than 9:34relying on human provided examples. LLMs 9:36are trained to continue patterns and 9:38when you show it an example of 9:39highquality reasoning whether provided 9:42by humans or another model and you ask 9:44it to provide analysis that matches the 9:46standard you are priming the 9:48distribution of the model toward that 9:50level of depth. This is really different 9:52from sort of traditional fshot 9:54prompting. You're not showing input 9:55output pairs here to teach the model 9:58what to do. But instead, you're 9:59providing examples of quality reasoning 10:01and asking the model to meet that bar of 10:03quality. Without priming, outputs can 10:06vary wildly on quality and format, and 10:08it can be difficult to control for that 10:10directly with a prompt. And so, 10:11sometimes having an example can push the 10:14model toward producing much more 10:16consistent quality across an overall 10:18document set. Another technique that I 10:20want to call out is around perspective 10:23engineering. So, if we talked about 10:24reasoning, I gave you a few techniques 10:26here. Perspective engineering is really 10:28cool. Single perspective analysis will 10:30have blind spots determined by the 10:32model's default reasoning mode. So 10:34advanced prompters will push the 10:36perspective of the model to generate 10:37competing viewpoints on different 10:39priorities and that leads to higher 10:41quality thinking as well. One example is 10:43a multi-persona debate. So let's say you 10:45want to simulate the perspective of 10:47three different experts. You actually 10:49can instantiate three experts. You can 10:51just say three experts with conflicting 10:53priorities need to debate. These are the 10:55personas, right? Persona has priority X, 10:57persona 2 has priority Y, persona 3 has 10:59priority Z. They must argue for their 11:02preference and critique the others 11:03positions. After debate, you must 11:05synthesize a recommendation that 11:07addresses all of their concerns. You can 11:09do this when you have something where 11:11you need a vigorous debate, but you 11:13don't know how to push the LLM to get 11:15there. A good example is costbenefit 11:18analysis for vendors, right? If you're 11:19trying to figure out if you buy with a 11:21vendor or if you do a different 11:23approach, you can simulate that whole 11:25conversation and it's not the same as 11:26having the seauite talk about it, but it 11:28is great preparation and it helps you to 11:31expose perspectives and thinking you 11:32might not be aware of otherwise is an 11:35example of taking a very human 11:38conversational technique like debate and 11:41actually deliberately putting it into 11:43the chat. deliberately getting the chat 11:45to work like a human and argue back and 11:47forth in ways that help us to learn and 11:50make better decisions. Now, critically, 11:52personas do need specific potentially 11:54conflicting priorities. You can't just 11:56vanilla instantiate them with no 11:58conflicts and expect good results here. 12:00Another technique that I think is really 12:02important to call out is temperature 12:04simulation. Now, temperature is this 12:05idea that the model uh is more 12:08deterministic, more focused when it's 12:10low temperature or cold, and more 12:12creative when it's hot. That's 12:14traditionally controllable via the API, 12:16but you can actually do that in the chat 12:19indirectly. One way to do it is to have 12:22the model roleplay at different 12:23temperatures. So you could say, I want a 12:25junior analyst who is uncertain and who 12:27overexplains to look at this problem 12:30first. I want a confident expert who is 12:32concise and direct. That would be a 12:34cooler temperature. Uh and then I want 12:36you to synthesize both perspectives and 12:38highlight where uncertainty is warranted 12:40and where confidence is justified. We're 12:42basically giving the model a low 12:44temperature pass, a high temperature 12:45pass, and asking it to synthesize. I 12:47think that what's interesting here is 12:48that we can take a lot of the techniques 12:50that we see in the API and simulate them 12:52effectively as advanced prompters in the 12:54chat to get where we want to go. I hope 12:56this has been helpful for you. There are 12:58probably other advanced prompting 12:59techniques I could get into. I don't 13:01want to make this overwhelming, but 13:02these are the kinds of mental models 13:04that advanced prompters find difficult 13:06to articulate, but they inform a lot of 13:08productivity. They're very highly 13:10leveraged examples. If you're interested 13:11in diving in further, the writeup has a 13:13lot more. It has sort of examples of the 13:15prompts, etc. Enjoy. Good luck 13:16prompting. It's so powerful. We should 13:18learn more about it.