1 00:00:15,860 --> 00:00:16,700 Hi, everybody. 2 00:00:16,700 --> 00:00:18,100 My name is Dave Musliner. 3 00:00:18,200 --> 00:00:19,200 This is my colleague, Dr. 4 00:00:19,200 --> 00:00:22,620 Matt McClure from SIFT, or Smart Information Flow Technology. 5 00:00:22,660 --> 00:00:30,140 We're here to describe the La Crosse Cyber Reasoning System for automatically finding and fixing software vulnerabilities at scale and speed. 6 00:00:30,460 --> 00:00:37,660 So I'll give you one slide on who is SIFT, since you may not have heard of us, and then I'll talk briefly about the SIFTies who are here at DEF CON. 7 00:00:38,440 --> 00:00:45,300 Mostly we're spending our time over in our booth behind us describing how our cyber reasoning system works in more detail than you'll hear in this talk. 8 00:00:45,860 --> 00:00:55,600 But I'll give you a quick overview of the history and design of the cyber reasoning system and what we actually build for finals, which is different than what we build for semifinals and different than what we planned. 9 00:00:55,600 --> 00:00:58,480 That's kind of an ongoing theme you've heard in the other presentations. 10 00:00:58,840 --> 00:01:04,820 And Matt's going to give you a deep dive into the most important part, the newest part of our system, how all the large language model works. 11 00:01:06,000 --> 00:01:06,880 So who is SIFT? 12 00:01:06,880 --> 00:01:10,360 We're a small research company located in Minneapolis. 13 00:01:10,360 --> 00:01:14,040 We have a branch office in Boston and individuals scattered around the country. 14 00:01:14,040 --> 00:01:19,140 We're about 35 people and we focus on all areas of computer science and human-centered research. 15 00:01:19,140 --> 00:01:23,060 So a little bit different than some of the other teams that have built cyber reasoning systems here. 16 00:01:23,060 --> 00:01:25,140 We're not purely a cyber company. 17 00:01:25,400 --> 00:01:33,100 We have a great deal of cyber work, but probably two-thirds of our work is in other areas of AI and other research topics. 18 00:01:34,040 --> 00:01:37,080 SIFTies here at DEF CON, we've got five folks for your enjoyment. 19 00:01:37,080 --> 00:01:40,340 Lewis, Nathan, and Dan are either in the audience. 20 00:01:40,340 --> 00:01:41,440 Oh, there they are in the audience. 21 00:01:41,440 --> 00:01:42,360 Thank you. 22 00:01:43,340 --> 00:01:48,100 And Matt's up here with me to tell you all about the large language models. 23 00:01:48,700 --> 00:01:53,340 So our cyber reasoning system is actually fairly old. 24 00:01:53,580 --> 00:02:06,920 Our work in autonomous cyber reasoning goes all the way back 25 years to the DARPA Cyber Panel Program where we started working on decision-theoretic, mission-aware, automated response or defensive responses for cyber threats. 25 00:02:07,380 --> 00:02:22,400 But we didn't really get into large-scale multi-agent CRSs, cyber reasoning systems, until the DARPA Crash Program in around 2009 when we built a very large-scale system called Fuzzbuster which could run hundreds of nodes doing fuzzing before OSS fuzzing, 26 00:02:22,400 --> 00:02:26,900 before a lot of the fuzzers that you're familiar with, also before large language models. 27 00:02:26,900 --> 00:02:37,700 And the focus of Fuzzbuster was really to find bugs in source code and also to shield them, not necessarily fix them the way we do for this project, but to shield them from bad inputs. 28 00:02:38,440 --> 00:02:44,720 We participated in the DARPA Cyber Grand Challenge, which you may have heard a little bit about, about 10 years ago. 29 00:02:44,760 --> 00:02:49,580 We built a system called Fuzzbomb, which was designed to find and fix bugs in binaries. 30 00:02:49,580 --> 00:03:02,100 So very similar to what has happened here in the AI Cyber Challenge in the last two years, only instead of binaries in the CGC, here we have source code for all the open-source projects that were turned into challenge projects. 31 00:03:03,680 --> 00:03:10,420 After CGC, we continued working on large-scale fuzzing systems for the Navy, looking at more targets. 32 00:03:10,560 --> 00:03:17,180 And now we've built, as you've heard for the last two years, the La Crosse LLM plus AI Cyber Reasoning Security System. 33 00:03:17,600 --> 00:03:20,680 So what does all this Cyber Reasoning Security System look like? 34 00:03:20,680 --> 00:03:23,900 It's a little different than some of the other architectures you've heard about earlier. 35 00:03:24,620 --> 00:03:30,340 SIFT's existing system is designed as a multi-agent system with a plug-in analysis tool architecture. 36 00:03:30,340 --> 00:03:41,600 So on the bottom, you can see the system has the ability to take a lot of different kinds of tools from traditional cyber reasoning, static analysis, fuzz testing, symbolic analysis tools. 37 00:03:41,820 --> 00:03:47,360 All of those have been integrated into the cyber reasoning framework in previous projects. 38 00:03:47,360 --> 00:03:54,620 And the most important thing probably is that it's not one core or one agent running these tools. 39 00:03:54,620 --> 00:04:02,460 We can run hundreds of agents, and there is a built-in ability to coordinate which agents are working on which problems at which time. 40 00:04:02,600 --> 00:04:10,000 In the different architectures we've worked on, the different designs we've worked on, the exact layout of the hierarchy of agents is variable. 41 00:04:10,000 --> 00:04:16,260 But for La Crosse, there was essentially one agent responsible for gameplay and strategy. 42 00:04:16,260 --> 00:04:28,560 And it would task up to 300 other agents what to be doing, whether they were fuzz testing to try and find proofs of vulnerability or asking large language models to generate patches, et cetera. 43 00:04:28,560 --> 00:04:29,960 Matt's going to tell you all about that. 44 00:04:29,960 --> 00:04:35,480 The big new thing here in yellow is, as I said before, adding code-trained large language models. 45 00:04:35,640 --> 00:04:39,360 Now, underneath that, you'll see it says fine-tuning, and it's crossed out. 46 00:04:39,360 --> 00:04:49,040 Because two years ago, when we proposed to develop this system, we thought that we were going to have to fine-tune the LLMs to be better at reasoning about patching software. 47 00:04:49,400 --> 00:04:58,440 And as time went on, and as the LLMs got so dramatically better, not only did we not have time to even try fine-tuning, but we realized we probably didn't need to anyways. 48 00:04:58,440 --> 00:05:00,760 They're fabulous at this point, and they're getting better. 49 00:05:00,980 --> 00:05:03,360 And we try to do as much testing as possible. 50 00:05:03,380 --> 00:05:12,540 You've heard all the other teams saying, hey , these LLMs can lie to you, they can give you bad results, you've got to test the results, make sure they're as good as possible. 51 00:05:12,540 --> 00:05:23,740 Perhaps feed responses from testing systems like compilers and regression testing back into the LLM and say, you made a mistake, try again. 52 00:05:23,940 --> 00:05:30,020 So I'll give you just a quick overview of some of the kinds of workflows that LaCrosse can engage in. 53 00:05:30,020 --> 00:05:38,080 And the red Xs, just a preview, are things that we thought we were going to build, or we did build, but we didn't end up using for various reasons. 54 00:05:38,200 --> 00:05:51,840 But if you look at the top workflow, this looks a lot like some of the things you've seen before, where we start up one or more fuzzers on a new target, and then if a fuzzer can find a proof of vulnerability, a crashing input, we'll give that to a large language model and say, 55 00:05:51,840 --> 00:05:59,500 could you please figure out, based on the crashing data, what's going on, what's the kind of vulnerability, could you describe it or characterize it? 56 00:05:59,500 --> 00:06:02,940 And then we'll ask the large language model, please generate me a patch. 57 00:06:02,940 --> 00:06:06,820 We may ask multiple large language models multiple times. 58 00:06:07,220 --> 00:06:15,000 Those patches go through as much regression testing as we can, and it depends on what the exact challenge problem is, how much we have in the way of testing. 59 00:06:15,000 --> 00:06:20,980 But certainly the patches are checked to make sure that they compile correctly and the program turns over as much as we can. 60 00:06:21,040 --> 00:06:23,420 So that workflow was in the original design. 61 00:06:23,420 --> 00:06:35,200 On the left, you see that we had also planned to use static analysis tools to identify bugs, and we all know that static analysis tools are very likely to have false positives, and so we're like, that's no problem. 62 00:06:35,200 --> 00:06:40,340 The large language model will filter out the false positives, and it's just going to be great and awesome. 63 00:06:40,760 --> 00:06:50,800 In practice, what happened was the static analyzers we used weren't very good, and in the semifinals, you actually needed a proof of vulnerability to score any points at all. 64 00:06:50,800 --> 00:06:56,720 And so you could not just take a static analysis tool and say, here's a possible problem, LLM, please patch it. 65 00:06:56,720 --> 00:06:57,800 You will get no points. 66 00:06:57,800 --> 00:07:03,400 You actually need crashing input, and that pushed us back into fuzz testing, so there went static analysis. 67 00:07:03,480 --> 00:07:09,360 We also wanted to use dynamic symbolic execution to assess whether the patch was actually seeming to do the right thing. 68 00:07:09,360 --> 00:07:10,600 That never happened. 69 00:07:10,640 --> 00:07:11,600 Crossed that baby off. 70 00:07:11,600 --> 00:07:24,480 So another workflow, a cross-queuing workflow between analysis tools on the bottom, where in some situations in the finals, it became possible to score points without actually having a crashing input. 71 00:07:24,480 --> 00:07:31,240 And so we were able to generate a new workflow where you just feed some code to the LLM and say, does it look like there's a problem here? 72 00:07:31,500 --> 00:07:47,560 If so, generate a patch, regression test it, and then you may generate a lot of these patches, so do some patch selection heuristics to try and find a patch that seems like it's fixing something that's serious enough that the challenge problem might actually include it as a known bug. 73 00:07:48,600 --> 00:08:00,120 But we didn't want to do too many of these, because this pipeline could generate hundreds of suspected bugs and patches, and we knew that the organizers were probably not going to put in hundreds in each of the challenge problems. 74 00:08:00,120 --> 00:08:04,240 So we had to kind of tamp this thing down and do a better job with patch selection there. 75 00:08:04,240 --> 00:08:07,640 If you want to know more about that, I don't think you're going to get all that in Matt's talk. 76 00:08:07,700 --> 00:08:13,100 You have to come back to our booth to know a little bit more about how we scored patches to decide which ones to submit. 77 00:08:13,500 --> 00:08:19,160 But I'll just mention quickly some of the recent advances in large language models that you've probably already heard about today. 78 00:08:19,280 --> 00:08:27,220 But among other things, most important for us in the differences between when we started two years ago and where we are now is greatly increased token limits. 79 00:08:27,220 --> 00:08:31,420 So how many tokens, how much code can you actually feed into the large language models? 80 00:08:31,420 --> 00:08:34,640 In the semifinals, you really couldn't feed in very large chunks of code. 81 00:08:35,100 --> 00:08:37,780 Those limits have gone up by orders of magnitude. 82 00:08:38,020 --> 00:08:53,020 And now, in many cases, you can fit a whole source code file from an application, a large real-world application, you can fit the whole thing into a large language model context window and just ask questions like, is there a bug or can you patch it for me? 83 00:08:53,420 --> 00:08:59,940 And the output windows are important, too, because if you ask it to just rewrite the whole file, it's got to be able to output the whole file. 84 00:08:59,940 --> 00:09:01,240 And that doesn't always work. 85 00:09:01,240 --> 00:09:03,440 We have stuff to work around that. 86 00:09:03,440 --> 00:09:07,140 But it got a lot better as the LLMs improved. 87 00:09:07,900 --> 00:09:10,140 It is important to note that they're still not reliable. 88 00:09:10,140 --> 00:09:11,580 They make mistakes all the time. 89 00:09:11,580 --> 00:09:16,840 So we had to do a lot of work to detect when they might be making a mistake. 90 00:09:16,840 --> 00:09:24,340 And as I mentioned already, re-prompting them with error messages from things like compilers or testing frameworks to say, yeah, you patched it. 91 00:09:24,340 --> 00:09:25,180 It did compile. 92 00:09:25,180 --> 00:09:26,300 But these tests broke. 93 00:09:26,300 --> 00:09:27,560 Please fix that. 94 00:09:28,440 --> 00:09:36,740 I think with that, I'll just hand the mic right to Matt, and he'll go into the details of our really cool LLM stuff, which is this is different than anything you've seen before. 95 00:09:42,360 --> 00:09:43,420 Hi, everyone. 96 00:09:44,540 --> 00:09:48,420 My job is to tell you mostly about our LLM magic. 97 00:09:48,740 --> 00:09:50,520 I'm not a cyber person by background. 98 00:09:50,520 --> 00:09:56,820 You've seen a lot of people here today that are cyber experts that came to AI more recently for AICC, perhaps. 99 00:09:56,820 --> 00:09:57,820 I am the opposite. 100 00:09:57,820 --> 00:10:03,180 I am an AI person by background who had no cyber experience coming into AICC finals. 101 00:10:03,180 --> 00:10:04,400 I wasn't involved in the semifinals. 102 00:10:04,400 --> 00:10:09,540 So if I say anything squirrelly on the cyber side, that's why I say squirrelly things on the AI side. 103 00:10:09,540 --> 00:10:10,540 I have no excuse. 104 00:10:11,420 --> 00:10:18,020 So this is a high-level map of our Lisp-level tasks in LaCrosse. 105 00:10:18,060 --> 00:10:21,880 Embedded in here is kind of another view of what Dave was showing earlier with those workflows. 106 00:10:22,620 --> 00:10:27,340 When LaCrosse gets a challenge problem, it's going to be fuzzing, like Dave said, on hundreds of nodes. 107 00:10:27,340 --> 00:10:31,000 It's also going to be generating patches. 108 00:10:31,000 --> 00:10:36,740 And some of those generated patches are going to be in response to the POVs that it finds. 109 00:10:36,800 --> 00:10:39,160 Those are the proofs of vulnerabilities, i.e. 110 00:10:39,160 --> 00:10:43,280 crashing inputs coming from the fuzzers that are getting sent back incrementally. 111 00:10:43,340 --> 00:10:48,680 Some of the patches that it generates are going to be proactively just scanning code, not based on POVs. 112 00:10:48,960 --> 00:10:53,060 That's actually the path that you see along here on the top. 113 00:10:53,060 --> 00:11:00,480 We have a hypothesized vulnerabilities task whose job it is to be scanning code, generating hypothesized vulnerabilities. 114 00:11:00,780 --> 00:11:02,740 We also call that characterization. 115 00:11:03,740 --> 00:11:08,660 And then as they incrementally come into Optimist, it's going to be spawning these patching tasks. 116 00:11:08,800 --> 00:11:13,900 Those don't get submitted right away because we're not as confident in them as if we have a POV. 117 00:11:14,380 --> 00:11:19,160 Across the middle there, we have our main path through the fuzzer. 118 00:11:19,160 --> 00:11:23,180 Again, running on hundreds of nodes, sending back crashing inputs incrementally. 119 00:11:23,220 --> 00:11:28,640 And then we have these two tasks that are mirroring the two tasks above, essentially a characterization step. 120 00:11:28,640 --> 00:11:33,020 And then for each characterized vulnerability, a patching task. 121 00:11:33,560 --> 00:11:36,960 The dashed box does not exist in our final system. 122 00:11:36,960 --> 00:11:39,720 Some version of it existed in our semi-final system. 123 00:11:40,400 --> 00:11:42,300 But it's an exciting piece. 124 00:11:42,300 --> 00:11:51,540 It's just in those final stages, those final weeks, the calculus of the expected points to be gained by working on different things versus the risk and the cost. 125 00:11:51,940 --> 00:11:53,840 This just didn't make it to the top of the list. 126 00:11:53,840 --> 00:11:55,140 But we are excited about it. 127 00:11:55,140 --> 00:11:59,800 And also, it's motivated the task structure here, which is why I included it. 128 00:12:01,020 --> 00:12:09,140 And then along the bottom there, we just have that one monolithic task, an LLM pipeline, whose job it is to deal with serif assessment. 129 00:12:10,320 --> 00:12:13,340 I think that covers that slide. 130 00:12:13,440 --> 00:12:20,160 So now, oh, so we had those three main pipelines, characterization, patching, and serif assessment. 131 00:12:20,160 --> 00:12:21,560 So I'm going to talk about each one. 132 00:12:21,980 --> 00:12:25,940 So characterization, I'm actually going to direct you to the bottom first here. 133 00:12:25,940 --> 00:12:27,120 These are the inputs. 134 00:12:27,620 --> 00:12:30,340 Some of these are not, the first three are not always available. 135 00:12:30,340 --> 00:12:31,880 The last one is always available. 136 00:12:32,200 --> 00:12:36,420 In the POV case, we get a crash log from reproducing the POV. 137 00:12:36,420 --> 00:12:44,060 And as a first step, we always will filter that down to the stack trace and any relevant instrumentation leading up to the stack trace. 138 00:12:44,800 --> 00:12:50,760 In the case of a delta scan, we have a delta, which is the diff of the commit that introduced or exposed the bug. 139 00:12:51,320 --> 00:12:56,980 The blob is just another name for the crashing input itself, which again is only available for the POV case. 140 00:12:57,000 --> 00:12:59,940 And then the code base is always available. 141 00:12:59,940 --> 00:13:05,400 So as a first step, if a delta or crash exists... 142 00:13:05,400 --> 00:13:06,900 Actually, let's go on the bottom first. 143 00:13:06,900 --> 00:13:14,560 If it does not exist, then we're going to scan every file in the code base that's in the target language, which we determined programmatically. 144 00:13:14,780 --> 00:13:19,360 We feed that file into this identify vulnerabilities prompt. 145 00:13:19,660 --> 00:13:21,360 It's a single prompt. 146 00:13:22,480 --> 00:13:24,940 And we're going to ask it what vulnerabilities are in the file. 147 00:13:24,940 --> 00:13:31,680 And that's going to give us this first initial raw list of vulnerability hypotheses, this data structure that you see in the middle there. 148 00:13:31,720 --> 00:13:36,060 If we have a delta or crash, we're going to do something more sophisticated. 149 00:13:36,080 --> 00:13:47,700 It's shown as a single box there, but it's actually a whole sub-pipeline whose job it is to determine the relevant context, potentially relevant context, for identifying vulnerabilities. 150 00:13:47,700 --> 00:13:53,560 It can be pulled from different files, different functions, and in some cases, just more free-form snippets than a function. 151 00:13:53,560 --> 00:13:58,800 That gets passed in as context to this identify vulnerabilities step. 152 00:13:59,280 --> 00:14:11,420 And again, we end up with these structured hypotheses that include a natural language description of the bug in terms of specifics, variable names, function names, etc., line numbers. 153 00:14:11,600 --> 00:14:15,360 We have a CWE as assessed by the LLM. 154 00:14:15,360 --> 00:14:23,000 We have a list of suggested repairs, which are per file, that together will jointly fix the bugs according to the hypothesis. 155 00:14:23,000 --> 00:14:27,080 And notes, which is just anything that doesn't fit into the above fields. 156 00:14:28,040 --> 00:14:31,440 Okay, so next step, we filter and score this list of vulnerabilities. 157 00:14:31,760 --> 00:14:34,620 We have a list of yes or no questions that we filter against. 158 00:14:34,620 --> 00:14:36,260 It has to pass all of those. 159 00:14:36,580 --> 00:14:46,680 So, for example, if you need to create file system effects, like symlinks, whatever, in order for the bug to be exploitable, we toss it. 160 00:14:46,680 --> 00:14:50,780 Because we don't think that's accessible in the parameters of the competition. 161 00:14:51,900 --> 00:14:56,900 We deduplicate against existing vulnerabilities involving the same file. 162 00:14:56,920 --> 00:15:01,080 Again, this is shown as one block, but there's actually more subtleties inside there. 163 00:15:01,460 --> 00:15:04,960 And then we score, again, against a list of yes or no questions. 164 00:15:04,960 --> 00:15:08,440 There's like five to ten yes or no questions in both of those. 165 00:15:09,020 --> 00:15:12,200 And in this case, there's a reward associated with each question. 166 00:15:12,200 --> 00:15:20,440 So, for example, one of them is, does this CWE show up in the list of the most serious CWEs of 2024? 167 00:15:20,440 --> 00:15:21,480 And then we list them. 168 00:15:21,900 --> 00:15:24,660 If it does, you get five points or something like that. 169 00:15:24,860 --> 00:15:31,820 So, this is how we end up with a filtered list of vulnerability hypotheses that each one is scored. 170 00:15:35,480 --> 00:15:37,760 Okay, here's the patching pipeline. 171 00:15:37,880 --> 00:15:42,780 In comes our single vulnerability hypothesis, and it has this list of suggested repairs. 172 00:15:42,860 --> 00:15:46,200 For each one, we're going to do everything inside that dashed box. 173 00:15:46,780 --> 00:15:50,420 First, we're going to choose whether we want to work in functions or snippets. 174 00:15:50,420 --> 00:15:53,020 We're asking the LLM that with the relevant context. 175 00:15:53,760 --> 00:16:03,640 And we end up with these code snippets, and we're going to feed those into this rewriting prompt that is going to jointly rewrite them, because they might have cross-dependencies. 176 00:16:03,780 --> 00:16:09,180 So, that's a structured prompt where you're going to rewrite all the code snips together to implement the file repair. 177 00:16:09,200 --> 00:16:18,540 Then we have this rectify step, which is because sometimes the LLM will hallucinate a rewritten function that does not correspond to any original function. 178 00:16:18,540 --> 00:16:22,480 So, we found that, and we had to filter those out, essentially. 179 00:16:23,120 --> 00:16:26,860 So, now we have our rewritten code snippets, our original code snippets. 180 00:16:26,860 --> 00:16:31,020 And because we worked in line numbers early on, it's as simple as a string replace. 181 00:16:31,020 --> 00:16:32,420 We can do that programmatically. 182 00:16:32,420 --> 00:16:34,840 That's that replace function snippets box. 183 00:16:36,540 --> 00:16:39,280 And so, we implement all our file repairs. 184 00:16:39,280 --> 00:16:41,800 Then we have a modified code base, an original code base. 185 00:16:41,800 --> 00:16:43,180 We do a programmatic diff. 186 00:16:43,180 --> 00:16:44,620 That gives us a patch. 187 00:16:44,760 --> 00:16:46,480 Then we move on to patch testing. 188 00:16:46,480 --> 00:16:48,480 And this has four stages. 189 00:16:48,600 --> 00:16:50,060 Does the patch apply? 190 00:16:50,300 --> 00:16:53,240 Does the patched code base build? 191 00:16:54,000 --> 00:16:57,520 Did it fix the POV, in the case where we have a POV? 192 00:16:57,620 --> 00:17:00,840 And does it pass functionality tests, which are not always available? 193 00:17:00,840 --> 00:17:03,960 So, those third and fourth ones are not always available. 194 00:17:04,440 --> 00:17:09,340 We look at whether the patch passed all available tests. 195 00:17:09,460 --> 00:17:10,340 If it did, great. 196 00:17:10,340 --> 00:17:11,480 We output a patch. 197 00:17:11,500 --> 00:17:15,160 If not, we get feedback on what exactly failed. 198 00:17:15,160 --> 00:17:16,620 How many steps failed and more detail. 199 00:17:16,620 --> 00:17:19,800 For example, if it didn't fix the POV, we have a new stack trace. 200 00:17:20,520 --> 00:17:26,420 And this feeds back into this running list of patching attempts and their associated feedback. 201 00:17:26,800 --> 00:17:34,680 This gets fed into this modified vulnerability hypothesis sub-pipeline, which also has the relevant inputs. 202 00:17:34,680 --> 00:17:44,420 And we are going to modify the original vulnerability hypothesis, start the whole thing over again, and repeat that until you succeed or reach some max number of attempts. 203 00:17:44,780 --> 00:17:49,920 And if you fail, then I'll get to this, but the whole thing is going to be rerun with a different model. 204 00:17:49,920 --> 00:17:51,500 A different default model. 205 00:17:51,640 --> 00:17:59,980 Individual components can have assigned specific models, depending if we found that that model is particularly good at that step. 206 00:18:02,140 --> 00:18:05,240 Okay, this is the serif assessment pipeline. 207 00:18:05,240 --> 00:18:10,000 Shout out to Luis Baez who implemented this and the testing for it. 208 00:18:10,000 --> 00:18:13,340 So we have our serif report coming in. 209 00:18:13,500 --> 00:18:17,740 We extract the relevant snippets from the serif report. 210 00:18:17,740 --> 00:18:20,080 Sorry, we extract the relevant locations. 211 00:18:20,300 --> 00:18:23,500 That allows us to extract the code snippets that it's referring to. 212 00:18:23,500 --> 00:18:26,300 We add some margin on the front and the back. 213 00:18:26,980 --> 00:18:33,340 Then we just feed the serif report and these relevant code snippets into this prompt that's actually surprisingly brief. 214 00:18:33,340 --> 00:18:38,060 It determines whether the serif is internally consistent and correct with respect to the code. 215 00:18:38,060 --> 00:18:41,920 Output a binary yes or no and a reason and Bob's your uncle. 216 00:18:44,040 --> 00:18:51,640 So Luis had created these seven additional tests in addition to the seven serif tests that we had from the competition. 217 00:18:51,640 --> 00:19:02,100 These were like slight variants that were made to be incorrect and out of those 14 we were finding that we had 13 of 14 consistently correct by the time we tuned this thing. 218 00:19:03,680 --> 00:19:06,320 Okay, that leads me to prompts and mixins. 219 00:19:06,320 --> 00:19:09,900 This is a look at what a prompt is like in Lacrosse. 220 00:19:09,900 --> 00:19:12,640 We used a framework called DSPy. 221 00:19:12,640 --> 00:19:14,000 Some of you might have heard of it. 222 00:19:14,100 --> 00:19:15,440 I love DSPy. 223 00:19:15,440 --> 00:19:20,320 And the reason I love DSPy is because it allows you to treat prompts like functions. 224 00:19:20,840 --> 00:19:24,920 And the way it does that is by giving you a typed interface to every prompt. 225 00:19:24,920 --> 00:19:27,340 So you have some number of input fields. 226 00:19:27,340 --> 00:19:29,780 Each of them has an arbitrary type specifier. 227 00:19:29,780 --> 00:19:33,320 You have some number of output fields, also type specified. 228 00:19:33,460 --> 00:19:39,560 And DSPy has gotten really good at getting those types right on the outputs. 229 00:19:41,360 --> 00:19:45,240 And so for example here, we have a serif assessment signature. 230 00:19:45,440 --> 00:19:54,640 In DSPy you have this block that's describing the purpose of the prompt itself, the operation of the prompt, that natural language description. 231 00:19:54,640 --> 00:20:00,800 Then for each field you have, in addition to your type specifier, you have a natural language description of the field. 232 00:20:01,280 --> 00:20:08,740 Now, this is great for composing these complicated pipelines that become more reliable because you're treating prompts like functions. 233 00:20:08,740 --> 00:20:13,420 But it is cumbersome because you have to define all these input and output fields every time. 234 00:20:13,420 --> 00:20:15,180 Describe your prompt, describe each field. 235 00:20:15,180 --> 00:20:22,900 So what we do in Lacrosse is we go further and we turn any potentially reusable input or output field into a mixin. 236 00:20:22,900 --> 00:20:31,400 So it gets its own class and we just make sure that the description for the input or output field is not specific to the operation of this prompt. 237 00:20:31,580 --> 00:20:36,900 And that way we get to, as long as it can work together and make sense in the context of the prompt. 238 00:20:36,900 --> 00:20:46,560 So you get kind of the best of both worlds where you eventually build up this library of mixins and your prompts become as simple as writing the general description of what it's doing. 239 00:20:46,580 --> 00:20:51,480 You import these mixins, make it inherit from them, and there's your typed interface. 240 00:20:51,480 --> 00:20:56,560 So we think that's an exciting way to prototype more quickly. 241 00:20:57,920 --> 00:21:00,500 These are some fun examples I'll gloss through. 242 00:21:00,500 --> 00:21:01,440 Oh yeah, I've got to gloss. 243 00:21:01,840 --> 00:21:07,540 Basically the punchline here is that this is the same serif challenge that came in. 244 00:21:08,100 --> 00:21:14,880 And in one case we had a larger margin on each side of those code snippets, 50 to 100 lines. 245 00:21:14,880 --> 00:21:23,860 In the lower case we had the same model, same pipeline, but a tighter margin, which was less intuitive to us, of 0 to 10 lines. 246 00:21:23,860 --> 00:21:25,060 We ended up with 10. 247 00:21:25,420 --> 00:21:29,260 But anyway, the thing nails it when you give it less context. 248 00:21:29,340 --> 00:21:34,720 And this gets at a repeated lesson of these things is context management is so key. 249 00:21:35,160 --> 00:21:43,360 They have hard limits on the context window, but really there's a soft limit to think about with these context windows because it's going to be more performant the more you can eliminate distractors. 250 00:21:45,420 --> 00:21:48,460 Real quick, this is one that we were surprised by. 251 00:21:48,980 --> 00:21:54,820 Lewis modified a test to have, instead of an out-of-bounds read, which is correct, the test had an out-of-bounds write. 252 00:21:55,060 --> 00:21:58,580 And we saw that the O3 model nailed this. 253 00:21:58,580 --> 00:21:59,880 We were kind of shocked at the time. 254 00:21:59,880 --> 00:22:05,280 O3 ended up being the model that we went with for serif assessment as a first resort. 255 00:22:05,720 --> 00:22:09,260 And yeah, just kind of an anecdote about these things being impressive. 256 00:22:09,860 --> 00:22:17,080 Okay, so real quickly, these are a couple robustness mechanisms that are sprinkled throughout LaCrosse. 257 00:22:17,380 --> 00:22:28,400 Trimodels is a wrapper that we have where you're giving it some function which has all these LLM operations under the hood, and you're giving it a list of LLMs, models to use as resorts. 258 00:22:28,400 --> 00:22:30,280 First resort, second resort, et cetera. 259 00:22:30,360 --> 00:22:42,560 If your first resort model hits an exception somewhere, maybe it didn't get the interface right, maybe it hit a rate limit, it's going to raise the exception and go to the second model in the list. 260 00:22:42,560 --> 00:22:45,300 Only when it gets through the whole list does it raise the exception further. 261 00:22:46,480 --> 00:22:52,600 So respond to error patterns real quick is just a back-off mechanism where you're going to retry with the same LLM instead. 262 00:22:52,600 --> 00:22:55,680 Some number of times, random delay each time. 263 00:22:56,980 --> 00:23:00,980 This is the robustness mechanism that we're most excited about. 264 00:23:01,140 --> 00:23:03,120 This is called parallel consensus. 265 00:23:03,220 --> 00:23:09,360 And the idea here is it's a super general wrapper that wraps around any Python call, remember. 266 00:23:10,720 --> 00:23:14,160 Pipelines and prompts, they all just look like Python function calls. 267 00:23:14,240 --> 00:23:16,280 So you're going to wrap parallel consensus around it. 268 00:23:16,280 --> 00:23:21,760 You're going to give it a list of LLMs and a number of each to instantiate. 269 00:23:21,940 --> 00:23:26,020 It's going to go and run the LLM operation on all of those in parallel. 270 00:23:26,540 --> 00:23:30,340 Then it's going to come back with this list of outputs from each one. 271 00:23:30,500 --> 00:23:33,620 Some of them may not come back, rate limits, whatever, it doesn't matter. 272 00:23:34,580 --> 00:23:35,520 That's okay. 273 00:23:35,640 --> 00:23:36,900 You get this list of outputs. 274 00:23:36,900 --> 00:23:39,120 And then this consensus stage is just... 275 00:23:39,120 --> 00:23:43,220 the whole job is to just pick the most representative output from the list. 276 00:23:43,500 --> 00:23:45,560 And the key things, there are three key things to notice here. 277 00:23:45,560 --> 00:23:46,440 I have too many call-outs. 278 00:23:46,440 --> 00:23:49,700 But the three things to notice are super general wrapper. 279 00:23:50,420 --> 00:23:52,860 The output can be any data structure. 280 00:23:52,860 --> 00:23:54,180 It does not have to be a string. 281 00:23:54,280 --> 00:23:59,040 It just needs to be castable to a string so that you can present it to the LLM meaningfully. 282 00:23:59,040 --> 00:24:02,040 But the LLM is going to pick... 283 00:24:02,700 --> 00:24:09,460 which looks like picking an index and it's going to index into that list of output data structures and give you that corresponding output. 284 00:24:10,220 --> 00:24:20,440 And the other thing to notice is this consensus stage does not need to know anything about the inputs to the LLM operations or the nature of the LLM operations. 285 00:24:20,480 --> 00:24:22,200 This is part of what makes it so general. 286 00:24:22,200 --> 00:24:24,640 You can wrap an arbitrarily complex pipeline. 287 00:24:24,740 --> 00:24:26,400 It only cares about the outputs. 288 00:24:26,400 --> 00:24:30,300 So it's very predictable what the inputs to the second stage are going to be. 289 00:24:32,060 --> 00:24:35,840 This is where we use parallel consensus in La Crosse. 290 00:24:35,840 --> 00:24:42,300 Anywhere you want to trade money for robustness in high stakes, moderately difficult, empirically inconsistent modules. 291 00:24:42,580 --> 00:24:48,740 And I say empirically inconsistent because it's going to allow common good answers to crowd out rare bad answers. 292 00:24:48,740 --> 00:24:50,980 In other words, most hallucinations. 293 00:24:52,360 --> 00:24:54,400 Now, we also use a unanimous consensus... 294 00:24:54,400 --> 00:24:55,120 Oh, sorry. 295 00:24:55,120 --> 00:25:01,240 And that we use around our identify vulnerability stage which can cause problems if it goes off the rails. 296 00:25:01,260 --> 00:25:04,660 We were seeing that in maybe 5-10% of cases. 297 00:25:07,200 --> 00:25:19,560 We have a unanimous consensus variant that's used with these yes or no questions and that was really a play against rate limits because these questions are pretty easy to get for a less performant model which we don't use in many other places. 298 00:25:19,560 --> 00:25:21,740 So outsource to a group of those first. 299 00:25:21,740 --> 00:25:23,640 As long as they're unanimous, move on. 300 00:25:23,640 --> 00:25:26,980 If they disagree, that's when you escalate to a more performant model. 301 00:25:27,920 --> 00:25:36,640 I'm excited about where to go with this which is allowing rare good answers to spread among the experts and crowd out common bad answers. 302 00:25:36,920 --> 00:25:41,580 But it's a more complicated thing, specifically how general it can be. 303 00:25:41,580 --> 00:25:48,360 I don't think it can be as general as parallel consensus because it needs to know about the nature of the operations in that case. 304 00:25:48,360 --> 00:25:50,660 It's hard to know what a smart answer is without knowing that. 305 00:25:51,040 --> 00:25:52,980 Okay, so, last of my slides. 306 00:25:52,980 --> 00:25:56,040 This is a glimpse at our pipeline testing framework. 307 00:25:56,040 --> 00:25:58,940 The viz for our internal pipeline testing. 308 00:25:59,160 --> 00:26:11,740 What you're seeing is along the x-axis here are different combinations that we tried of pipeline structures, input combinations, and the models. 309 00:26:11,980 --> 00:26:18,100 And on the y-axis, you're seeing the performance on the NGINX dataset that we got from the semifinals. 310 00:26:18,100 --> 00:26:21,640 Each color is a different challenge problem in the NGINX dataset. 311 00:26:21,640 --> 00:26:24,480 And the max score for each one is four points. 312 00:26:24,480 --> 00:26:26,620 Those blocks you're seeing. 313 00:26:27,020 --> 00:26:29,860 And those correspond to those same four stages I talked about before. 314 00:26:29,860 --> 00:26:31,020 Did the patch apply? 315 00:26:31,020 --> 00:26:32,440 Did the code build? 316 00:26:32,900 --> 00:26:36,300 Did it fix the POV and did it pass functionality tests? 317 00:26:36,580 --> 00:26:44,820 So we were seeing by the end here that this allowed us to hill climb on models, on pipeline structures, and also it allowed us to see what's complementary. 318 00:26:44,920 --> 00:26:50,780 So this allowed us to combine different elements of pipelines if they were good at different types of problems. 319 00:26:50,780 --> 00:26:52,720 It also motivated parallel consensus. 320 00:26:53,520 --> 00:27:02,240 And by the end, we were seeing consistently 12 to 13 of these 14 NGINX problems nailed by the system. 321 00:27:03,200 --> 00:27:04,820 So let's see, I think that's all I got.