Blog

On-Device AI: Integrating Small Language Models into Enterprise Mobile Apps

Learn how to deploy Small Language Models (SLMs) on mobile devices using LiteRT-LM, ExecuTorch, and INT4 quantization without exceeding OS memory limits.

About this article

  • Published on September 14, 2026
  • 7 min read
On-Device AISmall Language ModelsMobile ArchitectureExecuTorchLiteRT

Running generative language models directly on mobile hardware has moved from experimental research into practical enterprise architecture. Shifting inference from remote cloud clusters to local silicon cuts cloud API costs, lowers latency, keeps apps working offline, and simplifies compliance with privacy regulations like LGPD, GDPR, and HIPAA.

Deploying small language models (SLMs) on mobile devices requires different software engineering trade-offs than building cloud services. You cannot simply drop an unconstrained conversational agent onto a smartphone. It takes strict memory budgets, silicon-level hardware acceleration, quantization pipelines, and hybrid architectures.

The sub-3B parameter frontier: balancing quality and memory footprints

Until recently, the compute and memory demands of transformer architectures made local mobile inference impractical. Mobile operating systems enforce aggressive memory constraints, often allocating under 4 GB of usable RAM to any single application process. Pushing past these boundaries triggers the operating system's Low Memory Killer (LMK), terminating the host process.

Modern sub-3-billion parameter models fit within these operational limits. Three model families serve as the primary options for mobile workloads:

  • Meta Llama 3.2 (1B and 3B): Released in late 2024 for on-device and edge deployment, trained on up to 9 trillion tokens, with a native context window up to 128k tokens.
  • Google Gemma 2 (2B and 2.6B): Optimized for low memory use and instruction following, widely used as a standard reference on Android.
  • Microsoft Phi-3.5-mini (3.8B) and Phi-4-mini: Built for complex multi-step reasoning, though their size pushes the ceiling of mobile hardware limits.

Raw weights in standard 16-bit brain floating point (BF16) format are too large for consumer devices. For example, uncompressed Llama 3.2 1B in BF16 requires a ~2.36 GB download and consumes roughly 3.18 GB of active RSS memory. The 3B version needs a ~6.13 GB download and takes ~7.42 GB of RSS memory, which crashes standard mobile operating environments.

Post-training quantization (PTQ) and quantization-aware training (QAT) with Low-Rank Adaptation (LoRA) bring these models into viable territory. Meta introduced SpinQuant and 4-bit integer (INT4) groupwise per-channel quantization. SpinQuant INT4 compresses Llama 3.2 1B to a 1.08 GB binary (a 54.1% reduction). For the 3B model, INT4 compression cuts the binary down to 2.43 GB, making production on-device execution viable.

Mobile runtimes: ExecuTorch, KleidiAI, and LiteRT-LM

Running models on mobile devices requires moving away from Python and server-side wrappers toward C++ execution engines that interface directly with mobile Neural Processing Units (NPUs), GPUs, and CPU instruction sets.

Meta ExecuTorch and Arm KleidiAI

Meta built ExecuTorch to execute PyTorch models efficiently on edge hardware. In late 2024, Arm integrated KleidiAI routines directly into ExecuTorch via XNNPACK. On Arm Cortex-A v9 mobile CPUs with the i8mm vector ISA extension, this pipeline delivers up to a 20% speed improvement without requiring custom NPU configuration.

Google LiteRT and LiteRT-LM

In late 2024, Google rebranded TensorFlow Lite as LiteRT. As Google unified its edge AI infrastructure, LiteRT-LM became the designated runtime for on-device conversational models across Android and iOS.

LiteRT relies on hardware delegates to offload tensor computation to Qualcomm Hexagon NPUs, MediaTek APUs, or mobile GPUs. This prevents heavy inference cycles from monopolizing CPU threads.

Apple CoreML and the Apple Neural Engine

On iOS, developers convert models using coremltools to target Apple's 16-core Apple Neural Engine (ANE). Executing inference on the ANE preserves battery life and keeps both the CPU and GPU available for user interface rendering and background processes.

Performance benchmarks and the memory iceberg

Measuring on-device performance requires evaluating two distinct stages: prefill (processing the input prompt) and decode (generating subsequent tokens).

Empirical benchmarks on flagship chipsets like the Qualcomm Snapdragon 8 Gen 3 highlight the throughput advantages of INT4 quantization:

  • Llama 3.2 1B (INT4 SpinQuant):
    • Time-to-first-token (TTFT): 0.3 seconds (a 76% decrease from 1.0s in BF16).
    • Prefill speed: ~260 to 350+ tokens per second.
    • Decode speed: ~45 to 50.2 tokens per second.
    • Active RAM (RSS): ~1.92 GB.
  • Llama 3.2 3B (INT4 SpinQuant):
    • Time-to-first-token (TTFT): 0.7 seconds (down from 3.0s in BF16).
    • Prefill speed: ~89.7 tokens per second.
    • Decode speed: ~19.7 tokens per second.
    • Active RAM (RSS): ~3.72 GB.

