On-device ML: Artificial Intelligence in your pocket
Priyanka Kulkarni21:592023
Kilkaset megabajtów modelu może przesądzić o losie aplikacji mobilnej
Typowy model deep learning waży kilkaset megabajtów, a badania pokazują, że brak miejsca w pamięci i szybkie rozładowywanie baterii to najczęstsze powody odinstalowywania aplikacji. Zespoły przenoszące AI z chmury na telefony muszą jednocześnie wygrać pod względem pamięci, szybkości i bezpieczeństwa, często na urządzeniach ze średniej i niższej półki. Priyanka Kulkarni, Senior Machine Learning Engineer w Adobe, opisuje ten teren: jak zmniejszyć, przyspieszyć i chronić model, który znajduje się w kieszeni klienta?
Poznaj strategie kompresji, akceleracji i znakowania wodnego, dzięki którym ML na urządzeniu staje się praktyczne
Priyanka Kulkarni, Senior Machine Learning Engineer w Adobe, wyjaśnia, czego wymaga przeniesienie modeli deep learning z serwerów w chmurze na telefony i inne urządzenia brzegowe. Omawia trzy wyzwania (rozmiar modelu, wydajność modelu i bezpieczeństwo) oraz kompresję, wyszukiwanie architektur sieci neuronowych, akceleratory sprzętowe, znakowanie wodne modeli i uczenie federacyjne jako sposoby ich pokonania.
“Duży rozmiar aplikacji to wyrok śmierci na urządzeniach mobilnych.”
“Utrzymanie małego rozmiaru modelu mobilnego i niskich opóźnień jest więc naprawdę nienegocjowalne.”
What you will learn
Ocena korzyści z uruchamiania modeli na urządzeniu zamiast w chmurze pod względem kosztów, opóźnień, łączności i prywatności.
Wybór architektur przyjaznych urządzeniom mobilnym, takich jak EfficientNet, MobileNet czy MobileViT, i ich zmniejszanie za pomocą przycinania (pruning), destylacji wiedzy i kwantyzacji.
Wykorzystanie wyszukiwania architektur sieci neuronowych i skalowalnych sieci w stylu Once-for-All, aby obsłużyć kilka środowisk sprzętowych bez zaczynania za każdym razem od zera.
Diagnozowanie zacięć (jank) wynikających z rywalizacji o GPU i dostosowywanie warstw modelu do akceleratorów sprzętowych, takich jak XNNPACK lub Apple Neural Engine.
Ochrona własności intelektualnej wdrożonych modeli za pomocą szyfrowania, zaciemniania kodu, limitów zapytań i znakowania wodnego sieci neuronowych.
Details
Level
Intermediate
Format
Talk
Technical depth
Practitioner
For
Mid-career, Senior individual contributor
Length
21:59
Published
June 2023
Questions this talk answers
Dlaczego warto uruchamiać uczenie maszynowe na urządzeniu, a nie w chmurze?
Wnioskowanie na urządzeniu eliminuje koszty centrów danych i przepustowości oraz działa niezależnie od łączności. Zapewnia użytkownikom wyniki w czasie rzeczywistym i chroni prywatność ich danych, ponieważ nie trzeba ich wysyłać na serwer ani tam przechowywać.
Dlaczego rozmiar modelu jest tak krytycznym ograniczeniem na urządzeniach mobilnych?
Typowy model deep learning ma kilkaset megabajtów, a duży rozmiar aplikacji to wyrok śmierci na urządzeniach mobilnych, zwłaszcza na rynkach wschodzących, gdzie dominują telefony ze średniej i niższej półki. Prelegentka przytoczyła badania, według których brak miejsca w pamięci i rozładowywanie baterii to najczęstsze powody odinstalowań.
Czym jest jank i jak zespoły zajmujące się ML na urządzeniu mogą go ograniczyć?
Jank to zacinające się klatki, które pojawiają się, gdy GPU jednocześnie renderuje interfejs i wykonuje wnioskowanie modelu. Zespoły mogą go profilować narzędziami deweloperskimi iOS i Android, dostosowywać warstwy do akceleratorów sprzętowych i rozdzielać obliczenia warstw między akceleratory.
Jak firma może chronić model po wdrożeniu go na urządzeniu użytkownika?
Powszechne praktyki to szyfrowanie, zaciemnianie kodu i ograniczanie liczby zapytań w celu powstrzymania ataków adwersarialnych. Znakowanie wodne sieci neuronowych dodaje ukryte sygnały własności, które nie wpływają na dokładność i są odporne na usunięcie.
Jak mógłby działać znak wodny w modelu językowym takim jak ChatGPT?
Jedna z proponowanych technik wybiera określone tokeny z losowego zbioru i delikatnie je promuje podczas generowania. Zwykły czytelnik tego nie zauważy, ale badacz mógłby prześledzić wybór tokenów i udowodnić, że tekst pochodzi z modelu.
Dlaczego rozmiar aplikacji to wyrok śmierci na urządzeniach mobilnych (48 s)
Ochrona modeli AI działających na urządzeniach użytkowników (63 s)
Jak mógłby działać ukryty znak wodny w ChatGPT (43 s)
All right. I guess we can get started. Hello, everyone. Hope you're all doing well. And thank you for attending this session. I'm Priyanka Kulkarni, and I specialize in building neural networks for on-device deployments at Adobe. Today, I'm going to talk about building on-device machine learning solutions to create, and I'm going to talk about building on-device machine learning solutions to create new technologies.
An AI-powered future that is fast, reliable, and secure. It's no surprise that mobile has become a predominant surface for AI interactions. We all want machine learning-powered magic at our fingertips everywhere we go. You all have probably used some form of AI on your phones for work, for travel, for shopping, or simply because you're bored. And there's tremendous demand rising for apps like digital assistants or face recognition and augmented reality.
An AI-powered technology, where people are reaching for their phones to engage with AI daily. An AI-powered technology. This has led to a huge uptick in the mobile AI market, now worth billions of dollars and rising. Recent studies have shown that applications that have advertised their association with OpenAI or ChatGPT, have seen their revenues jump dramatically in the past few months, as consumer demand around these technologies have skyrocketed. As more and more apps are incorporating machine learning into their offerings, This intelligence is moving closer to the edge where the computations are locally rather than in the cloud.
So in today's talk, I'll touch upon why on-device machine learning is important and relevant today more than ever, understanding the risks and challenges that come with the fabric of mobile platforms, including the security ones, and strategies that we can adopt to push the boundaries of neural network deployment across edge surfaces. The typical state-of-the-art neural networks are so large and computationally expensive that they require huge data centers with clusters of CPUs and GPUs to be able to run them.
They are too big to fit on edge devices and expensive to even run inference. So add to this bandwidth costs of transferring the data from the user's devices to the cloud, and you can tell that all of this adds up really quickly. On-device machine learning means that you can save all of these costs. This is also great for customers because now they can enjoy the benefits of access everywhere, regardless of connectivity, get instantaneous or real-time results, and assure data privacy.
Nobody likes the delay when the data is being streamed to the cloud, processed over there, and then sent back. And we can skip this whole hassle with on-device models. And because the data doesn't have to be sent to the server or stored there, there are fewer opportunities for cyber criminals to exploit any vulnerabilities, which also helps to preserve the sanctity of the data.
Now, integrating machine learning on the edge is nothing new, but the explosion of ML models in the world around us poses an increasingly difficult challenge to fit all of these intelligent systems onto resource-constrained devices like our mobile phones, which have limited compute, battery, memory, storage. Add to this mix, the generative AI race. I'm guessing you all have seen or heard about the mania around ChatGPT, DALI, mid-journey, and their mind-boggling abilities to write essays or create art.
I mean, I've been hooked to those apps for too many hours. And as generative AI is booming, so are the costs of running these models. They are way too large by smartphone standards and cannot be just taken off the shelf and run on our phones. So you can guess what the first challenge with on-device machine learning is, the model size and capacity.
We need a model that's small and fast, yet can provide high accuracy on the intended task. A large app size is the death knell on mobile. This is especially so in emerging markets around the world, where mid to low range smartphones are the majority. So we can't have our machine learning models driving up the app sizes by a few hundred megabytes, which is a typical size of a deep learning model.
A smaller size of the model also means we have fewer parameters than usual for the model to learn the task effectively. And in addition to this, we need to invest in accelerating the model inference so that we can provide users with low latency. These challenges are highlighted by innumerable surveys that show that a lack of storage space or battery running apps are the most common reasons for mobile app uninstalls.
So keeping the mobile model size low and the latency low is really non-negotiable. Finding this trade off between model accuracy and latency has become key in research as well. For instance, this chart tells us the relationship between a model's accuracy and its latency as we scale up the size. Each color here represents a specific architecture. And from looking at this, we know that the purple architecture gives us a really big boost for accuracy for a comparatively small increase in latency.
So it must be a really efficient model. And so happens that this model is also named efficient net. So it seems like a really good candidate for on-device models. In the bubble chart on the right, the size of each bubble represents how many parameters each model has. Here we see that the older models called BGG nets are the biggest models here and were created with a staggeringly high number of parameters.
Over time, though, research has taken machine learning models towards the direction of using fewer parameters and fewer operations while maximizing accuracy. And this is evident from the concentration of the models towards the top left section of the chart compared to where the old BGG models had started out. So it's great news that literature and industry is taking notice of how models can be made smaller as well as more efficient, which bodes well for on-device ML.
Typically, we've seen so far that convolutional neural networks remain the dominant choice for mobile deployments, where a majority of the deep learning models on mobile devices were some variant of mobile net. Mobile net architectures were developed with the intention to address the resource bottleneck seen on mobile. But over the past couple of years, the landscape of deep learning has been completely revolutionized with the advent of transformer based models.
These models have several advantages over CNNs, including introduction of attention layers for better information mapping and learning, as well as nuanced understanding of language. Following this, there's also been an interest of adapting transformers for mobile. However, they have been far more challenging to convert and run on device as compared to CNNs because they have more complex layers, higher floating point ops, and also exhibit much higher memory usage.
In attempts to optimize transformer models, so far we have seen that we've achieved varying degrees of mobile friendliness. This has raised the question if we can design architectures that are as mobile friendly as continents, but as efficient and accurate as transformers. A number of hybrid architecture designs have been proposed for combining advantages of CNNs with transformers for maximum efficiency, and mobile VIT is one of them where local processing done in convolutions are replaced with global processing using transformers.
Now, the selection of model architecture is crucial, but we also need to optimize the model further by shrinking it as much as we can. For this, we can use model compression techniques. This domain has seen various techniques developed over time and is widely being used already in literature and industry. These include things like network pruning to get rid of redundant or less important neurons, knowledge distillation from a teacher model to a smaller student model, as well as quantization to lower precision values.
As effective as these techniques have been, they are not that easy to automate, and it involves a lot of manual cumbersome tweaking and tuning to squeeze out every bit of optimization we can get, which is indispensable and goes a long way for mobile deployments. To combat manual tuning of models, you may have heard about the rise in popularity of neural architecture search.
So this is the process of automating the design of neural networks, where you search amongst various combinations of layers to create an architecture for your model requiring minimal human intervention. This is a fantastic way to find an optimal and efficient model where we can search for architectures that would work great for mobile. But what happens when we have diverse deployment scenarios on the edge like mobile browser or web.
These all present different resources as well as limitations for deployment. So we could deploy the same model across all of them, but then we'd be limited by the most constrained environment and end up being wasteful or inefficient in the others. So why not use neural architecture search to find a model tuned for each specific hardware environment. So this is a great idea.
But as these environments increase and scale, instead of rerunning neural architecture searches each time, we would want to find an effective way of walking the accuracy and latency curve for these models so that we can have greater flexibility and velocity to market. There has been interesting research in this field of scalable architectures, one research group at MIT has published a solution called once for all that attempts to tackle this problem.
And what they've proposed is training a single giant network, which we can then sample for smaller specialized sub networks of different sizes and different capacity, and then deploy them in various scenarios and target hardware. Also, not to forget that scalable architectures are like once for all ensure we're heading into the next generation of AI responsibly, because then these searches are targeted and optimized, so they are far better for the environment than traditional neural architecture search engines.
The second challenge with on-device ML is model efficiency. Due to resource limited environments on edge devices, our model needs to maximize its efficiency to consume the least amount of resources it can. This could be compute or memory. The on-device hardware landscape is also very diverse, especially on Android, where there are so many different manufacturers and hardware makers, leading to a spectrum of diverse resource limitations across all devices.
On mobile, this resource limitation often results in a contention problem, which if not handled properly can result in a symptom observed called jank. Consider a scenario where the GPU is simultaneously being called upon for UI graphics rendering requests, as well as running inference on machine learning models. This is common with real-time or interactive ML features where a user could be scrolling on his or her phone while the machine learning model is running simultaneously in the background.
In this case, you would get an experience like you see on the left-hand side, where there are more stuttering frames during the scroll. And this is called jank. While the right side presents a smoother scrolling experience for the user. There are now a lot of mobile developer tools available on iOS and Android to help us profile as well as measure jank.
We can mitigate against it. The CPU and GPU are not the only resources available on mobile. There are diverse set of hardware accelerators available across all platforms. One example is the XNN pack on TensorFlow Lite, which is a highly optimized library that enables faster CPU performance, including speed up of quantized models. Likewise, on iOS, the Apple neural engine is a special type of processor unit that you can leverage to make your ML models really fast by accelerating operations like convolutions and matrix multiplies.
There are a lot of other companies besides Apple developing their own AI accelerator chips, and you might have heard of Google's sensor processing unit as well. Even with all of these diverse hardware accelerators, there's a possibility that your ML model may not be able to use all of them. Many common layers seen in machine learning models may not be supported.
So we need to tailor our models to make the layers compatible with the accelerators that we intend to use. We can also parallelize the inference by developing an intelligent system to delegate and distribute the load of computing different layers using different accelerators. And this becomes even more critical when we have to run multiple ML models in parallel where they're all contending for the same device resources.
The third challenge of on-device ML is security. A significant amount of time, costs, data, and resources go into the development of each deep learning model, and it's critical to protect its intellectual property. When we deploy a deep learning model to the edge or on-client devices, they are far more vulnerable there than when they're queried using APIs in the cloud.
Thinking about the cybersecurity aspect of model protection is crucial. There are a lot of common best practices to safeguarding your deep learning model, like encryption, obfuscation, as well as limiting the number of requests to curb the potential for adversarial attacks. There's also research being done for embedding ownership signals into deep learning models directly, called watermarking. So this is similar to the watermarking techniques used to protect creator rights for digital images, video, and audio, and it has been a really effective technique to prove the ownership, authenticity, or integrity of these creations.
Neural network watermarking is a bleeding edge area of research to incorporate IP protection into deep learning models. These techniques aim at embedding ownership signals by inserting watermarks or backdoors into models that are so well disguised that it's hard to detect them. Aside from acting as the ownership proof, they do not affect the accuracy of the model and exhibit no other behavior.
And lastly, the watermark also persists against adversarial attacks, which makes it difficult or impossible to remove it. There's been some exciting research in extending this domain for watermarking generative AI models too. Watermarking gen AI is imperative not only to protect intellectual property, but also to prevent potential future malicious uses of language models like plagiarism, misattribution, misuse, or abuse of the outputs.
Recently, OpenAI also announced that they are planning to stop ChatGPT users from cheating on their homework or making social media bots by watermarking outputs produced by their models so that you can have a trace back to identify that they originated from ChatGPT. There are also recent research papers that have proposed frameworks for watermarking proprietary language models and already proven that the watermark can be embedded with negligible impact on the text quality in the outputs.
There are other challenges and security risks of generative AI models that need to be addressed. One is their vulnerability to training data extraction attacks. There is a potential risk that these models leak details about the data on which they've been trained. This point was raised in a research paper where they showed that if one prompts the GPT-2 language model with a particular prefix, it auto-completes a long block of text that contains sensitive and personally identifiable information, including contact details and the physical address of a particular person whose information was included in the model's training data.
There have been a lot of exciting developments in the field of optimizing and scaling down generative AI models, which will help pave the way for eventual on-device deployment. We're already seeing that these generative language models of different sizes and capacities can accomplish a variety of different tasks. So, while the larger models can pass college level exams or the bar exam, the smaller models can still achieve the ability of reading comprehension and logical deduction.
This is a great sign and helps us understand how to fine tune these models for business specific tasks or use cases and how we can optimize them for on-device. There's also a lot of promising evidence of running large scale AI with fewer parameters. For instance, the models like stable LM and Meta's Lama model have only around a few billion parameters.
This sounds like a lot, but these are vastly optimized models compared to the GPT models, which have hundreds of billions of parameters and have no hope in the world of running on smartphones. More recently, Web LLM is a project that brings large language models and chatbots to web browsers. So, everything is run inside the browser without any server support and it also leverages Web GPU acceleration.
Recently, Squeezebits also claim that they have optimized image generation models from stable diffusion to be able to run it on an Android phone, which is just astonishing. And why stop at only inference for on-device ML? We can also train and update these models locally without the data ever leaving the user's devices. Models can be fine-tuned to achieve better flexibility as well as offer personalization.
This concept can then extend to federated learning, which marries the advantages of on-device training with cloud training. So, you get the privacy benefit and the scale of on-device learning by keeping the data local closer to the user. And you get the benefit of learning from diverse data across users by having the cloud aggregate many locally trained models.
I'm so excited to see the proliferation of AI based services around us and the ability of running these lightweight personalized models locally on our phones will help us unlock the full potential. So, thank you all for listening. And with that, I'm happy to take any questions. Please feel free to drop any questions in the Q&A chat pod as well, and I can get to them offline too.
Okay, so we have a question from Sandra. What could be an example of a watermark in chat GPT? So, that's a great question, Sandra. One of the language models behind all of these chat GPT and prior technologies have a proposed watermarking technique, which the company isn't currently using, but the architecture behind these language models involve the use of transformers.
Which are composed of blocks that leverage tokens. And an example of a watermark is to select specific tokens from random set and softly promote the use of those specific tokens when generating the output. So, these watermarks would not be visible to a layman when chat GPT produces certain outputs. But if I'm someone who's a legal authority who would want to then investigate and trace it back, I can run reverse engineering using the token selection to be able to uncover and prove that this watermark originated from chat GPT.
But if I'm just a general user who's just going through a paragraph produced by chat GPT, it would be sort of masked from me. I have another question from Deborah. Can you explain a bit about the on-device and consolidated data with an example? Sure. So, you can think of it as each of us having smaller localized models with fewer parameters that learns to give us specific types of responses.
So, I might be having slightly different tolerance for bias or outputs of a language model compared to someone else. So, that would be really important. So, I think it would be very important. It would be very important to reflect my interests, my ethics, my values. Whereas, the larger models would get an aggregated version of all of our phones to reflect what general customers, you know, the mean average of customers would expect.
So, that helps to keep data local to me and a model that's personalized to my beliefs and my interests while also updating the larger models on server that reflects the aggregate data across all of the users without infringing privacy. I hope that helps answer your question. Thank you. And I think we're out of time. Thank you all for attending this session.
I really appreciate it. And please feel free to connect with me. All right. Have a great day, everyone.
Transcribed automatically; names checked against the speaker record. Select a time to jump there.
Article based on this talk
Czego wymaga uruchomienie deep learning na telefonie
Priyanka Kulkarni z Adobe dzieli uczenie maszynowe na urządzeniu na trzy wyzwania (rozmiar, wydajność i bezpieczeństwo) i przedstawia techniki odpowiadające na każde z nich.
W skrócie
Uruchamianie AI na urządzeniu zamiast w chmurze obniża koszty serwerów i przepustowości, eliminuje opóźnienia i chroni prywatność danych użytkowników, ale tylko wtedy, gdy model jest mały, wydajny i zabezpieczony. Priyanka Kulkarni, Senior Machine Learning Engineer w Adobe, przedstawia ML na urządzeniu jako triathlon pamięci, szybkości i prywatności oraz omawia architektury, metody kompresji, akceleratory sprzętowe i techniki znakowania wodnego, które to umożliwiają.
Najważniejsze wnioski
Jak przyspieszyć drogę od serwera do urządzenia mobilnego przy wdrażaniu sieci neuronowych deep learning.
Jakie ryzyka i wyzwania wiążą się z wdrażaniem sieci neuronowych na urządzeniu.
Jakie są implikacje bezpieczeństwa wdrażania sieci neuronowych na urządzeniu oraz jakie rozwiązania i strategie przyjąć, aby chronić własność intelektualną.
Jak zbudowane są platformy wdrożeń mobilnych dla Androida i iOS.
Jak przesuwać granice uczenia maszynowego na urządzeniach mobilnych.
Dlaczego AI opuszcza serwery
Kulkarni zaczyna od spostrzeżenia, że urządzenia mobilne stały się dominującym miejscem interakcji z AI, od asystentów cyfrowych po rozpoznawanie twarzy i rzeczywistość rozszerzoną. Najnowocześniejsze sieci neuronowe są jednak budowane z myślą o centrach danych pełnych CPU i GPU. Jeśli doliczyć koszt przesyłania danych użytkowników do chmury i z powrotem, rachunek szybko rośnie.
Uczenie maszynowe na urządzeniu eliminuje te koszty i daje użytkownikom coś lepszego: dostęp niezależny od łączności, wyniki w czasie rzeczywistym i większą prywatność. Jak mówi: „Nikt nie lubi opóźnienia, gdy dane są przesyłane do chmury, tam przetwarzane, a potem odsyłane z powrotem.” (2:38) Ponieważ danych nie trzeba wysyłać na serwer ani tam przechowywać, atakujący mają też mniej luk do wykorzystania.
Wyzwanie pierwsze: rozmiar i pojemność modelu
Telefony mają ograniczoną moc obliczeniową, baterię, pamięć operacyjną i miejsce na dane, a boom na generatywną AI tylko zwiększył rozmiary modeli. Kulkarni bez ogródek mówi o konsekwencjach: „Duży rozmiar aplikacji to wyrok śmierci na urządzeniach mobilnych.” (3:50) Zauważa, że typowy model deep learning ma kilkaset megabajtów, co ma największe znaczenie na rynkach wschodzących, gdzie większość stanowią telefony ze średniej i niższej półki. Według przytoczonych przez prelegentkę badań brak miejsca w pamięci i rozładowywanie baterii to najczęstsze powody odinstalowywania aplikacji. Jej wniosek: „Utrzymanie małego rozmiaru modelu mobilnego i niskich opóźnień jest więc naprawdę nienegocjowalne.” (4:38)
Pierwszą dźwignią jest wybór architektury. Na podstawie wykresów z badań wskazuje EfficientNet jako model, który zyskuje dużo dokładności przy niewielkim wzroście opóźnień, i pokazuje, jak dziedzina odeszła od sieci VGG z ogromną liczbą parametrów. Na urządzeniach mobilnych dotąd dominowały warianty MobileNet, natomiast transformery wnoszą warstwy uwagi i lepsze rozumienie języka, ale trudniej je uruchomić na urządzeniu. Rozwiązania hybrydowe, takie jak MobileViT, próbują połączyć zalety obu podejść.
Drugą dźwignią jest kompresja: przycinanie zbędnych neuronów, destylacja wiedzy z dużego modelu nauczyciela do mniejszego modelu ucznia oraz kwantyzacja do niższej precyzji. Ponieważ takie strojenie jest ręczne i żmudne, prelegentka podkreśla rolę wyszukiwania architektur sieci neuronowych (NAS), które automatyzuje projektowanie sieci. Gdy model musi działać w kilku środowiskach, np. mobilnym, przeglądarkowym i webowym, jeden model wymusza kompromis: „Moglibyśmy więc wdrożyć ten sam model we wszystkich, ale wtedy ograniczałoby nas najbardziej ograniczone środowisko, a w pozostałych działalibyśmy rozrzutnie lub nieefektywnie.” (8:45) Opisuje Once-for-All, opracowane przez grupę badawczą z MIT, które trenuje jedną dużą sieć i wydziela z niej mniejsze, wyspecjalizowane podsieci dla każdej platformy. Według niej to podejście jest też lepsze dla środowiska niż wielokrotne wyszukiwania.
Wyzwanie drugie: wydajność, jank i akceleratory
Drugim wyzwaniem jest maksymalne wykorzystanie ograniczonego i bardzo zróżnicowanego sprzętu, zwłaszcza u wielu producentów urządzeń z Androidem. Gdy GPU ma jednocześnie renderować interfejs i wykonywać wnioskowanie, użytkownicy widzą zacinające się klatki, zwane jankiem. Narzędzia deweloperskie na iOS i Androida pomagają dziś zespołom je profilować i mierzyć.
Kulkarni wskazuje akceleratory sprzętowe wykraczające poza CPU i GPU: XNNPACK w TensorFlow Lite, zapewniający szybsze działanie CPU i modeli skwantyzowanych, Apple Neural Engine do operacji takich jak sploty i mnożenie macierzy oraz Tensor Processing Unit firmy Google. Nie każda warstwa jest wszędzie obsługiwana, dlatego „musimy dostosować nasze modele tak, aby warstwy były zgodne z akceleratorami, których zamierzamy używać.” (12:21) Zespoły mogą też budować systemy rozdzielające warstwy między akceleratory, co staje się kluczowe, gdy kilka modeli rywalizuje o to samo urządzenie.
Wyzwanie trzecie: bezpieczeństwo i znakowanie wodne
Każdy model to znaczna inwestycja czasu, danych i pieniędzy, a dostarczenie go na urządzenia użytkowników naraża go na ryzyko. „Gdy wdrażamy model deep learning na urządzeniach brzegowych lub klienckich, jest on tam znacznie bardziej narażony niż wtedy, gdy odpytuje się go przez API w chmurze.” (12:47) Standardowe zabezpieczenia to szyfrowanie, zaciemnianie kodu i ograniczanie liczby zapytań w celu powstrzymania ataków adwersarialnych.
Następnie przechodzi do znakowania wodnego sieci neuronowych, najnowszego obszaru badań, w którym w modelu osadza się ukryte sygnały własności lub tylne furtki (backdoory). Dobry znak wodny nie wpływa na dokładność, nie wywołuje innych zachowań i przetrwa adwersarialne próby jego usunięcia. Koncepcja jest rozszerzana na generatywną AI, gdzie może pomóc w walce z plagiatem, błędnym przypisaniem autorstwa i nadużyciami. Prelegentka wspomina, że OpenAI zapowiedziało znakowanie wodne wyników ChatGPT, oraz przywołuje artykuł naukowy pokazujący, że GPT-2 można było skłonić do ujawnienia danych osobowych z danych treningowych. W części pytań i odpowiedzi wyjaśnia jedną z proponowanych technik: delikatne promowanie określonych tokenów wybranych z losowego zbioru, niewidoczne dla czytelników, ale możliwe do wykrycia przez badacza.
Generatywna AI i uczenie federacyjne na urządzeniu
Na zakończenie Kulkarni omawia postępy w zmniejszaniu modeli generatywnych. Modele takie jak StableLM i LLaMA firmy Meta mają kilka miliardów parametrów, w porównaniu z setkami miliardów w modelach GPT; WebLLM uruchamia modele językowe w przeglądarce dzięki WebGPU, a SqueezeBits twierdzi, że uruchamia generowanie obrazów Stable Diffusion na telefonie z Androidem. Idzie jednak dalej: „Po co poprzestawać tylko na wnioskowaniu w ML na urządzeniu? Możemy też trenować i aktualizować te modele lokalnie, a dane nigdy nie opuszczą urządzeń użytkowników.” (17:06) Uczenie federacyjne łączy taką lokalną, prywatną personalizację z agregacją w chmurze wielu lokalnie wytrenowanych modeli, dzięki czemu wspólny model uczy się od zróżnicowanych użytkowników bez gromadzenia ich danych.
Obejrzyj wystąpienie
„On-device ML: Artificial Intelligence in your pocket”, Priyanka Kulkarni, 22 minuty: https://www.womentech.net/video/device-ml-artificial-intelligence-in-your-pocket
O prelegentce
Priyanka Kulkarni jest Senior Machine Learning Engineer w Adobe, gdzie pracuje nad innowacjami AI nowej generacji dla urządzeń mobilnych i buduje sieci neuronowe do wdrożeń na urządzeniach i brzegowych. Od pięciu lat stosuje deep learning w trenowaniu, kompresji i optymalizacji modeli, ochronie własności intelektualnej oraz wdrożeniach mobilnych w obszarze analizy i detekcji obrazów dokumentów. Ukończyła studia magisterskie na Carnegie Mellon University ze specjalizacją mobile and pervasive computing.
Pytania, na które odpowiada to wystąpienie
Dlaczego warto uruchamiać uczenie maszynowe na urządzeniu, a nie w chmurze?
Dlaczego rozmiar modelu jest tak krytycznym ograniczeniem na urządzeniach mobilnych?
Czym jest jank i jak zespoły zajmujące się ML na urządzeniu mogą go ograniczyć?
Jak firma może chronić model po wdrożeniu go na urządzeniu użytkownika?
Jak mógłby działać znak wodny w modelu językowym takim jak ChatGPT?
Wersja robocza przygotowana przez AI na podstawie transkrypcji wystąpienia. Oczekuje na weryfikację redakcyjną.
Frameworks and ideas mentioned
Neural architecture search
Once-for-All
Network pruning
Knowledge distillation
Quantization
Neural network watermarking
Federated learning
Resources mentioned
TensorFlow Lite XNNPACK
Apple Neural Engine
Once-for-All (MIT)
WebLLM
Cite this talk
Priyanka Kulkarni. "On-device ML: Artificial Intelligence in your pocket." WomenTech Network, 2023. https://www.womentech.net/video/device-ml-artificial-intelligence-in-your-pocket