Why Large? Tiny LMs & Agents on Edge/Robotics — Cormac Brick, Google
AI Engineer · 21 min · 207 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:01[music]
- 00:12Yeah.
- 00:13So, yeah, a bit of a change of speed from the last two talks.
- 00:15So, we're looking at kind of higherend robots.
- 00:17If we want uh for intelligence to get into lots and lots and lots of devices and not just really expensive robots, we are going to need tiny models.
- 00:27And this talk is about what is the state-of-the-art of tiny models at the moment.
- 00:32What are the things they're good at?
- 00:33Um, and what are the things you can go start building today.
- 00:38Okay.
- 00:38So, yeah, firstly a bit of background like briefly on me and and the team I work on.
- 00:42Then we're going to take a look at small models that you may be kind of more familiar with.
- 00:46Just kind of explore what they can do, what they can't do um yet.
- 00:50Um, and then kind of see, hey, why do we need even smaller models?
- 00:55Uh and then just looking at the state-of-the-art of uh tiny models today and what you need to do to get them into a form and you can deploy them in production to do useful things.
- 01:03And yeah, lastly, we've got a couple of examples uh that we can look at uh from work from our team.
- 01:10Okay.
- 01:10Um so me I work I've worked in um Edi for a while.
- 01:14Um uh um these days I work as a tech lead um on the AI edge team at Google.
- 01:21uh within the team the types of things we do um are we develop kind of open source projects called like lighter TLM lighter t mediapipe and these make it easy to deploy
- 01:30AI to edge devices um we also do a lot of work delivering kind of edge AI core technology to Google's own products um some of which would be via tiny models
- 01:43um and then we also work with the Gemma team to ensure their models work well on um and run well on lots of devices and then we have a significant ificant focus on small and tiny models because that's what
- 01:54um that's what's useful uh for a lot of kind of mobile phone applications or if we want to be able to ship a model in browser uh that also has to be really really small and generally our kind of playbook is we develop things for first party like for in-house use first and then if we can figure
- 02:12out a way to share that via an open source package or make those tools available to the wider world we we do so and that helps kind lots of other people um
- 02:22build similar types of things using open source technology.
- 02:28Okay, so why do edi this is probably like um uh rel as opposed to just doing everything in the cloud.
- 02:34Um you know it's kind of obvious but I'll kind of go through it anyway.
- 02:37There's like kind of latency you fast consistent speed privacy data stays on the device offline use it's kind of reliably available.
- 02:45So that kind of um that that feature that you rely rely on in your mobile device will still work even when you don't have reception.
- 02:53That can be very helpful.
- 02:54And then savings um especially these days if the alternative is to call a um even a faster model on the cloud that will come at a cost.
- 03:05Uh particularly if you're kind of shipping an app or like a mobile phone app or something in browser where you know the user interaction is at kind of very very large scale.
- 03:14then even though those tokens are relatively cheap, you're multiplying it by a large number and it'll add up quickly.
- 03:22So then um the main challenges then of deploying AI on the edge is the leftmost one is kind of new uh which is DAM cost and um it's a really significant constraint
- 03:37that um and you'll even see some mobile phone manufacturers are putting less DAM into their devices this year than previously.
- 03:43You'll also see that since since launch, the cost of a Raspberry Pi 36 gigabytes has gone up by a factor of like 2.5x.
- 03:53Uh so DAM cost is really really significant.
- 03:56Um that then has a like casts a shadow over the rest of this talk, right?
- 04:01where in order to be able to get AI applications running on the edge, we need to really think a lot about kind of quantization and we also really need to think about what is the smallest possible
- 04:11um model we can use for a given task.
- 04:14Um other challenges are yeah there's a wider pool of target devices and yet another challenge is um yeah it's kind of fair to say that a lot of the research
- 04:26uh hours that go into LLMs these days are into the much larger models um and techniques and this types of stuff um and the the lower end of the LLM spectrum is a lot less studied
- 04:38uh so yeah these are challenges of deploying the edge okay so small models and when I small.
- 04:44I would mean kind of typically maybe kind of one to two or one to four billion parameters.
- 04:50You may find that these are built into the OS.
- 04:52There's a version of a small model that ships um in Android high-end phones today with AI core.
- 04:58There's a version that ships with Apple with Apple intelligence.
- 05:00Um some some um app vendors will ship a models this size in their app.
- 05:06We certainly work with some app vendors that do this.
- 05:09Um, and for like IoT and robotics, you would typically require like four maybe four to eight gigs of DRAM in order to be able to ship this grade of model which then has an implied cost on
- 05:22the device, right?
- 05:24So it then kind of restricts these models to you know things like laptops, mobile phones or kind of higherend electronics and kind of puts it out of reach of maybe a lot of uh lower tier web browsers or
- 05:36the wider kind of IoT and consumer robotics market.
- 05:40Um yeah and for for smaller models yep developing smaller models and we'll look in a while we do a lot of work to minimize footprints with kind of quantization.
- 05:49Um and the playbook here is mostly prompting, right?
- 05:53If you want to deliver a particular feature using a smaller model, you can just kind of use zero soft prompting and get pretty good performance.
- 05:58Also to use Laura adapters and it's kind of somewhat robust at doing things like kind of function calling and agent skills.
- 06:06Okay, so really quick example is like our you know um working with the Gemma team, our favorite go-to example is always Gemma for these kind of things.
- 06:13Uh so we can see that like the E2B model is um pretty capable in terms of reasoning.
- 06:19It's certainly like on par like with a Gemma 3 much larger model from kind of 12 months ago.
- 06:25Um and yeah, so we now have like much smaller models with that were pretty capable at reasoning and we get pretty decent answers just with zero shot prompting for a given task.
- 06:35We've also done lots and lots of work to optimize the memory footprint of that two billion parameter model as much as we possibly can.
- 06:42Um, so it uses a mix of like two bit, four bit and 8 bit quantization getting it down to like I know like 2.9 bits per weight if you look at the actual weights we need to hold in memory.
- 06:52We do other tricks like per layer embeddings.
- 06:54I won't go into like all of the detail here, but end result is we can you know you need maybe one like here it's 841 megabytes for a texton model in memory just for the weights and then you know maybe by the time you add in the runtime a KV cache
- 07:10um footprint you you might be up to requiring like two gigs of active RAM to be able to run this model then you account for an OS and the fact that there's other things going on that's where we get the kind of four
- 07:20four gig plus rule of thumb uh for deploying this on a device.
- 07:27Um then in terms of speed, this is using our runtime.
- 07:31This is just a list of devices that we run on.
- 07:34Uh for the purpose of this talk, we're going to look more closely at the last three rows of the table, which is if we take that two billion parameter model and run it on a Raspberry Pi.
- 07:43Um that is will give about 7.6 tokens per second decode.
- 07:48This is without MTP.
- 07:49If you turn on MTP, that'll get maybe 2x faster depending on the task.
- 07:54Um, if you go to a higher a more capable device like a Jetson RN Nano, we can get up to maybe 24 um tokens per second decode or maybe even faster if you use Nvidia's own tool chain.
- 08:05This is with our tool chain.
- 08:07Um we also have done work to port this to a Qualcomm IoT board which is pretty popular among kind of higherend uh robotics and IoT applications and there yeah you can see you can get about like almost 4,000 tokens per second
- 08:21uh preill uh 31 tokens per second decode and that's useful for lots of like almost real-time um uh applications uh on an NPU because um with with these uh with Gemma 4 models like One medium resolution image is
- 08:39like kind of 500 tokens.
- 08:40A high resolution image is 1120 tokens.
- 08:43So you could get like you know three frames per second of high resol high resolution tokens um going through this model and have pretty decent decode speed as well.
- 08:52So there's lots and lots of compelling applications you can build with this type of with a small model if you're kind of if you're kind of market or if you're kind of willing to have more expensive hardware and have a
- 09:05more expensive um uh uh DRAM kind of uh line on your kind of bill of materials for the device you're building.
- 09:17Uh yeah, just like our tool chain, we also work with other models in the community that are of similar size and they each have their strengths as well, right?
- 09:28Um so these are some of the other models that we support here.
- 09:32Um really briefly, I won't go into this in too much detail, but we also, if I can get this to play, um we also have a an app that you can use on both iOS and Android.
- 09:45So if you want to take one of these small models, see how fast it works in a phone, you can uh just go straight ahead and do that.
- 09:51Um so it's available on AI edge gallery.
- 09:54Also, all of the Oh, I'm getting that buzzing.
- 09:58Uh all the app is also fully open source.
- 10:00So if you want to see how to build something similar using one of these models or to see how this is using the open source runtime that runs the models, you can see all of that.
- 10:10So this is a great way of just getting started and trying small models if this is what you want to do.
- 10:17Okay, this is another example uh which I'm not going to play this video but you should definitely check it out.
- 10:23This is an example showing a um an open- source the open doc mini v2 robot.
- 10:28This is one um Zavier, one of the um engineers in deep mind built this as a kind of hobby project.
- 10:33Really really fun.
- 10:34Um so go check out this YouTube video.
- 10:37What you what you'll see is he has two robots.
- 10:39One is uh one uses the Jets and Nano, one uses the Raspberry Pi.
- 10:44And um you'll see that the robot is able to um it's it's able to kind of like read signs like um and react to things and kind of nod its head.
- 10:55It's also kind of able to take both voice and image input.
- 10:58Um yeah, and what you'll see is the Jets Nano one performs uh has really good real-time interaction.
- 11:04the one based on Raspberry Pi it works but it's kind of a lot slower right so for some examples um for some types of interaction um even the kind of best models we have today are are maybe not meeting a kind of user interaction requirements
- 11:21but yeah this is a really fun video so definitely check it out so yes um so then small models while uh they're great right if your product can afford
- 11:31uh to use one of these they're Uh they're really easy to use because you just need to zero shot prompt in order to get it to work.
- 11:38Um Genet has done great work in having you know low footprint high capable um uh models that are ready to use and they're optimized running on all of those devices
- 11:48uh you saw earlier.
- 11:50And you know if um yeah so if if all of your constraint if you can live within those constraints uh then great right your journey would stop here and you would build a feature you would want right
- 12:02for lots and lots of other things that that we do in our work and other people that we talk to.
- 12:08You know we're still at a point where small models are too big because they can't reach like older laptops or kind of more consumer edge devices.
- 12:17um the user interaction needs to be more responsive.
- 12:21Um we also could have the reality and we do of this a lot of times where the the model you want to run isn't the main feature in the application.
- 12:29It's like one tiny thing in a corner that needs to run while everything else in the system is running.
- 12:33Um so we also need a smaller model for system health.
- 12:36It's a common uh common pattern.
- 12:39So then enter kind of tiny models, right?
- 12:41So these are typically in the as small as kind of 50 billion parameters.
- 12:46We've deployed models that small uh to maybe 500 million parameters.
- 12:50Uh they're easier to ship natively with applications.
- 12:53They would run on the types of things you see on the right hand side.
- 12:56Um uh and would require you know maybe less than 2 gigs of RAM or or even less than that.
- 13:02And they can also be made to run really really fast.
- 13:05But the playbook to deploying here it's a little more complicated.
- 13:09Um so you know sometimes there's off-the-shelf models that'll do what you want and we'll look at those in the next slide.
- 13:15um or else if that doesn't work, you're going to be left in a world of kind of fine-tuning a model to achieve a given outcome, but which works very very well.
- 13:24So fixed task models um there's a bunch of things around ASR, vision and embedding models and if you have a if you have something uh yeah so like ASR
- 13:34and vision and embeddings these are all kind of stock features and they work really really well.
- 13:38This is an example of Apple fast VLM uh which is 0.5 billion parameter model running on a Android device using hardware acceleration and you can see it runs really really fast.
- 13:50So if you needed to kind of add a little bit of visual intelligence to a um like an edge device or an IoT device, you know, this class of model is an excellent
- 14:00uh is an excellent option to get that kind of first level of visual awareness or for ASR.
- 14:05Um yeah, there's some kind of strong models listed here as well.
- 14:09And and then lastly, embedding models are great at um uh yeah, like this is just a text embedding model which is yeah really good at kind of processing and match matching text which is can be relevant in some cases.
- 14:24Okay.
- 14:25Um but then next scenario is you want to kind of fine-tune a model.
- 14:31Um so here you can start with uh the models I'm citing here are kind of Google developed models.
- 14:36Uh so there's some starting at like 270 million parameters and Gemma 3 and function Gemma.
- 14:43Uh Gemma 3 is a general purpose model.
- 14:45Function Gemma is one that has extra pre-training uh for function calling patterns.
- 14:51So here the performance if you remember earlier on the Raspberry Pi our performance was at uh mids singledigit tokens per second decode.
- 14:59So here that kind of jumps up to 45 tokens per second because we need to read less uh from memory each time.
- 15:05And we can fine-tune this to do pretty compelling things.
- 15:08So on the right hand side um this is running a uh what we call a mobile actions model.
- 15:15Uh so this does text in and function calling out.
- 15:19Um this model knows about 10 different output functions and can call them at over 86% uh reliability from a given arbitrary text input.
- 15:30And this is for doing common things on a mobile device like uh schedule a uh calendar or turn on and off Wi-Fi or things like this.
- 15:39And it can take like arbitrary free text input and convert that to appropriate function calling.
- 15:44And for this demo, we've taken another ASR model and put it in front of that.
- 15:49Um which gives kind of voice to function calling as a feature.
- 15:53And voice to function calling is pretty key for lots of IoT and edge devices because um yeah like smaller devices tend to have you know require settings menus and that user interface can be really really challenging for lots of people.
- 16:07Uh so yeah being able to just talk to something to ask for a given outcome.
- 16:11This is a pretty key capability and uh we can do that reasonably reliably using a fine-tuned small model.
- 16:18So the playbook is generally then you pick a base model you check the performance if the performance and memory footprint are within the range that you want and then um the kind of the harder part is you
- 16:30uh the playbook we've found works really really well is we synthetically generate data to fine-tune that model um depending on the model like um there's a data set we've open sourced here called mobile actions it's available on hugging face that corresponds to this if you want to kind of recreate that same demo yourself and fine-tune
- 16:48function gemma from scratch.
- 16:50Um but we we've generally found that in the range of 10,000 to 10 million samples of synthetically generated um data will be sufficient to fine-tune a smaller model to a really really high degree of reliability.
- 17:07And so for other tasks we've done like things like summarization or proof reading.
- 17:12So something which you could do with a two or four billion parameter model reasonably reliably if you're willing to put the time and energy into creating a synthetic data set and fine-tuning a model you can achieve a similar like the same or greater quality
- 17:27with a model that is much much smaller will work on a much wider set of devices and will be much much more responsive.
- 17:33Um so yeah and that's that's the type of outcome we're seeing now with just fine-tuning a model for a single task and it's a really like yeah we found this is a really good playbook uh for deploying at like very wide scale.
- 17:47So here's another example in this is one example in production where we have this is an app that we've developed for voice dictation without subscription.
- 17:58Um all of the voice dictation happens locally on device.
- 18:02Um, and as well as just doing dictation, it also does uh it also does um wow, it kind of cleans up ums and a's, right?
- 18:10If you see on the right hand side, it's able to clean up text.
- 18:13It's also able to do biasing towards kind of words and names that um uh are kind of relevant to you personally.
- 18:21So kind of personalization.
- 18:22The left hand side kind of shows how we built that application.
- 18:25So there's an ASR engine and a text policing engine.
- 18:28And both of these are fine-tuned versions of tiny Gemma models.
- 18:31And this allows us to take something that would have been a kind of like server only feature of, you know, where you require a subscription to do highly accurate
- 18:40uh voice dictation and have an app that's just able to do that completely offline with very very good quality.
- 18:45Uh so this is something you can try on iOS if if you want to give this a go today.
- 18:49But um uh yeah and it just uh the backbone of this app is kind of two fine-tuned uh small gemma based models in the low singledigit hundreds of parameter million parameters.
- 19:02We also worth uh noting is there's also uh kind of features in developer preview in Chrome for example that kind of summarization and proofre APIs or feature as built-in APIs in Chrome and delivering those features via tiny models allows
- 19:17um the Chrome team to ship them to a much wider set of uh Chrome users than would otherwise be possible.
- 19:23Um yeah, so that's uh we've probably g have like one minute for questions.
- 19:27Um some kind of key takeaways.
- 19:29It's on the last slide if I can get there.
- 19:33Yeah.
- 19:33So takeaways from consumer devices and entry- level robotics is small LLMs are easy to use.
- 19:38Uh and especially on NPUs, uh they're very very fast.
- 19:41Uh tiny models will will enable reach to a much much larger pool of devices and voiceto function calling um can now be built to to be robust using tiny models.
- 19:51Uh it just requires kind of investing in an appropriate synthetic data set with enough samples and then you can fine-tune a model to get really good outcomes.
- 19:58Cool.
- 19:59So happy to take one or two questions or um if anybody has one.
- 20:04Yeah.
- 20:09Sorry.
- 20:10I'm going to plug this out.
- 20:12Yeah.
- 20:12Sorry.
- 20:14Sorry.
- 20:14Second.
- 20:26like broader ambitions of where tiny models can go.
- 20:30Wow.
- 20:30Um, I think kind of generalizing voice to function calling um is a is a is one key goal like making that very easy for lots of people because I think that's a key use case that if we can figure like if we can figure out how to make, you know, have
- 20:47like an agent generate the synthetic data for you, right?
- 20:50Um, if we like it's certainly possible to make that journey much easier than it is today and make it available to a lot more people.
- 20:57Um, yeah.
- 21:00and and certainly the the visual input as well.
- 21:02Um that takes a little bit of time at the moment.
- 21:04There's certainly scope to have faster models there that can do a wider set of things like kind of segmentation and other things that would enable other use cases.
- 21:12Awesome.
- 21:13Yeah.
- 21:13Do you see the time?
- 21:14We probably don't have uh Q&A session for today.
- 21:16Yeah.
- 21:17But Corman will stay after the session maybe and you can ask for more question about
- 21:22I'll stay after this session or you can come grab me downstairs at the Jeep mind booth at 4:00.
- 21:26I'll I'll be there 4 to 5. Okay.
- 21:42[music]