The memory iceberg

A frequent mistake in mobile AI projects is equating the binary file size with the runtime memory footprint. A 1.1 GB model file frequently expands into 2.0 GB to 2.5 GB of system memory once runtime libraries, static weights, activation buffers, and the Key-Value (KV) cache are initialized.

As the prompt and generation length expand, dynamic KV cache allocations can easily push total app footprint past the threshold where the operating system terminates background tasks or kills the foreground application. Engineering teams must manage the model lifecycle dynamically, allocating buffers on demand and aggressively evicting weights from memory when inference concludes.

Lidex Soluções Digitais — technology that transforms businesses

Thermal limits and continuous inference

While short benchmark bursts yield impressive generation speeds, mobile hardware cannot sustain peak compute cycles indefinitely.

During prolonged sessions—such as multi-turn conversations or extensive document summarization—mobile GPUs and NPUs heat up rapidly. This triggers thermal throttling within 2 to 3 minutes, reducing sustained generation throughput by 30% to 50%.

Furthermore, continuous on-device inference draws substantial battery power due to intensive matrix multiplication. Left unconstrained, continuous generation loops can deplete a device's battery in hours. To maintain device stability, on-device inference should run in discrete, short bursts rather than uninterrupted generation streams.

Model load times also shape the end-user experience. Transferring an SLM from flash storage into RAM typically requires 1.5 to 3.5 seconds. Mobile apps must account for this latency through transparent loading indicators, asynchronous initialization, or background preloading before user interaction occurs.

Architectural patterns for on-device SLMs

Open-ended text generation on mobile hardware frequently risks formatting deviations, hallucinations, and context dilution. Production architectures achieve the highest reliability by adopting hybrid edge-cloud patterns where on-device models execute targeted, deterministic subtasks.

At Lidex Soluções Digitais, our engineering teams focus on deterministic, short-burst tasks for edge models. Four design patterns consistently deliver production stability:

1. Local data scrubbing and PII redaction

Regulatory frameworks such as LGPD, GDPR, and HIPAA mandate strict handling of sensitive information before network transmission. A local 1B model functions as an edge privacy gateway. Before field audit forms, support tickets, or clinical notes sync to cloud databases or remote foundation models like Claude or GPT-4, the local SLM identifies and anonymizes names, identification numbers, and sensitive health markers locally.

2. Offline field operations

In sectors like agritech, mining, maritime logistics, and utility field repair, personnel routinely work in environments without cellular coverage. An on-device SLM parses unstructured voice transcripts or field notes into structured JSON containing error codes, maintenance parts, and billable hours entirely offline, queuing clean payloads for later synchronization.

3. Constrained execution

Edge deployments yield the highest accuracy when tightly constrained: entity extraction, classification, structured schema normalization, or summaries bounded to under 50 tokens. Coupling these outputs with deterministic validation, such as strict regex enforcement or JSON Schema compilers, prevents parsing errors downstream.

4. Speculative routing and tiered processing

A tiered architecture partitions computation intelligently between mobile hardware and cloud infrastructure. Routine, low-latency interactions—such as intent routing, triage, and local search querying—execute locally with sub-300ms latency and zero per-call API cost. Complex multi-step reasoning and heavy context synthesis route to cloud endpoints when connectivity is available.

Engineering guidelines for production deployment

To integrate on-device language models into enterprise mobile apps reliably, keep these core guidelines in mind:

  1. Enforce INT4 quantization: Never distribute unquantized floating-point weights to client devices. Groupwise INT4 per-channel quantization keeps binary payloads and RAM overhead within sustainable operating margins.
  2. Limit output token lengths: Scope generations to short bursts (such as structured key-value pairs or concise summaries) to avoid triggering thermal throttling and KV cache memory bloat.
  3. Account for cold-start latency: Plan for the 1.5 to 3.5-second model loading delay from flash storage to RAM. Implement lazy-loading or background pre-warming routines.
  4. Require structured outputs: Restrict model outputs to predefined JSON schemas rather than free-form conversational text to ensure deterministic downstream handling.
  5. Maintain deterministic code fallbacks: Implement baseline programmatic fallbacks (such as local regex matching or pattern parsers) to safeguard application flow whenever an SLM produces invalid schema syntax.

By treating the smartphone as a specialized edge coprocessor, engineering teams can deliver responsive, privacy-compliant mobile capabilities that function reliably regardless of network connectivity.