YouTube transcript (Uni9dqyuuDM) — Transcript
Full transcript
- 0:05So today's focus will be very much on
- 0:09improving the models using search and um
- 0:12there can be two kinds of search that we
- 0:14will see one in code models where we are
- 0:16sampling a lot and then we are searching
- 0:18based on that and then u deep research
- 0:21style search which you will see in
- 0:23homework 3. So a lot of what we will
- 0:25cover in alpha code and alpha code 2
- 0:28those kind of search patterns um you
- 0:31will use also in homework your homework
- 0:332 is focused on human eval. So this will
- 0:36have this will give you uh an overview
- 0:39of what to expect in simpler problems
- 0:42and then even more complex problems and
- 0:44then the agentic search this will be
- 0:47closer to what you'll we will give you
- 0:48in homework three. [snorts]
- 0:51Um I think the broad thing that I want
- 0:54to say with uh these models is that
- 0:57we kind of know that the solutions lie
- 1:00in the search space of the models but
- 1:02how do you curate the answer out of the
- 1:05search space of the what the model
- 1:07outputs is roughly what we are covering
- 1:09today.
- 1:11So let's start with alpha code.
- 1:15So the problem we want to solve here is
- 1:18um a more complex version of the simple
- 1:21coding agent problem. So if you use a
- 1:23coding agent, what you often get is some
- 1:26form of an autocomplete where you are
- 1:28have a line and then the coding agent or
- 1:32will complete the line for you. So this
- 1:34is closer to a competitive programming
- 1:36problem where you're given a programming
- 1:38uh problem like competitive programming
- 1:40problem. You're given a problem
- 1:41description and then you're given some
- 1:43input and outputs. So you have some sort
- 1:46of a contract in that programming
- 1:48problem which says that if you give this
- 1:50set of inputs you should get these set
- 1:52of outputs
- 1:55[snorts] and what you want to really
- 1:57solve for is how do we solve these
- 2:00competitive programming problems so that
- 2:03so the kind of things that we already
- 2:05are able to do is code completions but
- 2:06when we try to do blocks of code or like
- 2:09solve real problems uh end to end that
- 2:11that starts to be a much harder problem
- 2:13as you'll see in the ways that this
- 2:15problem gets solved.
- 2:17So just to give you a preview of what ho
- 2:21how um alpha code came about and like
- 2:23what it achieved and it was this is an
- 2:26older paper but it's worth remembering
- 2:27that at that point in time when alpha
- 2:29code was released which is almost like
- 2:32four years ago
- 2:34it ranked top 54% among the uh contest
- 2:37participants uh in 10 contests and this
- 2:40was the first time it was shown that AI
- 2:42can generalize beyond just narrow tasks
- 2:44and like solve problems end to
- 2:46in and this was a much harder problem
- 2:50than what you could do in just human
- 2:52eval where you basically are given a
- 2:55very small problem like complete this
- 2:56function or you're given instructions to
- 2:58exactly solve what you want to solve and
- 3:00you don't have to reason about like
- 3:02understanding the problem and then
- 3:04figuring out what it would take to solve
- 3:05the problem. So this was definitely
- 3:07longer problem descriptions, longer
- 3:09solution lengths and you were having to
- 3:12understand from the dock string what is
- 3:13the right solution approach even before
- 3:15going and solving that. So it's not just
- 3:17like taking the problem description from
- 3:19the programmer and then just like coding
- 3:21it up.
- 3:25And I think this is well understood that
- 3:28the when the models are generating
- 3:31suggestions in one single line it's much
- 3:33easier for us as um software developers
- 3:37to interact with that and you get much
- 3:39higher success rates for example in
- 3:40copilot and equivalent uh functions. But
- 3:44when you have to solve problems end to
- 3:46end, that ends up being a much harder
- 3:48problem. So if you look at and I'll go
- 3:51through each of these block diagrams uh
- 3:53one by one. Um so this is pre um
- 3:58uh this is pre having large models. So
- 4:00they actually were pre-training their
- 4:01own models. The pre-trained models in
- 4:03the next report uh will will get
- 4:05replaced. So what you see here is that
- 4:07you have a stage where you are basically
- 4:09coming up with a model from which you
- 4:10are going to sample. Now this model we
- 4:13will later replace with
- 4:16a large language model. So here they're
- 4:18also doing pre-training and fine-tuning
- 4:21and the data that fed that data that
- 4:23really helped this model train was
- 4:25GitHub data and then C code contest.
- 4:28What code contest is basically a large
- 4:31uh chunk of pro problems and solutions
- 4:33that come from competitive programming.
- 4:36So once they trained the model here,
- 4:38they're basically going to do a large um
- 4:41they're they're going to sample a lot of
- 4:42solutions. So we have seen repeated
- 4:45sampling before. So this is repeated
- 4:47sampling but at a massive scale. So you
- 4:50will end up with a lot of solutions and
- 4:52then you're going to play some tricks to
- 4:55figure out which set of solutions should
- 4:57we even run tests on. So, so far we've
- 5:00just been closing the loop where we take
- 5:03whatever set of solutions the model
- 5:04outputs and then running tests on them.
- 5:08In this particular case, you're actually
- 5:10going to select. So, there's a selection
- 5:12stage before you're going to complete
- 5:14and execute and evaluate.
- 5:17So, just to walk through things step by
- 5:19step and and uh so the first step is
- 5:23pre-training.
- 5:25You're going to pre-train a model. In
- 5:27this particular case, they're going to
- 5:28use mass language model loss. You can
- 5:30also have a decoder only model which
- 5:32we'll see shortly. And the model is
- 5:34trained on GitHub code uh about 700 GB
- 5:38of that trained with next token
- 5:40prediction.
- 5:42What's interesting is that when they
- 5:43fine-tune it, they are using some
- 5:46tricks. So they're using regularization
- 5:48so that they can assign higher
- 5:49probability to more meaningful patterns.
- 5:51This is interesting in code. And then
- 5:54they're doing something called as value
- 5:55conditioning um and prediction. Uh so
- 5:59the thing that I want to highlight in
- 6:00this slide is that what they in the
- 6:03regularization technique when they're
- 6:04doing fine-tuning they assign higher
- 6:06weight to higher likelihood tokens so
- 6:08that there are certain tokens that will
- 6:10have higher likelihood and then they are
- 6:12putting lower weight to lower likelihood
- 6:13tokens. So this is called as gold. So it
- 6:16will help improve the precision. So in
- 6:17the next token um next token uh
- 6:21prediction loss they are basically
- 6:23adding a waiting mechanism to take into
- 6:25account uh the likelihood of the tokens
- 6:27also uh which helps um in certain ways
- 6:31and and helps to uh assign higher
- 6:33probabilities to more meaningful
- 6:34patterns. So this is done in the
- 6:36fine-tuning phase.
- 6:38So once you get this model that is u
- 6:41able to and this was an encoder decoder
- 6:43model that they were initially using and
- 6:44then they also tried with decoder only
- 6:46models in alpha code 2. Once they get
- 6:48this model they are going to try large
- 6:50scale sampling.
- 6:52Uh they generate 1 million 1 million is
- 6:56a large number they generate 1 million
- 6:58diverse sample programs per question. So
- 7:00if you have a question a competent
- 7:02programming per question they're
- 7:03generating 1 million solutions half in
- 7:05Python half in C++. So machines can do
- 7:08that and they randomize the problem tags
- 7:12and the ratings in the prompt and they
- 7:13use a high sampling temperature. So it's
- 7:15like these solutions are going going to
- 7:18be diverse
- 7:20and once they generate these set of
- 7:22solutions what they're doing is they are
- 7:25doing some amount of filtering and
- 7:26clustering. So they filter the samples
- 7:28to only those that passed tests given in
- 7:31the problem statement and then they are
- 7:33clustering them so that they're
- 7:35syntactically different but semantically
- 7:37equivalent. So they differentiate
- 7:39between that. So they are basically
- 7:44uh using a clustering mechanism where
- 7:47they use a separate test input
- 7:48generation model train it to predict
- 7:50test inputs given problem descriptions
- 7:52and then create these new test inputs
- 7:54for uh unseen problems. So they're
- 7:56basically trying to figure out different
- 7:58trick uh tricks to cluster this um this
- 8:02test inputs the semantic equivalence
- 8:04being one way to do that. Now the reason
- 8:07this clustering is important is is it it
- 8:10is effectively providing a way for us to
- 8:12select which set of solutions are
- 8:15diverse enough for us to then uh
- 8:17evaluate to close the loop.
- 8:21So now what you can do is you can submit
- 8:24only a subset of solutions to the code
- 8:26forces platform which is the actual
- 8:28competition platform.
- 8:30So and that will check the program
- 8:33correctness. It will uh benchmark
- 8:35against other performers uh best
- 8:37performers on this task like human
- 8:39competitors. But the challenge here is
- 8:40that you cannot submit all the
- 8:42solutions. So 1 million solutions cannot
- 8:44be submitted to this uh platform. So
- 8:46they have done
- 8:48a curation phase, a filtering and
- 8:50clustering phase to get to this stage.
- 8:53Um and then there's also evaluation on
- 8:56code contest. Remember that code contest
- 8:58was used to train the model. So there's
- 9:00a test set that they hold out uh which
- 9:02will basically
- 9:04give them a signal. So this is the data
- 9:06set that is created by authors but they
- 9:08can also um measure signal on this
- 9:11particular data set to figure out if
- 9:13their solution is supposed to do well or
- 9:15not.
- 9:17So when they first uh did evaluation on
- 9:20code forc's platform um they ran like
- 9:24they they took their model ran it live
- 9:26generated samples filtered with example
- 9:28tests clustered to get some submissions
- 9:30and then submitted to the platform and
- 9:32they ran this with uh they submitted in
- 9:3510 competitions which each had 5,000
- 9:37participants and uh what they found was
- 9:41that their solutions with this alpha
- 9:43code actually had an average ranking of
- 9:4654.3 assuming 10 submissions per
- 9:49problem. So not not 1 million and um it
- 9:53was competitive with 28% of the
- 9:55competitors in the last 6 months. So
- 9:58this table is showing you that if you
- 10:00looked at a certain contest ID uh how
- 10:03was the alpha code model doing what was
- 10:05its percentage ranking the best ranking
- 10:08and the estimated ranking and the worst
- 10:09ranking uh relative to uh other
- 10:12programmers. This is more of a ranking
- 10:14based as to like once you submit a
- 10:16solution you're cap um you're ranked
- 10:18based on the efficiency of your solution
- 10:20and the correctness of your solution.
- 10:26Before I move further uh questions
- 10:35you go back to previous page.
- 10:37It seems like the I mean I mean the the
- 10:41the numbers table if you look at the
- 10:43performance across different data sets
- 10:45it seems that
- 10:47>> this is different contest.
- 10:48>> Yeah. It seems they did pretty well
- 10:50[clears throat]
- 10:50162.
- 10:51>> Mhm. Even the worst one is like 50 some
- 10:58the
- 11:01>> but if you somehow it's like 16
- 11:05>> like when is worse it's really worse
- 11:08like 90% just I'm just curious why like
- 11:12[clears throat] have a big variation of
- 11:14how people come
- 11:16>> um I'll ask you that question back what
- 11:19do you think
- 11:21I mean this is this is your pipeline
- 11:23right
- 11:28>> where where will the variance come from
- 11:31so different contests will have
- 11:33different problem inputs
- 11:35>> maybe it's the two contests so the two
- 11:38contest they perform well if the contest
- 11:40are similar than the test
- 11:45other
- 11:48than new algorithm or new contest then
- 11:51the algorithm may fail to or struggle to
- 11:54answer because it doesn't include
- 11:57>> okay
- 11:59but I don't know if it's true
- 12:00>> so the large scale I mean so what what
- 12:04um what's your name again
- 12:08>> is asking is that why do we get variance
- 12:10across different contest ids and it does
- 12:12well in one contest and does not do well
- 12:14in another so at the end of the day you
- 12:16are depending on
- 12:19a uh how how close are these say contest
- 12:22problems how in distribution they are.
- 12:25So that's one pos pl pos pl pos pl pos
- 12:26pl pos pl pos pl pos pl pos pl pos pl
- 12:26pos pl pos pl pos pl pos pl pos pl pos
- 12:26pl pos pl pos pl pos pl pos pl pos pl
- 12:26possible hypothesis the other plausible
- 12:28hypothesis is that our [snorts] ability
- 12:30to so in the large scale sampling that
- 12:33would control like is one of the
- 12:35solutions correct but then our ability
- 12:37to select the right set of candidate
- 12:40solutions might also be affected in
- 12:41different contest ids right so the
- 12:44selection stage can also be a bottleneck
- 12:46here
- 12:48like there can be solutions that are
- 12:50almost correct but not completely
- 12:52correct
- 12:55Yes. Yes.
- 12:57Seems like a very arbitrary. Do they
- 13:00have an experiment that shows how the
- 13:02model pass through uh scales as the
- 13:06number of samples?
- 13:08>> So I think they basically went so they
- 13:10do have some experiments that they did
- 13:12but I think uh it's sort of order of
- 13:15magnitude. So with this particular model
- 13:16size and there is some results I'll show
- 13:19you. uh with this particular model size
- 13:21they had to go for much larger number of
- 13:23samples. I think if you remember from
- 13:26earlier slides on test time compute when
- 13:28you have smaller models you do have to
- 13:30go for much larger number of samples to
- 13:32get um the same passet Katur
- 13:40>> so the saturation so let's look at the
- 13:42results and then come back to that
- 13:43comment but I think on the question
- 13:45around why is it different in different
- 13:47contests I mean the inputs are different
- 13:48and then the pipeline will the selection
- 13:51stage can be a bottleneck so both of
- 13:52those influence
- 13:54where uh it does well and where it
- 13:56doesn't do well.
- 14:01[clears throat] So there is two things
- 14:03worth noticing. Uh so
- 14:06when we when we compute uh solutions
- 14:08with repetitive sampling in test time
- 14:11compute and and this is something that
- 14:12you're definitely using in homework too.
- 14:14Uh you have this notion of passet K. So
- 14:16that's the percentage of problems. So if
- 14:18you get the model to generate case
- 14:20samples and you submit all of them for
- 14:22evaluation on the hidden test uh how
- 14:25many problems will actually solve the
- 14:29problem description that was given. It
- 14:31measures how good is the search aspect
- 14:34of the sampling process. So it's
- 14:35basically coverage in the lectures that
- 14:37we covered before.
- 14:39uh what this particular um
- 14:43benchmark measures is 10 at k uh 10
- 14:46being the number of submissions that
- 14:48you're going to go submit for
- 14:49evaluation. So even if you get the model
- 14:52to output k samples in this particular
- 14:54case 1 million um you don't have the
- 14:58ability to measure correctness on all
- 15:00the samples uh for the final set of
- 15:03solutions. So you do have to do some
- 15:05selection um so or scoring to decide
- 15:08which set of solutions I'm going to
- 15:09submit. So it measures also the
- 15:11filtering process of how well the model
- 15:15will behave when you have a very large
- 15:16number of samples. So you you're not
- 15:18just generating samples but you have to
- 15:19do some search yourself before you can
- 15:21submit this solutions uh for evaluation
- 15:24to hidden tests.
- 15:26Now why does this matter? So this is
- 15:30validation set and that's test set and
- 15:32they train different model sizes. So
- 15:34this is 9B model 90 uh 41B model. So
- 15:38that's a larger model and then 41B with
- 15:40clustering.
- 15:41And uh what they're presenting is
- 15:43validation set results for
- 15:4710 at 1K. So this is the question you
- 15:49were asking me. um they're basically
- 15:52going to submit 10 solutions out of 1k
- 15:54generated outputs and then keep
- 15:57increasing that to 10k 100k and 1
- 15:59million and then they're going to do a
- 16:01similar set for test set as well. Um
- 16:06and what you will notice is that
- 16:08typically the larger model size
- 16:10consistently will do better than the
- 16:12smaller model size. I think that is
- 16:13something we have talked about before.
- 16:15Um but the other thing to notice is that
- 16:17as you go for larger number of samples
- 16:20which is something we have seen as well
- 16:22you are able to do better. So like going
- 16:24from 10 at 1K to 10 at 1 million you're
- 16:28clearly doing better and same on the
- 16:29test set side and um the clustering uh
- 16:33so typically this we we had covered this
- 16:37slide with pass at um number of samples
- 16:40uh in this particular case even
- 16:42clustering uh is consistently uh so 10
- 16:46at 1K will definitely also improve
- 16:49similar to pass at 1K and then if you
- 16:50look at the last row here which is 41B
- 16:53plus clustering. Well, you see that
- 16:55that's consistently better. So like 9B
- 16:57versus 41B versus 41B plus clustering,
- 17:00the 41B plus clustering is definitely
- 17:02going to still be better than um the one
- 17:05before because it definitely provides an
- 17:07improvement.
- 17:09And and the reason for doing that is
- 17:11because if you were to measure um the
- 17:13set of solutions that the model has
- 17:14output and you wanted to measure their
- 17:16diversity, the clustering provides you a
- 17:18way to like submit only the diverse set
- 17:20of solutions if you can only submit 10
- 17:22problems. Um and since competitive
- 17:25coding problems are quite difficult, you
- 17:27don't get much benefit out of uh
- 17:29submitting the same set of solutions uh
- 17:32to the evaluation process. So if you can
- 17:34like choose which set of uh problems to
- 17:36submit uh that helps
- 17:42and u if we were to measure um just 10
- 17:47at uh k and pass at k if you had u so
- 17:50pass at k would be unlimited attempts
- 17:52and 10 at k would be 10 attempts uh on
- 17:54evaluating per problem. On the
- 17:58x-axis you have the sampling budget and
- 18:00on the y-axis you have uh this accuracy
- 18:03in terms of um how many attempts you get
- 18:05to solve the problem. The solve rate
- 18:07definitely scales log linearly with more
- 18:09samples. So this is very much in line
- 18:11with what we had seen for pass k in
- 18:13repetitive sampling. So even after the
- 18:14selection stage we definitely see the
- 18:17same log linear trend with more samples
- 18:20and uh better models have better slopes.
- 18:22So in this particular case you see that
- 18:2441B which is the blue curve has better
- 18:27sol uh sorry the purple curve of 41B has
- 18:31better slope compared to the 300 million
- 18:33parameter model uh at the bottom and
- 18:36same applies even for passet K. And then
- 18:39the final thing is that when only 10
- 18:41samples are submitted um
- 18:45then then you do get bottleneck in
- 18:47certain ways. So you have to um you can
- 18:50get higher accuracy. So if you compare
- 18:52the y-axis 10 atk versus pass at k if
- 18:55you have unlimited attempts per problem
- 18:58uh which is a syn synthetic scenario you
- 19:01are almost getting to something above uh
- 19:0340% and here you are only getting to
- 19:0530%. So there is definitely some
- 19:07bottlenecking happening in selection
- 19:09stage. So you are bottlenecked by how
- 19:11you filter and cluster in some ways when
- 19:14you have to choose which set of
- 19:15solutions um uh will pass the tests.
- 19:21Yes,
- 19:23>> I just wondering like if this trend
- 19:25continue you really get it to another
- 19:29like another six or more like that will
- 19:32be one trade. If you really get one
- 19:33trading then the score if the tren
- 19:35continue will be kind of double. So I'm
- 19:40do you really believe like if we just
- 19:42make it one trading we can just like
- 19:45double the performance. Well, we going
- 19:48to alpha code 2. Making the model better
- 19:50is a slightly easier access than scaling
- 19:52the number of samples that you're going
- 19:54after. So on alpha code 2, uh the model
- 19:58performance improves and that helps you
- 20:00reduce the number of samples to get the
- 20:02same performance or at 1 million you'll
- 20:03get a much better performance. So this
- 20:05is uh an older model but it's a weaker
- 20:08model but the trends generally hold
- 20:12>> and and and in some ways um there's a
- 20:16I mean the larger models have done
- 20:18better generally speaking but there's a
- 20:20model capability gap so if the base
- 20:22models are not strong enough they're
- 20:24going to hit limits at certain point
- 20:28>> if you really have no problem
- 20:30so you really become of the in numbers.
- 20:34You can just really do one one tree
- 20:38sample with this graph like
- 20:40>> if this if the log line trend continues
- 20:42then yes that might be a project idea
- 20:45worth exploring if the costs are not
- 20:48prohibitive.
- 20:54>> Yes,
- 20:54>> I just want to say I think that could be
- 20:56really useful if you think that one
- 20:58problem is really important. you can
- 20:59just pour your
- 21:01>> on your computer solving that problem.
- 21:06>> I think the challenge with that which is
- 21:08something that is work um also that's a
- 21:11good comment. So one of the challenges
- 21:14with um solving it that ways is that you
- 21:16kind of assume that if we sample more
- 21:18the diversity continues to increase.
- 21:22One of the challenges that we will see
- 21:23in alpha code 2 and I'll emphasize again
- 21:25is that you do have to ensure that as
- 21:28you sample more and more you are getting
- 21:30more diverse solutions and part of the
- 21:32process of clustering is that it's
- 21:33effectively figuring out which are the
- 21:36diverse set of solutions. So if you
- 21:38sample 10x more than what was sampled
- 21:40here but you don't end up with more
- 21:42diverse solutions then you're actually
- 21:43not going to improve.
- 21:46>> Is there a reason why we have a long
- 21:48linear relationship here? Why why is it
- 21:51not any other um modeling of wiverse
- 21:54text?
- 21:55>> So this was covered earlier I think the
- 21:57um passet K versus unlimited attempts
- 22:00this is uh theoretically derable and I
- 22:03think the main thing that I'm
- 22:05emphasizing is that even after the
- 22:06selection phase that log linear trend
- 22:08holds
- 22:10um the passet K versus sample budget
- 22:12this was covered in um I don't know the
- 22:14lecture number but Aalia covered this
- 22:16and that paper actually theoretically
- 22:18derives it. This is the large language
- 22:21monkeys paper or the one right after
- 22:23that. Yeah, but if you look at the
- 22:26derivation uh we can work through that
- 22:28offline.
- 22:33Um
- 22:36okay so if we look at takeaways I think
- 22:39the fun aspect here is that um we can
- 22:42get high coverage
- 22:45by sampling and then so this large scale
- 22:47sampling this filtering and the
- 22:48clustering approach you can get higher
- 22:50coverage um and um they were able to
- 22:55actually also make sure that the model
- 22:57is not just copying existing solutions
- 22:59it actually reasons. So they did some
- 23:00search over the training data and
- 23:02actually saw that u there was the
- 23:04generated code was had some novelty. So
- 23:07this was actually generalization out of
- 23:09distribution. Um the challenge with
- 23:11these particular set of approach that
- 23:13they noticed that's worth highlighting
- 23:14is that they were training the model on
- 23:16loss and loss is often a poor proxy for
- 23:19solve rates. So because um there are
- 23:22many solutions that could have solved
- 23:23the problem. So they did see that it
- 23:25this model did not do well on uh say
- 23:28dynamic programming or constructive
- 23:29algorithms uh in some ways. So it was
- 23:32not the strong in certain uh domains.
- 23:35And then the other aspect was that it
- 23:37was requiring a large scale set of
- 23:39sampling. So that was not ideal in terms
- 23:42of like how practical this was to be
- 23:44used u everywhere.
- 23:48Um if there was a time bound then um you
- 23:53can imagine uh so if you if you
- 23:54basically was just uh examining accuracy
- 23:57then you want to make unlimited attempts
- 23:59but if you want to do uh like time
- 24:02limited bound in terms of efficiency
- 24:04then you do want to like rank acceptable
- 24:06solutions as they get generated. So that
- 24:08becomes really important and um
- 24:12as I already mentioned that more
- 24:14difficult domains um required more
- 24:16experiments. So this was not like they
- 24:18the this solution approach actually
- 24:20wasn't working well on difficult
- 24:21problems and um in fact there it's both
- 24:25a matter of like you might need more
- 24:27steps to solve the problem. So this
- 24:29particular approach in one shot did not
- 24:31do a reasonably strong job. So
- 24:32multi-step um solution approaches would
- 24:35do better here.
- 24:38So this was alpha code um summary. Now
- 24:41let's see what can we do better. So this
- 24:43was like 2022. If you look at the next
- 24:46set of paper which is alpha code 2, they
- 24:49improved upon this substantially and and
- 24:51that was really helpful and we can also
- 24:54learn um what were the differences uh
- 24:57and that really helps us understand what
- 24:59pushes the frontier even further. So
- 25:01alpha code 2 started with a hypothesis
- 25:04of what if you don't uh pre-train your
- 25:06model you use an existing LLM. So in
- 25:08this particular case this work was at
- 25:10Google. So they decided to use Gemini
- 25:12Pro um instead of like using
- 25:16in uh training their own model and then
- 25:19they want to customize it to get uh
- 25:21better performance on this particular
- 25:23problem set on co uh competitive
- 25:25programming.
- 25:27So the first set of changes that were
- 25:28made were that instead of pre-training
- 25:31you basically are just going to
- 25:32fine-tune Gemini Pro. So it's not just
- 25:34prompting they are fine-tuning the
- 25:36model. And then um in terms of sampling
- 25:39and evaluation for the large scale
- 25:41sampling they want to ensure diversity.
- 25:43So for diversity they actually had
- 25:45multiple alpha code 2 models that allow
- 25:48for massive sampling. So when they did
- 25:50and uh go and do fine-tuning they
- 25:52actually had multiple variants of this
- 25:55model so that they get diversity in the
- 25:57output sampling. And then the third
- 25:59thing they did was that to select the
- 26:02subset of candidates they had a scoring
- 26:04model. So you can see that as a reward
- 26:07model um which was used for obtaining
- 26:10the best candidates. So it's not just
- 26:12based on clustering and filtering which
- 26:14is a heristic for saying okay this would
- 26:16be semantically equ u semantically
- 26:20equivalent but like there's diversity in
- 26:23in syntax. They are actually now going
- 26:26for a scoring function which can like
- 26:28learn that function. So it's a learned
- 26:30approximation of what should be given
- 26:31high score and what should be given a
- 26:33low score.
- 26:36So um the new ideas here as I
- 26:40highlighted was a that they are going to
- 26:42fine-tune a Gemini Pro model to score
- 26:45correctness before submitting. So that's
- 26:47a reward model and they also had a
- 26:49family of models based on different
- 26:51hyperparameters. So different difficulty
- 26:53levels, different tags. Um so they
- 26:56fine-tune several models with varied
- 26:57hyperparameters and then that maximizes
- 26:59the diversity of the number of samples
- 27:01they generate and they also improve
- 27:04their data sets. So the data set that
- 27:06they fine-tune on is a V2 version of
- 27:09code contest which is actually open
- 27:10source and then they had another high
- 27:12quality data set for scoring purposes.
- 27:16So going back to this diagram um what
- 27:21changes next? So let's take a more
- 27:23detailed look. So here if you look at um
- 27:27the input model on the finetuning stage
- 27:30you have this new data set called code
- 27:32contest v2 um which is going to be used
- 27:36to um generate now you're going to do
- 27:39some tagging. So there's some amount of
- 27:40just like take your code contest v2 data
- 27:43set and put uh bisect it or rather
- 27:46segment it into different data sets to
- 27:48fine-tune different versions of uh
- 27:51models that are going to generate
- 27:52samples. So that's one set of like
- 27:54intermediate alpha code 2 models that
- 27:56they will uh generate. And then they had
- 27:58another high quality data set they're
- 28:00going to use to make this even better.
- 28:02And this same set of model uh same set
- 28:05of data will also be used to generate a
- 28:07scoring model from from the same model.
- 28:10And based on that they're going to uh so
- 28:12this is basically a notion of like
- 28:15there's a the data set is segmented and
- 28:18used to tune multiple uh models uh based
- 28:21to get more diverse samples.
- 28:24Uh what's different about the data set
- 28:26is that the problems and solutions are
- 28:29higher quality and vetted and scored
- 28:32better and the scoring model is able to
- 28:36um estimate the correctness of the code
- 28:37sample between zero and one based on
- 28:39this higher quality data set. So they
- 28:41manually curated um this data set uh got
- 28:46uh more human annotators in place so
- 28:48that they could uh train the model to
- 28:51estimate correctness better.
- 28:54And then the other aspect is that they
- 28:56had this family of models. Uh instead of
- 28:58having just one model. Now on the
- 29:01sampling and evaluation side,
- 29:06they split the sampling across models.
- 29:08They in fact went to only C++. Earlier
- 29:10it was C++ and Python half samples. So
- 29:13they split the sampling across models
- 29:14but only C++. And uh when they generate
- 29:18the samples, they're randomizing the
- 29:20temperature and the metadata so that
- 29:22they can get diverse outputs. So this is
- 29:24uh this is the massive sampling
- 29:26pipeline. For each output, they're going
- 29:28to execute on test input and they are
- 29:30filtering out anything that's incorrect
- 29:32and or doesn't compile. So they remove
- 29:3495% of the samples. Uh at this point,
- 29:37they're left with about 50k samples. And
- 29:40then after that pro process they're
- 29:42going to aggregate um and keep the top
- 29:4510 largest clusters. There's reranking
- 29:48on top of that uh based on the scoring
- 29:50model to say like how likely is it to be
- 29:53correct. So they score each code sample
- 29:56uh and pick the best candidate per
- 29:57cluster and once they have that that's
- 30:00when they're going to submit and say
- 30:01that did it win or did it not win. The
- 30:04eval is going to be same as alpha code.
- 30:07So if we are to compare results now uh
- 30:10this is uh comparing alpha code 2 versus
- 30:13alpha code. So alpha code so on the
- 30:16x-axis you see the sampling budget. Uh
- 30:19alpha code we were doing 1 million
- 30:20samples. Uh here we're going to vary the
- 30:23sampling budget per problem. And on the
- 30:25y-axis you have solve rate.
- 30:28Um as you can see that once you get to
- 30:31100 samples you basically so alpha code
- 30:35was using 1 million samples for alpha
- 30:36code 2 once you get to uh 100 samples
- 30:39you are achieving the same solve rate as
- 30:42u alpha code and uh if you want to go
- 30:45beyond that you can use more samples. So
- 30:48the solve rate is still improving with
- 30:49the increase in sampling budget. And if
- 30:51you were to basically say how many what
- 30:54is the maximum performance achieved um
- 30:56alpha code 2 with u 1 million samples
- 30:59was solving 43% it was getting 43% solve
- 31:02rate while alpha code was only getting
- 31:0425%. So um in this particular case even
- 31:09though they're uh using the same number
- 31:11of samples a better base model better
- 31:13diverse solutions and then a better
- 31:15scoring is giving them so this whole
- 31:17system is giving them performance gains
- 31:19which is almost um 2x relative to where
- 31:23the previous system was
- 31:28questions.
- 31:32Yes.
- 31:3495% of um sampling wasted on not
- 31:38compiling or poor answer seems like a
- 31:42very high cost. Were there any other uh
- 31:44studies to see if there could be better
- 31:46methods of sampling more reliable
- 31:48answers maybe by like better prompting
- 31:50or I mean like it did mention randomized
- 31:53temperature but were there any other um
- 31:56approaches?
- 31:57So in this particular case, this paper
- 31:59did not.
- 32:00>> But if you are to refer to some of the
- 32:02work that we have discussed before, what
- 32:04would you need to do to
- 32:07>> to improve that?
- 32:09>> This is an older piece of work, right?
- 32:11>> Yes.
- 32:12I would I would um try the approaches we
- 32:15took in homework.
- 32:18uh like
- 32:19>> like um better prompting or uh better
- 32:23maybe using instead of like wasting all
- 32:25of the compute on 1 million um sampling
- 32:28maybe I would try to self iterate based
- 32:30on one of the sampling at least once or
- 32:32maybe at least try to have a better
- 32:34method of aggregating some of the
- 32:36information from the various sampling
- 32:38>> right so I think what you're saying uh
- 32:40so just to repeat the answer in homework
- 32:44one you had done some form of
- 32:45self-refinement so this is essenti
- 32:47potentially parallel search in some ways
- 32:49you've generated a lot of solutions and
- 32:50then you are clustering on top of that
- 32:53if you do a refinement process where you
- 32:56have generated some solutions and then
- 32:57you're saying okay if I can get any
- 32:59feedback on top then can I improve these
- 33:01solutions better that's one approach
- 33:03that would like cut down the number of
- 33:04samples but like increase the time that
- 33:06you if you can collect any feedback um
- 33:10the question I would ask is that how
- 33:11would you collect feedback like what
- 33:13would be feedback in this particular
- 33:14case that's worth knowing
- 33:16thinking through. I think the other
- 33:19comment would be that if you can get the
- 33:22model to do slightly better with RL. So
- 33:24like if it can get better at solving uh
- 33:26things um
- 33:28with the RL loop in in between when we
- 33:31cover train time scaling then that can
- 33:33help cut down how much we need to put in
- 33:35test time. So both those approaches can
- 33:38like reduce the cost on the sampling
- 33:40side.
- 33:46Let's try that one.
- 33:48>> So, so when it comes to practical
- 33:51applications, so so when we are using
- 33:53everyday kind of thinking models, we are
- 33:56still talking about couple of dozens of
- 33:58samples, right? I mean when it comes to
- 34:00time scale and and then we hear about
- 34:03this uh open AI 20k per month researcher
- 34:08those are the multi,000 multihundreds of
- 34:12ks of samples uh applied uh in
- 34:16production. So I think the nature look
- 34:19system is more of how you would build
- 34:21the system that is generating those
- 34:23dozen of samples right I think we have
- 34:26discussed this before um for us to think
- 34:30about these systems I think the big
- 34:31question you're as asking is
- 34:36how would you build the system to begin
- 34:38with that can reason well that can close
- 34:40the loop so I think there is a line of
- 34:42research which has tried to answer that
- 34:44question and what this is covering is
- 34:46that if you started with an LLM and you
- 34:49wanted to solve these complex problems,
- 34:51how would you build a system that can
- 34:53solve that problem? And then if you can
- 34:54distill all of that knowledge into a
- 34:56single model, then that becomes a large
- 34:58reasoning model.
- 35:00But this is a more of a
- 35:02um multi- uh multi- aent system in
- 35:05almost some ways where you're basically
- 35:07having one model produce outputs and
- 35:09then another model score it. And then
- 35:12here a family of models is producing
- 35:14outputs and then there is another family
- 35:15of models that's scoring it. So that
- 35:18gives you more tricks up your sleeve if
- 35:20you had to like rearchitect the system
- 35:22from scratch as opposed to depending on
- 35:25what the current generation of models
- 35:26can or cannot do. And the paradigm I
- 35:30believe because at the end of the day
- 35:32when we are saying in test time compute
- 35:34there should be a solution in the space
- 35:36of what model app was generated. Um the
- 35:39paradigm is effectively that you should
- 35:40be able to search that solution. So what
- 35:42this is roughly answering is how would
- 35:45you search for a solution
- 35:47in the output space of what models
- 35:50output?
- 35:55>> Still a question. Yes.
- 35:57So why the screen model? Yeah.
- 36:03>> Say that again.
- 36:04>> Why is the screen model?
- 36:10Why is it like why the scoring model
- 36:12only desire?
- 36:15>> So I think the way to recall it is that
- 36:17why is the scoring model not using code
- 36:19contest v2? I mean you can train your so
- 36:22the code conscious B2 there would be
- 36:24contamination right the scoring model
- 36:27should not see exactly the same data but
- 36:29it does need to see some data in the
- 36:30distribution right
- 36:33it's it's basically a matter of you're
- 36:35training the scoring model not
- 36:37necessarily on the same problems but you
- 36:38want to if if you're designing that
- 36:41system from scratch how would you train
- 36:42a reward model what you want to show it
- 36:44is that for this kind of problems if you
- 36:46had these two solutions which solution
- 36:47should you prefer
- 36:50That's what you're teaching the scoring
- 36:52model or how what ranking should you
- 36:54apply to that
- 36:57you post train by the first design.
- 37:02>> Mhm.
- 37:03>> It's the same
- 37:05data set.
- 37:09>> Um
- 37:11I mean you could have mixed those data
- 37:13sets and then then done the same thing.
- 37:15Yes. But that that is a doable exercise.
- 37:18It's just multi-stage.
- 37:21The it's not the same in the sense that
- 37:24um uh when you do any kind of fine
- 37:26tuning, if you're changing the quality,
- 37:28then the model and if you're not mixing
- 37:30the previous version, then the model is
- 37:32forgetting some of the previous
- 37:34information when it's tuning the in the
- 37:36last stage.
- 37:39Okay.
- 37:46So if you were to look at the aggregate
- 37:48results of alpha code 2 in terms of the
- 37:51normalized score versus the um how it
- 37:55would compare to human contestants
- 37:58there. Uh and the way you would do that
- 38:00is you would basically compare the
- 38:02percentile of contestants who score um
- 38:04at a certain level. Um what alpha code 2
- 38:07was uh achieving is 85th percentile
- 38:10between the expert and the candidate um
- 38:13the master candidate solutions while the
- 38:15human u and and it was outper like while
- 38:18alpha code was outperforming 46% alpha
- 38:21code 2 if you took two top two
- 38:24performance on the like if you took two
- 38:26top two solutions then it was actually
- 38:27outperforming 99.5%
- 38:30but overall it was basically scoring
- 38:32closer to 85th percentile across human
- 38:35contestants. So that was a big deal. It
- 38:36was like okay in this particular code
- 38:38contest problems in this competitive
- 38:40programming it's doing very well in some
- 38:43way. So that was a big accomplishment in
- 38:45in one single year uh just uh with an
- 38:48improved system
- 38:51and I think uh for us what's worth
- 38:54learning here is that we are increasing
- 38:56the performance with less number of
- 38:58samples. So we didn't have to like
- 38:59necessarily scale the number of samples
- 39:02but we had like better foundation model
- 39:04and then the scoring model that is
- 39:06selecting the best candidate is also
- 39:08helping uh the solution. The
- 39:10experimentation is still quite costly
- 39:12and then as uh one of our uh classmates
- 39:15pointed out this is very specific to
- 39:17code and then a lot of the computers
- 39:19wasted and generating samples that might
- 39:21have bad syntax and so on that you have
- 39:24to go and filter out. So one set of
- 39:27questions that I have for the class at
- 39:29this point in time is that
- 39:33how would you uh change these methods
- 39:35based on task complexity for example.
- 39:39So actually I will pose that question
- 39:41and then the other question I will pose
- 39:44is um how can we embed reasoning
- 39:46directly into these models?
- 39:48take a minute to like talk to folks next
- 39:51to you or
- 39:53somewhere in the vicinity and then uh
- 39:55let's come back and discuss those two
- 39:57questions.
- 40:01>> Let's tackle the second question. So um
- 40:04how can we change these methods based on
- 40:05task complexity? So if I easy problems
- 40:08versus hard problems,
- 40:10any takers for that?
- 40:20Okay.
- 40:21>> What you could do is uh you have like a
- 40:22separate model that actually kind of
- 40:25like judge each question based off it
- 40:27being like easy, medium or hard. You
- 40:30create like your data set where you're
- 40:31sampling from also has those labels and
- 40:34you just if you declare a question easy,
- 40:35you sample more from the easy bank. So
- 40:38it's like it's a better sample.
- 40:41>> Okay. So is it more on the training side
- 40:43you will change or is it more on the
- 40:45sampling side that you will make this
- 40:46change more?
- 40:52>> Okay. So you're saying that um if you
- 40:56have a simpler problem then you will uh
- 40:59sample more from um
- 41:02>> simple problems.
- 41:03>> Okay. So you in alpha code 2 basically
- 41:07you will use the model that's trained on
- 41:09perhaps simpler problems. Is that the
- 41:10suggestion? Okay.
- 41:13>> Um other ideas
- 41:19the sol did improve with model size
- 41:22that's
- 41:30or if you if you can identify simpler
- 41:33problem maybe we can you can you can run
- 41:35with less samples.
- 41:37>> Yes. Exactly. Right. Oberve the model.
- 41:42So this is something that was probably
- 41:43seen in the repetitive sampling and the
- 41:45test time compute as well as to like if
- 41:46you have simpler problems then it's
- 41:48likely that you can get coverage with
- 41:50fewer number of samples. So you don't
- 41:52have to go to 1 million samples every
- 41:54single time. It's almost like saying the
- 41:56model does is more likely to generate
- 41:59the solution in the search space of what
- 42:00it outputs.
- 42:03So it should be easier to like sample
- 42:06uh or or it's initial set of solutions
- 42:10with some iteration with some iterative
- 42:13refinement should be easier to correct
- 42:15as opposed to like having to generate a
- 42:17lot of different solutions. One of the
- 42:19gains that you get if you generate a a
- 42:21lot of parallel solutions is that you're
- 42:24trying to get the model to provide
- 42:26diversity in the approaches and you're
- 42:29not trying to get it to like fix what it
- 42:31already output.
- 42:35What about the question four? How can we
- 42:37embed reasoning directly into the model?
- 42:44>> Okay, let's try out.
- 42:45>> I think one way is that maybe you can do
- 42:47more on the train set like in the train
- 42:49set you can take all take all the
- 42:52comment of you enough problems. So you
- 42:55know in the step one like how it feels
- 42:58like the framework of the solution like
- 43:00in step one we know is a program the
- 43:03problem so we
- 43:06step okay slightly different than the
- 43:08standard program so we need to change a
- 43:12little bit so we have the final solution
- 43:15the final solution
- 43:16>> okay
- 43:17>> so if we don't have enough common data
- 43:19then we use llm to kind of pass the code
- 43:23like to See the first section is about
- 43:26what is the second section
- 43:28for so it's the training they have is so
- 43:31that part of the training but they have
- 43:33is only the three like the second one
- 43:35that
- 43:37repeat
- 43:39that's basically
- 43:41>> okay uh so what he's roughly saying is
- 43:43that you add hints in your training data
- 43:46set around the solution of like what
- 43:48kind of algorithm is being used to solve
- 43:49the problem what's a more generic
- 43:51version of that what have we covered in
- 43:54that line of work.
- 43:59As programmers, you think before you
- 44:02write the answer. What if that thinking
- 44:04could be captured?
- 44:08If you added those chain of thought as
- 44:10part of your training set or if you
- 44:13remember the star approach where you're
- 44:15getting the model to generate the
- 44:17solution and then like give the hint as
- 44:19the answer and then ask it to come up
- 44:21with that reasoning then that that can
- 44:23also be part of like how the model
- 44:25embeds it. Right.
- 44:31Any other ideas?
- 44:35I think the other interesting thing that
- 44:37was mentioned which is probably worth
- 44:39highlighting is that if you have a more
- 44:41complex problem then you might want to
- 44:43decompose the problem into subp parts
- 44:46and add hints for subp parts as opposed
- 44:49to trying to solve the problem in one go
- 44:52because these are hard problems.
- 44:57>> Yes.
- 44:58you tackle that for products that are
- 45:00not like that sequential like maybe you
- 45:02get like a you succeed on the first
- 45:04intermediate output
- 45:07>> has something flawed that is never going
- 45:08to make the second part work.
- 45:10>> So how does that sequential or like how
- 45:13do you compose that work?
- 45:15So I think the I think all of these are
- 45:18hinting at like we do need to close the
- 45:20loop at some point in a multi-step
- 45:22fashion and almost want like a tree
- 45:24search style of solution where you
- 45:26basically want did I
- 45:29I basically sample for say the first
- 45:31step and is that roughly correct and you
- 45:33want to sample for the second step and
- 45:34then you want to be able to backtrack.
- 45:36So it's roughly heading in that
- 45:38direction but it's kind of um
- 45:42early work that gives you hints. So it
- 45:44it's basically gotten your thinking and
- 45:46then perhaps that's your project right
- 45:48but but your question is very relevant
- 45:50as to like what happens if your answer
- 45:54is correct in the first step but then
- 45:55the next step is not correct
- 45:59and um the task decomposition is often
- 46:02relevant in that most problems have a
- 46:05certain way of solving. So if there's
- 46:07common abstracted patterns then that's
- 46:08doable. But if you do expect patterns
- 46:10that are out of distribution then maybe
- 46:14uh you do need human in the loop
- 46:18that's like AI scientist style of work
- 46:20that folks covered last lecture.
- 46:31Okay.
- 46:32Okay. Let's come to the last part. Uh so
- 46:35we spent a lot of time on just um code
- 46:38uh and how to how to select uh set of
- 46:42code samples that you can um that can
- 46:45pass and and and um solve competitive
- 46:48coding problems. Now let's look at how
- 46:51would you do something like building a
- 46:53deep research agent. Uh so search is
- 46:56basically going to use large reasoning
- 46:58models as the base and then try to build
- 47:01uh deep research agents on top of that.
- 47:03And um it's worth paying attention
- 47:05because you will use this in homework 3.
- 47:08So the key idea here is that you want to
- 47:11use large reasoning models to retrieve
- 47:13based on a query that you want to give
- 47:15the model. So large reasoning models uh
- 47:19have impressive reasoning but as you
- 47:21know that most of these models are
- 47:22trained on with some knowledge cut off
- 47:24dates. So they typically will not have
- 47:27the freshest knowledge. If something
- 47:28happened yesterday, the model will need
- 47:31to go look up that data. it's not going
- 47:32to be there in the model.
- 47:36The other challenge when you work with
- 47:38reasoning models per se uh is that uh
- 47:41they will go and output a lot of tokens
- 47:43in long form reasoning but when they
- 47:44have knowledge gaps they will be um
- 47:47using terms that are um expressing
- 47:50uncertainty. So one example is that if
- 47:52you go use G u benchmark on GPQA data
- 47:56set you will see uh the term perhaps in
- 47:59the reasoning chains a lot or you will
- 48:01see the term alternatively or wait or
- 48:06so they're basically expressing that the
- 48:08knowledge gaps will show up as
- 48:10uncertaintity in the way the model is
- 48:12thinking. So you want to bootstrap that
- 48:15u in some way because otherwise those
- 48:17knowledge gaps will continue to
- 48:18propagate through the entire reasoning
- 48:20chain.
- 48:21Now one simple solution based on
- 48:23learning from feedback or learning from
- 48:25tool calls is that why don't we just
- 48:27like take this query and get a relevant
- 48:31document. Um so you take this query pass
- 48:34it to a search tool and get the relevant
- 48:36document. Um and then put that document
- 48:38in the prompt and then out get the model
- 48:41to output based on that. Why is that not
- 48:43enough? So that would be more like
- 48:45retrieval augmented generation. So
- 48:48whatever is your question, you generate
- 48:51a query and you get a document and you
- 48:53put it in the prompt and then that's
- 48:55what you use to uh retrieve the answer.
- 48:58Now the challenge with uh that sort of
- 49:00simple approach is that you retrieve
- 49:03once at the beginning. So you don't have
- 49:05the ability to like tweak things and
- 49:07it's possible that if your search
- 49:09problem is complex enough then each
- 49:12reasoning step will need different piece
- 49:14of information. So if you have a problem
- 49:17which is asking just the weather then
- 49:19maybe a single search call is enough.
- 49:21But if you're asking to solve a complex
- 49:23problem which has multiple parts uh to
- 49:25solving it then after it gets through a
- 49:27certain amount of reasoning it needs to
- 49:29go look up additional information. So
- 49:31for complex reasoning it's extremely
- 49:33hard to get it right and same for
- 49:34multi-step reasoning. So typically uh
- 49:37retrieval augmented generation will uh
- 49:40will improve uh will show improvement
- 49:42over direct reasoning but in multi-step
- 49:44reasoning it definitely suffers.
- 49:46So the solution that search and proposes
- 49:49is that the model generates the queries
- 49:53um on the go. Uh so whenever it sees
- 49:56these knowledge gaps it will trigger a
- 49:58query. It will generate a search query
- 50:00of uh what what tool calls to uh
- 50:04generate and go search things over and
- 50:07there will be multiple iterations in a
- 50:09single reasoning session of like
- 50:11fetching these documents. And the second
- 50:13thing it will do differently and I will
- 50:15show examples of that is that it will
- 50:17analyze the retrieved documents. So
- 50:19instead of just dumping what it
- 50:21retrieved as the document, it will
- 50:23analyze the retrieved document and
- 50:24extract relevant chunks of information
- 50:26from there.
- 50:28and um it will only put these relevant
- 50:32information into the prompt so that it
- 50:35integrates well into the reasoning
- 50:38chain.
- 50:40So uh just to reiterate how this works.
- 50:44So this is an original question which is
- 50:46a chemistry question which is talking
- 50:47about uh it wants to get the carbon
- 50:50atoms count of product three which is
- 50:53output of a bunch of different chemical
- 50:55reactions. So if you were to use a large
- 50:58reasoning model um you will ask the
- 51:00model to start thinking it looks at this
- 51:02term which I don't understand and
- 51:04perhaps the model doesn't understand. So
- 51:06it will go ask a look up what does it
- 51:09mean? Now one trick is that it doesn't
- 51:12go look up. So it makes a guess and
- 51:14comes up with whatever is in its
- 51:15knowledge base in the store weights and
- 51:18provides a final answer based on what it
- 51:20guessed. But if there is a guess here
- 51:23and it got the answer wrong then those
- 51:25things will cascade as errors into
- 51:27whatever is the final answer. So all the
- 51:29perhaps or all the uncertainty will
- 51:31basically cascade into the final answer.
- 51:33So your certainty for the final answer
- 51:34is low.
- 51:37Now one possibility is that you
- 51:38basically whenever you encounter
- 51:40unfamiliar knowledge you can now do web
- 51:42searches. So that would be a simple uh
- 51:44scenario of like okay unfamiliar term
- 51:47basically go and do a tool call for
- 51:49search return the document uh that
- 51:52basically has that search tool for
- 51:55perhaps there's a Wikipedia page or
- 51:56there's a web page that has that
- 51:58information and put that in the
- 52:00reasoning chain and now like do the put
- 52:03that in the prompt and then do the call
- 52:04again and then provide the final answer
- 52:07based on that. The only challenge with
- 52:09this is that as you basically increase
- 52:12your uh amount of content you're putting
- 52:14there, there might be not as much
- 52:16relevant content and these documents
- 52:18like if you went and fetched like 10
- 52:21documents that were related to the
- 52:22information. Uh there's too much
- 52:24information for the model to process. So
- 52:26it might actually not still give the
- 52:28correct answer. So in this particular
- 52:29case, it was like 10 carbon atoms and
- 52:32product three. Here's like 14 carbon
- 52:34atoms. I still got it wrong.
- 52:38What search oven is proposing is that
- 52:40now you have uh whenever you get the
- 52:42unfamiliar knowledge it will uh go and
- 52:46search for helpful information. So
- 52:47that's still a tool call to your search
- 52:50but then um it will reason within the
- 52:53documents. So it will try to look at
- 52:55these documents and see if this is
- 52:57helpful information or not. extract the
- 52:59relevant content and then put it back in
- 53:02the reason um in the next prompt like
- 53:04what is the relevant chunk of
- 53:05information to put and that will allow
- 53:08the model to continue coherent reasoning
- 53:10and provide the final answer here. So in
- 53:12this particular case basically the the
- 53:14ability to do this summarization of
- 53:17information or reason within the
- 53:18document uh really improves the quality
- 53:21of like how it gets to the final answer
- 53:23instead of like clustering the [snorts]
- 53:24prompt with like 10 documents or 20
- 53:27documents.
- 53:29Um questions on uh what's the difference
- 53:31between the three approaches?
- 53:37>> Yes. Why does it say in the first one it
- 53:40says oh perhaps gas why this little one
- 53:44doesn't say anything because it's being
- 53:47given the information right so the
- 53:48uncertainity has reduced it is actually
- 53:51being it's not even saying that in the
- 53:53middle one which because it's being
- 53:55given the right information in the
- 53:56prompt
- 53:59I think the harder part is how does it
- 54:01know what to search for
- 54:05it needs to know which keywords it does
- 54:07not No,
- 54:12like that that's the question I would
- 54:13ask.
- 54:15>> Yeah, it's a miser.
- 54:17>> The answer is I think you basically need
- 54:19to uh break down what are the key. So
- 54:22there is different ways to tackle that
- 54:24question, right? um if you're building a
- 54:27real application, you want to identify
- 54:29which parts um
- 54:32you don't want to rely on the knowledge
- 54:33base of the LM and you actually do want
- 54:35to do a tool call because that
- 54:37information is likely not what you want
- 54:39to trust the weights of the LM for.
- 54:43It's almost like you're finding the key
- 54:45entities in your um question and
- 54:49fetching information on those.
- 54:59Okay. So there were two things that we
- 55:02are covering here. So one is the agentic
- 55:03rag and one is search. So I'll cover
- 55:06both uh here. Uh let's first understand
- 55:08agentic rack because then we build on
- 55:10top of that in the the search forward
- 55:12process. In agentic rack what you're
- 55:14doing is you're basically every time you
- 55:17are hitting um entities that uh you care
- 55:20about you're basically going to insert
- 55:23special tokens where you are going to
- 55:24trigger a search and then when you get
- 55:26that document you're going to insert
- 55:28those results. So uh model is generating
- 55:31some output tokens. when it's seeing
- 55:33certain amount of uncertainty in its
- 55:35output tokens, it's generating these
- 55:36search queries between the special
- 55:38tokens and based on that it goes and
- 55:40does the tool call and the uh retrieval
- 55:43tool will essentially return those
- 55:45documents which will then be inserted
- 55:46into the reasoning chain. So this is
- 55:48happening in large reasoning models as
- 55:50part of the whole reasoning process of
- 55:52like it's also calling tools as part of
- 55:54the reasoning process. Um so
- 55:58that's one way to solve it. Um, but the
- 56:02documents can be lengthy and they can
- 56:04contain noise and oftentimes depending
- 56:06on how good the long context
- 56:08understanding and reasoning of the model
- 56:09is, they might actually like if you put
- 56:1110 or 20 documents, it might actually
- 56:13not be able to do a good job at
- 56:15reasoning over them. So uh the reason in
- 56:18documents module of search 01 will allow
- 56:20you to do analysis of each of the
- 56:22documents of like how relevant the
- 56:24content is and then it considers the
- 56:26current query what it was reasoning
- 56:29previously plus like this chunk of
- 56:31information that it extracted and um
- 56:34appends that to the prompt to allow the
- 56:37model to continue reasoning based on
- 56:38that. So it's essentially a multi-step
- 56:41process within that retrieval tool
- 56:44function itself because it's basically
- 56:46getting that document information but
- 56:47then also doing an extraction process on
- 56:49top of that. It's it's almost like as
- 56:52humans you don't want to just like go
- 56:53and curate all the possible references.
- 56:56You also want to take notes on those
- 56:57references so that you have some way of
- 56:59like um doing a better job understanding
- 57:02and synthesizing that information. And
- 57:04this allows the model to do um better
- 57:07job at reasoning when we are adding
- 57:09external knowledge and especially for
- 57:11complex queries this becomes quite
- 57:13important. Yes.
- 57:15>> How does it previous reasoning and if
- 57:18there's any corrections needed for the
- 57:20previous reasoning how does it handle
- 57:22corrections? So there is an assumption
- 57:25that there is a state or there's a
- 57:27memory buffer that's keeping that
- 57:31uh it's not obvious in the way this is
- 57:33structured but there's a basically some
- 57:34form of like notion of like this is the
- 57:37search query I'm trying to answer this
- 57:39is and some buffer of like where is the
- 57:42previous reasoning and so on.
- 57:44>> Yeah.
- 57:46Yes,
- 57:48>> just add new in the engine direct module
- 57:53on top of that you just like ask the
- 57:55model to do some summation and then
- 57:58continue reasoning. So does that like um
- 58:02directly um transfer to the second style
- 58:07like u
- 58:09I mean like does this directly mix
- 58:13method to be the be the new method
- 58:15proposing
- 58:17>> say that again you can just pick up
- 58:21>> um I mean like if you just like modify
- 58:23the prompt in the agent take module like
- 58:27you ask the model to do some summation
- 58:29and then and then continue the reasoning
- 58:32does that produce the same um results of
- 58:36wasting results.
- 58:38>> So I think that's a great question and I
- 58:40would encourage you folks to actually
- 58:41try that out in homework three. I think
- 58:43the assumption there is that if you were
- 58:45to issue that prompt um you are assuming
- 58:49that the the context length of the model
- 58:51and the reasoning over that context
- 58:53length is working really well. This is
- 58:56basically agentic context engineering
- 58:58style paper. So it's basically there's a
- 59:00recent paper called agentic context
- 59:02engineering. So essentially the
- 59:04limitation here is coming from what can
- 59:06you put in context length that the model
- 59:08is going to do a really good job at.
- 59:13In ideal world we will want that.
- 59:16That's that's where we want to shoot and
- 59:18hopefully by the end of the year that's
- 59:19where we will be.
- 59:22Okay. So let's to look at uh let's look
- 59:24at the examples. So we were covering
- 59:26this example of like carbon atom count
- 59:28in product three based on a bunch of
- 59:29different chemical reactions. In vanilla
- 59:32reasoning the challenge was that it was
- 59:34guessing the structure. So it definitely
- 59:36got wrong answer in agentic rag because
- 59:38you were um just retrieving the
- 59:40documents they ended up being too
- 59:41lengthy. So it did disrupt the
- 59:43reasoning. uh in search process it did
- 59:47uh search for this particular um formula
- 59:50and then it refined it to a certain
- 59:52structure and then that integrated
- 59:54cleanly into reasoning. So essentially
- 59:56the notion of like um extracting the
- 59:59right information from the documents
- 1:00:00really helps um search over and get to
- 1:00:03the correct answer in this particular
- 1:00:04case.
- 1:00:07Now if you were to like go beyond the
- 1:00:08example to results what we're plotting
- 1:00:10is different domains physics chemistry
- 1:00:12biology and overall um and you're
- 1:00:15plotting pass at one on um
- 1:00:19y-axis and then you're plotting the
- 1:00:22number of documents that you get on
- 1:00:24x-axis. So typically as you increase the
- 1:00:26number of documents um for direct
- 1:00:30reasoning and for rag the accuracy does
- 1:00:32not go up but in this particular case as
- 1:00:35you increase the number of documents you
- 1:00:36are actually able to do better because
- 1:00:38you can u summarize what is relevant
- 1:00:41information or not in this particular
- 1:00:42case assuming that the documents more
- 1:00:44fetching more documents gives you more
- 1:00:46relevant information related to the the
- 1:00:48problem that you're solving.
- 1:00:51So this is basically another axis of
- 1:00:54like instead of doing iterative
- 1:00:55refinement you can do parallel
- 1:00:56refinement because you can basically go
- 1:00:58fetch more information and then chunk it
- 1:01:00down to put it in the model context.
- 1:01:05Now if you were to um compare the
- 1:01:08performance of um on GPQA data set um so
- 1:01:14if you just compared GPQA data set in
- 1:01:17physics chemistry and biology I was
- 1:01:18showing you a plot in the last uh slide
- 1:01:21human experts in physics chemistry and
- 1:01:23biology on GPQA would score this much.
- 1:01:26If you look at the reasoning models and
- 1:01:27you build search oven on top of them,
- 1:01:30what you notice is that um for example
- 1:01:33in physics and chemistry um
- 1:01:37search oven actually is quite
- 1:01:39competitive sometimes even better than
- 1:01:41what human experts would do. These are
- 1:01:42hard problems by the way. So um and uh
- 1:01:46in biology it's uh almost competitive to
- 1:01:49uh say the biologist solving the
- 1:01:51problem. uh one comment I want to make
- 1:01:53is that you want to focus on physics
- 1:01:55physicists solving physics problems. So
- 1:01:57you want to focus on the diagonal here.
- 1:01:59It's uh maybe not obvious like if you
- 1:02:01change the domain then that's the number
- 1:02:04you're comparing to. So the search oven
- 1:02:07is doing pretty well in physics here and
- 1:02:10in uh biology here and uh in chemistry
- 1:02:13not so much
- 1:02:22physicists.
- 1:02:24So what's the level of this physicist?
- 1:02:28>> Uh maybe they didn't do a good job
- 1:02:30sourcing the physicists.
- 1:02:33I think you're definitely getting to a
- 1:02:35point where the models are able to do
- 1:02:37well in certain domains more than the
- 1:02:40[snorts] but uh this is not to say that
- 1:02:42you're outperforming human experts. It's
- 1:02:44more to say that you're competitive with
- 1:02:46the human experts for this class of
- 1:02:48problems. Yeah.
- 1:02:51>> So there's still a lot of headroom in
- 1:02:53chemistry.
- 1:02:55[laughter]
- 1:02:56>> Yes.
- 1:02:57>> I have a question for the chemistry.
- 1:02:59>> Yeah. you seen about even how this
- 1:03:00chemistry like the you show the
- 1:03:03chemistry formula can be more
- 1:03:06>> I'm just wondering whether it it perform
- 1:03:08worse in the chemistry just becomes the
- 1:03:10chemistry part how to tokenize it can be
- 1:03:14complicated you want to preserve the
- 1:03:16meaning of sub combination but you but
- 1:03:19if you just change one thing
- 1:03:22>> the total chemistry like the behavior
- 1:03:26may change dramatically so
- 1:03:28>> I'm just wondering Whether just because
- 1:03:30how do you better preserve like part of
- 1:03:32the
- 1:03:34like how to cocon?
- 1:03:38It might be. I will let you actually go
- 1:03:41try to evaluate on GPQA and see if the
- 1:03:43chemistry segment if that hypothesis
- 1:03:46applies. It is possible.
- 1:03:51[clears throat]
- 1:03:51I mean in every subject when you go and
- 1:03:53prom these models the level of expertise
- 1:03:55kind of varies for different reasons,
- 1:03:57right? It's also possible the train data
- 1:03:59set was not that strong.
- 1:04:02So it's out of distribution.
- 1:04:05And the other comment that I was uh
- 1:04:07making earlier if you basically as you
- 1:04:09increase the number of documents uh this
- 1:04:12particular technique is able to leverage
- 1:04:14the fact that as you increase the number
- 1:04:15of documents you can uh improve the
- 1:04:18performance just because you're not just
- 1:04:21making the context longer. You're
- 1:04:22actually um providing relevant context
- 1:04:25from each of those documents.
- 1:04:28Uh the other big thing that I want to
- 1:04:30highlight is that in multihop question
- 1:04:32answering this is particularly relevant
- 1:04:34because in multihop question answering
- 1:04:36you do tend to hit uh some amount of um
- 1:04:40uh uh saturation in terms of performance
- 1:04:43uh with standard rag. So and even with
- 1:04:45agentic uh rag you do tend to hit some
- 1:04:47amount of uh saturation. So in like
- 1:04:49hotpot QA in two wiki music or bamboo
- 1:04:53for example uh if you just did rag for
- 1:04:55example you would not uh hit the
- 1:04:58state-of-the-art numbers but with search
- 1:05:0001 in um in a lot of these cases you are
- 1:05:03hitting the the highest numbers the
- 1:05:05bolded numbers um across that particular
- 1:05:08line are coming from uh search1 as a
- 1:05:11process so it is u providing a lot of
- 1:05:14value even like in the multihop question
- 1:05:16answering across multiple documents.
- 1:05:18Yes,
- 1:05:22>> what are the precision recall system?
- 1:05:26>> That's a great question.
- 1:05:31>> Like the retrieval itself is the
- 1:05:32following, not the model,
- 1:05:34>> right? So I think there's an assumption
- 1:05:36here that you did at least for the way I
- 1:05:39am explaining I mean it's possible that
- 1:05:41you didn't retrieve the right documents
- 1:05:43but if you look at the set of questions
- 1:05:45I think the main claim that this paper
- 1:05:46is making is that if you find multiple
- 1:05:48relevant documents that are loosely
- 1:05:50correlated to what you're quering about
- 1:05:53even then like once you put all of those
- 1:05:54documents in the context lump then
- 1:05:56that's you're asking the model to do a
- 1:05:59lot in terms of reasoning over that many
- 1:06:01documents. So that's the claim that this
- 1:06:02particular paper is making.
- 1:06:09So in terms of like if you were to look
- 1:06:11at the takeaways here um the gains are
- 1:06:14definitely coming from the fact that
- 1:06:16it's able to reduce the uncertainty and
- 1:06:19um
- 1:06:21the the document quality uh or like what
- 1:06:23you basically refine knowledge both of
- 1:06:25those improve and in the multi-turn
- 1:06:27scenario um once you can figure out like
- 1:06:31what you don't know um it's able to like
- 1:06:34even after like refining across
- 1:06:36documents it can do this iterative loop
- 1:06:38of improving upon that so it can like
- 1:06:40construct better searches over
- 1:06:42multi-tonon scenarios. So in in this
- 1:06:44particular case uh the reasoning quality
- 1:06:47uh improves substantially because you're
- 1:06:49providing more relevant documents and
- 1:06:51then you're also figuring out where the
- 1:06:53uncertainty is over multiple steps. So
- 1:06:57effectively you have the right documents
- 1:06:59and then you can correct yourself
- 1:07:00because when you put the documents in
- 1:07:02there if you're still seeing uncertainty
- 1:07:04then you have additional searches to go
- 1:07:06for. So there were some numbers that the
- 1:07:09paper gives of like the number of
- 1:07:10perhaps or or weight or likely basically
- 1:07:14anything that quantifies uncertainty in
- 1:07:16the reasoning chains goes down
- 1:07:17substantially in this particular
- 1:07:19approach. So they're basically analyzing
- 1:07:21the reasoning chains of the model.
- 1:07:24So um just to summarize what we covered
- 1:07:28here is that
- 1:07:30when we are building um deep research
- 1:07:32sort of agents on top of uh say the
- 1:07:35large reasoning models um that's a very
- 1:07:37effective way to like uh bridge the
- 1:07:39knowledge gaps that exist in large
- 1:07:41language models. But just doing simple
- 1:07:43uh retrieval augmented generation is
- 1:07:45often not enough and even with um just
- 1:07:48fetching the documents using tool calls
- 1:07:50is not enough. you need to be able to do
- 1:07:52that effectively over multiple turns and
- 1:07:54then identify the relevant information
- 1:07:57to refine which set of documents to
- 1:07:59keep. So um the large reasoning models
- 1:08:02by themselves often don't do a good job
- 1:08:04in um scaling well if you put a lot of
- 1:08:07documents in there. So this particular
- 1:08:09approach allows you to improve on that
- 1:08:12and uh larger models often do better.
- 1:08:15And then um okay there's another paper
- 1:08:18that I wanted to cover but like didn't
- 1:08:20end up covering. So the search R1 stuff
- 1:08:23um effectively varies from search 01 in
- 1:08:26that it teaches the model how to go
- 1:08:28search in an automatic way. So
- 1:08:31uh what I wanted to say here was that
- 1:08:33search R1 versus search O1. Search O1 is
- 1:08:35closing the loop with a prompting based
- 1:08:37approach. Search R1 can actually teach
- 1:08:40the model to do this with an
- 1:08:41reinforcement learning based loop.
- 1:08:45We will not cover this paper um today
- 1:08:48because we are basically at the end. But
- 1:08:50it's worth going and taking a look at
- 1:08:51that paper.
- 1:08:55>> Um questions.
- 1:08:58>> Yes,
- 1:08:59>> I was just wondering considering the the
- 1:09:02definition of a language model. So when
- 1:09:04we generated an answer,
- 1:09:07uh we supposed to have the ability to
- 1:09:09put a probability of that answer, right?
- 1:09:12>> Mhm. And I'm just wondering that when we
- 1:09:14have this let's say 1,000
- 1:09:18uh generations
- 1:09:20>> each generation have a kind of different
- 1:09:23probability or at least in some extent
- 1:09:26and and has there been some correlation
- 1:09:29between the right answers and the
- 1:09:31probabilities or they are by by
- 1:09:35definition they are absolutely
- 1:09:36uncorrelated and and also same question
- 1:09:40to to RA that when we have a have a rag
- 1:09:45augmented
- 1:09:47>> uh generation.
- 1:09:48>> Mhm.
- 1:09:49>> I I I can imagine that you know some of
- 1:09:51the maybe it messes up some of the
- 1:09:53definitions but is there any difference
- 1:09:55in the in the uh in the in the
- 1:09:59probability of the answer.
- 1:10:01>> I mean that's a great experiment to go
- 1:10:03do right. So let me answer the first
- 1:10:05question and the second question you
- 1:10:06will have to go experiment yourself. Uh
- 1:10:09so in the first question typically so
- 1:10:12there's a lot of studies but if you were
- 1:10:14to just like take the output generation
- 1:10:16and compute the log probabilities of the
- 1:10:18output tokens and aggregate them in some
- 1:10:21uh meaningful way like not just sum them
- 1:10:23you'll have to do some averaging or some
- 1:10:24geometric product or something. What
- 1:10:26you'll find is that um the models tend
- 1:10:29to be overconfident
- 1:10:31about what they like overconfident. So
- 1:10:34if you were to calibrate that to the
- 1:10:35right answer, often you find that the um
- 1:10:39the correctness is um like if it's 50%
- 1:10:43correct, it will still be overconfident.
- 1:10:44It will be like 80% very confident that
- 1:10:46this is correct. And this kind of shows
- 1:10:48up in the ways in which um if you try to
- 1:10:51correct the model outputs, it will
- 1:10:52sometimes be pretty [snorts] strong and
- 1:10:54like no this is the right answer and
- 1:10:56will not change its mind. Right? So in
- 1:10:59some ways uh the model outputs do tend
- 1:11:02have exhibited uh not high calibration
- 1:11:06and like more are more on the
- 1:11:08overconfident side. And there have been
- 1:11:10research to try to get the model to
- 1:11:12estimate the confidence say in a second
- 1:11:14pass or or in a and try to like do RL or
- 1:11:20like RLHF on top of that to get the
- 1:11:22model to calibrate and and do things so
- 1:11:24that it doesn't actually uh emit answers
- 1:11:27that it has low confidence over. Right?
- 1:11:30So there has definitely been efforts in
- 1:11:31that direction. U different models
- 1:11:34exhibit different behaviors. We don't
- 1:11:35know which lab did what. Um so we just
- 1:11:39get these notions of like oh the model
- 1:11:41is hallucinated and
- 1:11:43>> there is no correlation between the
- 1:11:45actual right answer out from the 1,00
- 1:11:48and the and
- 1:11:49>> I think there is a correlation in that
- 1:11:51uh if the answer is uh correct then the
- 1:11:54model will likely get it correct but if
- 1:11:56the answer is incorrect the model might
- 1:11:58be overconfident in feeling that it
- 1:12:00knows the answer that that's been the
- 1:12:03the observed pattern but I think this is
- 1:12:05what like this is worth studying this
- 1:12:07there's The hallucinations in just the
- 1:12:09ability of the model to know what they
- 1:12:11know is an active area of research
- 1:12:16and it's actually a a great set of uh
- 1:12:18research projects if someone wants to
- 1:12:20pursue it.
About this transcript
This page contains the full transcript of YouTube transcript (Uni9dqyuuDM) , generated from the public captions YouTube serves with the video. The transcript has 11,925 words across 1,779 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.