Autonomous Agents for Scientific Tasks - Sina Shahandeh, Radicait
AI Engineer · 19 min · 127 sentences · from YouTube's caption track
Each timecode opens YouTube at the start of that sentence. Line anchors (#s42) are the cue ids in the WebVTT, and every line carries its start and end seconds. All transcripts has every talk, and the whole corpus as one file.
- 00:00Hello everyone, my name is Sina Shahande.
- 00:04I quite my pleasure to present you this talk about uh running autonomous agents for scientific tasks.
- 00:12Um let's let's dive in.
- 00:14Um so here um I think everyone is quite familiar with the concept of auto researcher or auto research.
- 00:23This is the original Andre carpat is um GitHub repo where we have a ML model and we ask a coding agent to uh find def find a particular metrics and then optimize the code in order to minimize the error basically
- 00:40do a hill climb over model optimization.
- 00:45Now for many of these coding tasks um this works very well but when the problems become very much open-ended and um sometimes a long horizon like most of the scientific task
- 01:00you have this case where AI agents uh usually kind of saturate to a certain level um simply they they are very good at implementation of the of the code or changing the or running the experiments
- 01:12over lots of data and so on but the problem is they ran out of ideas uh or you know what people call them research taste.
- 01:20Now you can see that in this situations uh you know good humans keep going uh higher and the top 1% humans you know they keep even improving better and better over time.
- 01:32Um now um the the the really the difference um from here is the way that uh good ideas uh can or good hypothesis on how the model could be improved or how the the problem could be solved
- 01:46um keep um keep coming coming up humans keep coming up.
- 01:50So in the scientific task uh you you know you you have this um scientific method um where you know we observe a situation we make a questions we come up with a good hypothesis and
- 02:03come up with a hypothesis how to solve this problem and then we do experiments and implement and do the experiment um do the loop um and we as each of the iterations we learn something and we improve now
- 02:15the components of the learning component uh I think those are all questions of memory and implementation from learning the mistakes but which is one of the bottlenecks of using coding agents but I think this quite solved by just simply
- 02:28organizing patterns activity I think what is much more difficult is it coming up with a hypothesis so how can we come up with a good hypothesis good ideas for our
- 02:38uh coding agents to keep improving better uh the process and this is something core things that I would like to kind of um um focus on this talk and plus a little bonus at the
- 02:50Um so let's look at the problem here we're trying to achieve as an example so you have a good a good idea of what we're trying to do.
- 02:56So here is what we're doing at Radicate.
- 02:58We're building uh insilicopet meaning you have a CT and we want to generate um a PET PET image um a PET scan from the CT scan.
- 03:10Example of this you can see here um we have CT scans and of slices of scans of the of the of a patient.
- 03:18they might have a nodule in the the lung and the question is is this cancerous or not?
- 03:22Um is it a lung cancer?
- 03:24So they do a PET scan which is a difficult process and very timeconuming and uh to do um but here we do an ML through ML model image translation
- 03:34one can kind of change the modality learn the structure of the body and infer what would happen in a PET scan if the hyper the activity of the tissues.
- 03:44So you know certain tissues absorb more radioactive tracer and they shine up in this PET scan um and the the tumors usually that's the case.
- 03:54Now to generate this relationship uh we need um we need a model uh to um to do the translation but the problem itself has many components.
- 04:05So really uh this like any other scientific task the problem is decomposing the problem entire long-term horizon two years 10 years research process into steps and each of those steps is really fundamentally are the goal are a loop.
- 04:21So I'm going to focus on one of these particular ones right now and that is on training of a machine learning model.
- 04:26Uh so we have here you know decoder encoder type of situations and so encoding the CT and then decoding it into PET.
- 04:37Um so that's the typical GAN model which kind of generates the the image.
- 04:41Now for this we can kind of define this kind of you know the architecture and we try it capture data and do all the 80% of work to basically bringing the good data set and here
- 04:53uh we create the metrics and so on and um around the image you know fidelity of synthetic pet to to real pet and so so on.
- 05:03But the challenge is how can we improve the situation given a certain um initial point and we'll go back to our idea of uh hill climb around this optimization.
- 05:16So you can see an example of iterations coming from a real run in codeex where you know we improve the data and so on and then we the model goes around and tries to do the optimization and you can see there's a range of possibilities
- 05:30and some of them become dead end some of them not don't improve anything but um we kind of desaturate at a certain point and then you need really need a good idea a good idea has to come up so in this case we have a slices of CT
- 05:44and we feed these as channel into the model.
- 05:47So initial problem initial model that was trained was 2 and a halfd.
- 05:52So treating each CT slice as a be the 2D convolutions but stack over channel.
- 05:58Now if you give this to a typical ML model they would not think about it as you know go through hyperparameters or you know some sort of you know playing around with problems that it knows but it wouldn't do a very radical change.
- 06:12uh for example to come up with a 3D idea convolutions or change the whole problem upside down.
- 06:20So to create those ideas um for for for the for the model to try um I had to kind of in the midst of the codeex loop say oh what about what about this idea what about that idea or go read papers out there and see what the papers are are are saying what's other people are trying
- 06:38um so to induce uh that hypothesis generation we need to do something about about about our our ML model LLM models so this is a trick um that I found that working very efficiently
- 06:54and it's very similar to that chain of thoughts step-by-step problem.
- 06:58First is to decompose the problem into its subcomponents but it's an explicit act um um action.
- 07:05So you know you could ask actually go through your problem here in this case you know create a translated polymer nodule CT patches into equivalent pet um that's our top problem that I just explained to you
- 07:18and then it has components into it so different domain in this case you can see um you know the the the data component the actual core the learning the architecture
- 07:31the training loss the you know the operational part of the the ML modeling the metrics and evidence and um you know the peripheral scripts that kind of run the model and data preparation itself is very important pieces.
- 07:45Now what we have here is this hierarchy of components of this model that's induced.
- 07:52So this itself can be induced very easily using a prompt.
- 07:56Uh so basically you know coding agents can itself go in with this prompt of go in through this codebase and create this series of hyper um documents that are linked to each other.
- 08:10Now what we're trying to do is is to give our um our coding agent ability to look at this problem in this component uh where it might not do so and then induce
- 08:25a a a change within those plateau.
- 08:28That's exactly what uh human researchers would do.
- 08:31Uh the question is look at what's important what's not important.
- 08:34So let me show you let me show you this graph here in obsidian.
- 08:38So the documents that's generated out of this hierarchy generation would looks like something like this, right?
- 08:43So there's there's an initial readme says here's a problem statement the level one and here is our you know the documentation and then when we go to a next level
- 08:55uh of the of the problem you see here um the level two level two itself goes in and have other level three components going on.
- 09:06So one of these pieces for example is the model architecture.
- 09:09There's all those kind of components I showed you in the graph that you can see it here.
- 09:12And each of these documents are very simple.
- 09:14We just ask them the model to to document different levels of um this hierarchy as it goes in um through the process.
- 09:22So here you can see the generator now it says it's a 2 and a halfd generator and so on and we go shows the details and at the end of these hierarchy components is the actual code
- 09:33um that is that is in our system.
- 09:36Now what we do during before we actually start the loop the question becomes okay now that you have this hierarchy and now the our model can start thinking uh step by step through the hierarchy
- 09:50and going forward uh for the actual uh implementation.
- 09:55So we ask um then the task is given this hierarchy that you have come up with ideas that can improve improve this problem and you can see here before
- 10:07if I just say say here's our code base and here's my objective Google optimized this process similar to what originally Carpathy's readme file in this program MD it would not it would not generate it would saturate after a while but now that we have this hypothesis
- 10:25generation process that can work in an adversarial and collaborative way.
- 10:30Um now you have a process where you can create say you know um you you basically create 100 um you can create um 100 different solutions.
- 10:47So this goes in and because we have all the components we actually have a have a process in which going and modify every component of it.
- 10:55So it becomes a very much more comprehensive search because you have a scaffold that are reasoning LLM can go in and make a decision around improving each of these and
- 11:08very much you can see here that you can come up with the idea around uh you know creating a three-dimensional um uh structure rather than 2D.
- 11:16So basically creates a much more radical change that it's otherwise would have not come up or or would have missed.
- 11:25Now you can also review this of course um this plan uh with a with a adversarially and um or collaboratively with another agent or another model to basically loop in and uh and improve this
- 11:40for.
- 11:41Ultimately the idea would be um to go through this in in in in a loop like um similar to like this.
- 11:49So we have basically um you know a codebase a metrics um goal achieved no then you hypothesize a required change and then kind of go in and implement and this loop can go
- 12:01much faster and much better because here we create a better hypothesis.
- 12:06Um now let me give you another example uh where um we also in the parts that data preparation another way to kind of improve this scientific loop um is around the concepts of um um
- 12:22so you can see an example of it as a registration.
- 12:24I want to show you how you can use this additional skills additional kind of collaborative and addial process within your loop.
- 12:34problem is that we have this case where we have to do um image registration.
- 12:40It's another type of optimization loop in a sense that you you the idea here is so you can see two process two two two scans are overlapped here.
- 12:49So the CT scan the gray and then the PET scan is the color one that shows the metabolic activity of the of the tissue.
- 12:56So you see liver is high and the lung is is black is not absorbing that radio trace there.
- 13:04Um now at the beginning these two scans are not aligned because they they're scanned at different times.
- 13:10Uh at the beginning they're look like this.
- 13:12Um it's off and through that process of optimization which we call image registration.
- 13:18We need to align these images together.
- 13:21This itself is has a goal to make a good registration.
- 13:24But there are many different components to it many metrics and sometimes the there's a very long process.
- 13:30it it would can fail in different aspects of this as this you know the bodies may not be the same well the the body's not the same because the because respiration
- 13:39because changes in the system they they're not always aligned and the patients moving and coming in the next next day or next week do the same scan uh with a different scanner would be very different um
- 13:52positioning.
- 13:53So to do so um we have to kind of align these and we go through the same loop here but we have many different um type of metrics here.
- 14:05Some of them not necessarily um a quantitative but qualitative and also hard to know which bug or which issue has has come across.
- 14:17So as part of that loop process um one of the idea is that as a as a scientist I would be come here and look at this images one by one myself.
- 14:27I could have tried to say oh is this kind of quality control metric type story where you look at this image say does this make sense?
- 14:34So here you can see a long mask is the mask applied correctly on the lungs or not.
- 14:40If this process next steps is going is it scans properly truncated or cropped but each of these processes there's a loop in itself and could be this con adversarial could also be collaborative.
- 14:55So as part of the metrics uh you can kind of call in another model that has a better multimodal capability uh to review the image uh and what's the opinion about this image does it scans
- 15:10correctly aligned um and then as part of the hypothesis generations or critique of the changes that has happened you can invoke the another model such as that is much more better at reasoning
- 15:23545 uh to generate the hypothesis because they have much bigger um test time compute than and in first time compute to do so you need to equip your loop with additional skills
- 15:37to do these these processes by themselves and it's very easy now in the coding agent of course so here I build a skill for review of that image generated
- 15:48with say with Gemini model and so on so as part of that loop you can kind of implement these these loops there.
- 15:54Uh, and of course to use GP5 and pro that's something we really like is Peter Spinberger's Oracle CLI which packages the code and package the data and send them to
- 16:06API uh of the the GP 5.5 Pro and then we'll be able to kind of close the loop um on the on the outcome and you I've seen a much better improvements
- 16:19during the especially the hypothesis improve generation uh but also So the critique of is this implementation was really effective because every loop that goes in the loop basically asks say this is what we implemented this is the outcome of it
- 16:33does this make sense what would you do next so the process of the loop is very important uh to kind of keep going and improving the model out of this story
- 16:42I think what you see as this um back to the concept of autonomous researcher is that you have the ability to go through this loop of scientific discovery with much more rigor in terms of hypothesis
- 16:56and and I think implementation is already quite a bit solved especially if your problem is um you know b you know in in a basic can be done in a basic simulated environment
- 17:08uh in in a box of course the big thing in science is um better observations the multimodal model currently they lack very much understanding of these components so for example here most
- 17:23um understanding of this tin tiny changes for example the existence of this nodule no LLM today is able to identify these very well because they're just not simply trained
- 17:34on scientific images and scientific data so there's a big space for future work for people who build these models to be able to fine-tune them or be able to adjust them so they can
- 17:45the model themselves can close the loop by observing the same way as a trained scientist would be able to observe that particular uh issue and then um so that's I think one of the biggest bottlenecks for uh for
- 17:58not having a full you know scientist in a in a in a data center and then the next thing would be this strength hypothesis but I feel the same way as the chain of thoughts
- 18:11came on top of the a basic um [clears throat] base model like you know 40 GP 4.0 know and allowed it to do much more better reasoning.
- 18:25This type of trick with this type of um hierarchal structures is the same trick basically applied on the current model and I think going forward with the newer models that are much better post-trained
- 18:38to compartmentalize the problems and break down the problems.
- 18:41Uh we probably get need less and less of these tricks down the road.
- 18:46But in the meantime and in the absence of a very good models I think you you can do something like this or manually well in a different explicit step steps decompose a problem into hierarchies
- 18:58and then going through those hierarchies for for improvements in each component of it.
- 19:03And basically that allows a very uh structured way to scale the test time compute to to generate more and more tokens on this problem and uh close and continue the loop.
- 19:16Well, thank you very much for this talk.
- 19:18Uh hope uh to see you around.