WhoBuilt

MLC LLM + React Native: On-Device AI Without the Pain

Feb 24, 2026· 8 min· 1.2K views·Watch on YouTube

Speaker

Artur Morys-Magiera, senior React Native developer on Callstack’s R&D open source team, explains the React Native AI/MLC runtime in the React Native AI Unpacked series.

How MLC runs models on devices

MLC LLM builds and optimizes an app for the models it will run, using techniques such as memory planning, operator fusion and hardware-specific optimizations. It can use GPU drivers such as OpenCL and Vulkan, or optimize for CPU instruction sets on devices without GPU support. MLC supports platforms including iOS, Android, desktop systems and the web.

Model choice and a consistent API

MLC lets developers use third-party models, including models from Hugging Face, or bring their own converted models. Callstack’s React Native AI/MLC package supports the AI SDK, so developers can use a consistent API across MLC, Apple’s built-in models and other runtimes. That makes it easier to switch runtimes based on an app’s needs.

Selecting and preparing a model

The demo app lists models bundled with the library and lets users choose one. The app fetches the available models, constructs a language model, downloads it and prepares it for use. The initial download can take a while; subsequent setup takes a few seconds.

Text, structured output and streaming

The demo shows three modes: full text generation, streaming output as tokens arrive, and structured output parsed against a schema. For structured output, the example uses the AI SDK’s `generateObject` with a Zod schema for a name and description; smaller models may sometimes produce invalid JSON. The text example uses Llama 3 with 3 billion parameters.

Integration and support

The examples use Vercel’s AI SDK syntax, including `generateText`, `generateObject` and `streamText`, without extra API differences to manage. Morys-Magiera describes the integration as straightforward and directs users to the documentation or GitHub issues for help.

Takeaways

  • Choose the model or models your app needs, then build with MLC optimizations targeted to them.
  • Plan for an internet download when a model is first installed; later setup takes a few seconds in the demo.
  • Use GPU acceleration where available and CPU instruction optimizations on devices without GPU support.
  • Validate structured output against a schema, since models can return invalid JSON.
  • The AI SDK API can make it easier to switch between Apple and MLC runtimes.

Mentioned in this talk

Search inside this talk

What was claimed 7

Related talks