Placement and purpose
Choose where the work belongs
Inference executes an already-trained model on new input. It uses learned parameters without necessarily updating them; fitting and inference are different operations. Placement determines where that computation happens. On-device means on the endpoint itself—the phone, laptop, browser host, or embedded device through which the feature operates. Local needs a more explicit description: a server in the same building is near the user, but it is still another machine with its own operator and communication dependency.
| Placement | Communication dependency | Data movement | Resource responsibility |
|---|---|---|---|
| Endpoint | Inference can avoid a network connection. | Inputs need not leave for model execution. | The endpoint supplies memory, computation, and energy. |
| Nearby server | The endpoint must reach another machine; internet access may be unnecessary. | Request data cross a machine boundary. | The server operator supplies inference resources. |
| Remote service | The endpoint must reach the service. | The service receives the submitted representation. | The provider operates inference; the application still owns integration. |
Start with the workload's required capability, response deadline, frequency, and permitted data destinations. A detector for a spoken activation phrase makes a narrow decision repeatedly while listening. Open-ended text assistance must handle a much broader range of requests, but may run only when invoked. These differences change the acceptable model and execution budget. Apple's historical wake-phrase detector gated expensive processing; other assistant operations could run elsewhere.
Moving inference onto user hardware can remove provider inference charges for that operation, but it transfers resource consumption rather than eliminating it. Compare costs per completed useful task at comparable quality and service requirements, including installation, support, energy, and failed attempts where relevant. A marginal comparison using hardware already owned answers a different question from a full ownership comparison. AI Cost and Performance Engineering develops that accounting. Here, the immediate decision is which placement can meet the feature's requirements at an acceptable operating burden.
Trace information beyond inference
Keeping inference on a device removes one recipient from the processing path. It does not describe every copy the application creates. Privacy concerns appropriate handling of information about people; confidentiality concerns protection against unauthorized disclosure. An application can exclude outsiders while retaining information for an inappropriate purpose. The distinction belongs to Privacy and Data Governance; the local deployment task is to identify the actual processing and storage paths that must obey those decisions.
| Artifact | What to establish |
|---|---|
| Input and intermediate values | Which process receives them, which temporary buffers or files exist, and when they are released. |
| Output and conversation history | Whether they are displayed only, saved locally, exported, or synchronized. |
| Diagnostics | Whether errors, traces, or crash reports contain content, identifiers, or credentials; who receives them. |
| Backups and shared storage | Which files are copied, which account controls the destination, and which retention rules apply. |
The auxiliary paths are concrete. Android Auto Backup includes most application files, databases, and preferences by default, subject to configuration and operating conditions. An internally stored transcript therefore is not necessarily confined to that device. Model acquisition is a different flow: downloading weights does not inherently upload a prompt, but a client may still make metadata checks, attach authentication, or send telemetry. The Hugging Face Hub documents separate controls for these behaviors. Treat operational networking and user-content transfer as separate entries, not as a single online/offline flag.
Local inference, separate disclosure paths
ExampleA local model can coexist with external diagnostic and backup recipients.
Read the diagram as text
- On device: Input. On-device application input.
- On device: Local inference. On-device model execution and temporary numerical state.
- On device: Saved result and history. On-device persistent application records.
- On device: Diagnostic record. On-device error record; content depends on application instrumentation.
- External diagnostics service. A recipient outside the device.
- External backup destination. A separate storage recipient controlled by backup configuration and account policy.
- On device: Input → On device: Local inference: Data: model input.
- On device: Local inference → On device: Saved result and history: Data: output selected for storage.
- On device: Local inference → On device: Diagnostic record: Data: error details if recorded.
- On device: Diagnostic record → External diagnostics service: Data: exported fields if enabled.
- On device: Saved result and history → External backup destination: Data: included files if backup runs.
Local serving also has an access boundary. Ollama binds its server to loopback by default, but changing the bind address or adding a proxy can expose it to other machines. Its cloud features are a separate configuration choice. Nor does process isolation make a compromised host trustworthy: a sandbox can constrain untrusted code while still depending on the host for its protection. Inspect mapped files and permitted connections, and use process isolation's threat model rather than equating a separate process with confidential storage.
Capability and development
Select a sufficient capability
A candidate is a model–runtime–device combination, not a model name. Weights are the numerical parameters fitted during training; an inference runtime loads the model and executes its computation. The same weights can encounter different supported operations, memory behavior, and execution paths in different runtimes. Begin by specifying useful behavior through task-quality criteria, then consider combinations capable of providing it. Parameter counts become relevant when estimating resource requirements, not as a substitute for the task definition.
| Requirement | Selection consequence |
|---|---|
| Input type and language | A text model does not satisfy an audio-input requirement merely because both produce text. |
| Output meaning | A class label, formatted action request, and conversational answer need different checks. |
| Input limits | Test the actual lengths, resolutions, or durations the feature promises to accept. |
| Acceptable errors | Compare candidates on the same relevant cases and against a simple baseline. |
| Deployment permission | Review the exact artifact's terms independently of technical compatibility. |
Specialization can change which size is sufficient. MobileLLM, introduced by Zechun Liu and colleagues at Meta in February 2024, studied architectures below one billion parameters for on-device uses. Its specialized API-calling experiment checked two requirements separately: identifying the intended operation and producing the expected call structure. Using generated training and test cases, the 350-million-parameter model scored above the seven-billion-parameter LLaMA-v2 model on intent exact match, but below it on structure exact match. Choosing the right operation and formatting its call correctly are both necessary; a gain on one does not settle the other. This was a bounded task comparison, not general-assistant equivalence. Separate phone profiling used other model variants, so it did not establish device performance for the model in this comparison.
Google's FunctionGemma makes the intended-use distinction explicit: it is not intended as a direct dialogue model. Its Mobile Actions evaluation measures identifying and formatting system calls, not whether an authorized action succeeded. Meanwhile, open-weight means model parameters are available; it does not mean every use or redistribution is unrestricted. Model-card metadata can point to a license, but review the actual terms and referenced policies for the exact revision. The runtime's software license is a different agreement.
Turning points in local deployment
Local AI predates general-purpose language models. Earlier systems made recognition useful by constraining the task; later work made neural models easier to fit, execute, and distribute. These are continuing lines of development. A compact detector and a generative assistant can coexist because they serve different output requirements and operating schedules.
Turning points in local deployment
December 1995 — first shipmentNewton Print RecognizerCombined neural character recognition with contextual searches over strokes and words.
Contributors: Apple’s Print Recognizer team.
What changed: Shipped in Newton OS 2.0 MessagePad 120 units. Restricting input to hand printing helped segmentation, while allowing words outside dictionaries avoided forcing every input into a known word.
April 17, 2017 — preprintMobileNetsMade network width and input resolution adjustable for constrained mobile vision.
Contributors: Google researchers.
What changed: Factorized convolutions and adjustable architecture settings offered resource tradeoffs across recognition tasks. The paper distinguished small model storage from fast execution.
November 14, 2017 — developer previewTensorFlow LiteSeparated conversion, portable model files, application APIs, and an interpreter.
Contributors: The TensorFlow team.
What changed: Targeted smaller runtime binaries, faster initialization, and mobile acceleration. The preview deliberately supported a constrained model set; TensorFlow Mobile remained the production option while Lite matured.
November 29, 2023 — first releasellamafileBrought model weights and execution software together in portable executable files.
Contributors: Developed by Justine Tunney; announced by Mozilla.
What changed: Combined llama.cpp with Cosmopolitan Libc to reduce the separate installation and setup needed to try local language models across operating systems.
These developments changed different constraints: what a model recognizes, the resources it requires, how a runtime executes it, and how the application distributes it. Those constraints still need to be satisfied together.
The language-model branch benefited from compact execution software as well as model availability. An early llama.cpp snapshot documented four-bit LLaMA inference on a MacBook CPU, with conversion and quantization tools alongside C/C++ execution. Its published demonstration covered the 7B model, not every architecture or device. This contribution made an existing language model more accessible; it did not remove the memory, energy, or reliability reasons to use dedicated predictors.
Execution and resource fit
Verify the execution path
A model's computation consists of operators, numerical operations on tensors, or shaped arrays. A central processing unit (CPU) runs general application and numerical work. A graphics processing unit (GPU) executes parallel numerical workloads. A neural processing unit (NPU) specializes in neural-network operations. Hardware presence is not hardware use: a backend, called an execution provider in ONNX Runtime, supplies implementations targeting a particular execution system.
ONNX Runtime assigns portions of a model's computation graph according to provider capabilities. Compatibility therefore depends on architecture, operator versions, shapes, numerical formats, and the installed runtime and platform stack. A provider may execute only part of the graph. The remaining work may run on another backend or fail if no supported path exists. Neither an exported file nor an installed accelerator provider proves the intended placement.
Partial acceleration can be worse than consistent CPU execution. LiteRT's GPU-delegate documentation warns that splitting unsupported operations onto the CPU can add synchronization overhead that outweighs the accelerated work. The important relationship is the intermediate data crossing between execution regions, not merely the percentage of supported operators. Google's 2024 renaming of TensorFlow Lite to LiteRT reflected its broader framework support; it did not imply universal operator compatibility.
Static inspection helps locate risks, but execution must settle performance. ONNX Runtime's published mobile checker example assigns 120 of 122 ResNet nodes to two CoreML partitions while reporting unsupported-operation and shape conditions. That is a compatibility estimate, not a trace or speedup. Inspect actual placement and compare against CPU execution. Platform tracing can separate loading, CPU preparation, operator execution, and NPU activity instead of treating a utilization indicator as the complete request.
The application boundary changes delivery requirements too. Native integration calls an embedded runtime; a local service adds an API and endpoint-access boundary; browser inference depends on browser-managed execution and assets. ONNX Runtime Web needs JavaScript, appropriate WebAssembly binaries, and model data, including external tensors where used. Its WebGPU path requires a secure context. Hardware-specific variants can simplify selection: the Foundry Local demonstration exposed different optimized variants according to device hardware. Such discovery narrows candidates; testing still qualifies the selected combination.
Budget resident memory
Storage holds the package; execution needs a working set, the data required while computation proceeds. That includes resident weights, activations produced between model operations, temporary workspaces, runtime reservations, and request state. The application and operating system need memory too. Apply the inference capacity envelope to the whole device, leaving headroom rather than assigning installed RAM entirely to the model. Peak simultaneous allocations matter more than a sum of unrelated measurements taken at different times.
For attention-based language models, memory demand also includes state retained from earlier input. Text is processed as tokens, model-specific units of text. The key-value (KV) cache stores numerical representations of processed tokens so generation can reuse earlier computation. It is neither the text itself nor durable conversational memory. A dynamic cache grows as tokens arrive; a static cache reserves capacity in advance. Sliding-window layers retain only a bounded span of history. These choices change how memory demand responds to a longer request; Inference Engineering explains the mechanism. Test input length, image dimensions, active requests, and multiple resident models explicitly rather than estimating every workload from one model-file size.
Unified memory lets processors share a physical pool; MLX on Apple silicon uses this arrangement without explicit array copies between separate CPU and GPU memory spaces. It does not make capacity unlimited. Likewise, memory mapping gives a file a virtual address range, not guaranteed RAM residency; later access can still cause storage-backed page faults. When measuring shared memory, avoid double counting. Android's resident set size, or RSS, includes shared pages, whereas proportional set size, or PSS, allocates a fraction of those pages to each process.
File size and resident memory differ even for a small model. FunctionGemma's Mobile Actions dynamic-int8 entry reports a 288 MB model file but 551 MB peak RSS. The test used a Samsung S25 Ultra CPU with LiteRT XNNPACK, four threads, 512 prefill tokens, and 32 decode tokens, with a 1024-token context configuration. Prefill processes the supplied prompt; decode produces subsequent output. These conditions matter because the measurement includes a particular request's state, not just loaded weights. The short test does not establish sustained phone performance.
Suppose an application has 4 GiB available after reserving system needs and headroom. Hold its model, precision, runtime, and concurrency fixed. Longer input increases only the input-dependent allocation in this example; resident weights and other fixed allocations remain unchanged.
Unchanged weights, different memory demand
ExampleInput-dependent state can cross the usable budget while fixed allocations remain unchanged.
Short input: 3.5 GiB
Weights use 2 GiB, fixed application/runtime allocations 1 GiB, and input-dependent state 0.5 GiB.
- 1. Resident weights: 2 GiB
- 2. Fixed app and runtime: 1 GiB
- 3. Input-dependent state
- 4. Usable budget: 4 GiB
Read coordinates and regions as data
X: 0–1 dimensionless; Y: 0–5 GiB, increasing up. Axes scaled independently; screen angles and distances are not comparable.
(0.2, 0); (0.8, 0); (0.8, 2); (0.2, 2)
(0.2, 2); (0.8, 2); (0.8, 3); (0.2, 3)
(0.2, 3); (0.8, 3); (0.8, 3.5); (0.2, 3.5)
(0.05, 4); (0.95, 4)
Weights: 2 GiB: (0.5, 1.1)
Fixed: 1 GiB: (0.5, 2.6)
State: 0.5 GiB: (0.5, 3.35)
4 GiB budget: (0.5, 4.2)
0.5 GiB remaining: (0.5, 3.75)
Long input: 4.5 GiB
Fixed allocations are unchanged. Input-dependent state rises to 1.5 GiB, exceeding the budget by 0.5 GiB.
- 1. Resident weights: 2 GiB
- 2. Fixed app and runtime: 1 GiB
- 3. Input-dependent state
- 4. Usable budget: 4 GiB
Read coordinates and regions as data
X: 0–1 dimensionless; Y: 0–5 GiB, increasing up. Axes scaled independently; screen angles and distances are not comparable.
(0.2, 0); (0.8, 0); (0.8, 2); (0.2, 2)
(0.2, 2); (0.8, 2); (0.8, 3); (0.2, 3)
(0.2, 3); (0.8, 3); (0.8, 4.5); (0.2, 4.5)
(0.05, 4); (0.95, 4)
Weights: 2 GiB: (0.5, 1.1)
Fixed: 1 GiB: (0.5, 2.6)
State: 1.5 GiB: (0.5, 3.6)
0.5 GiB over budget: (0.5, 4.75)
Memory can also shape the model itself. MCUNet, presented by Ji Lin and colleagues in 2020, paired architecture search with model-specific execution and intermediate-storage planning for microcontrollers. Its contribution was to design the model and runtime together under resource limits. That principle remains useful at larger scales: shrinking weights is only one way to fit the complete execution.
Choose precision for the deployment
Quantization represents selected numerical values approximately using fewer bits. It can reduce weight storage and residency, while changing outputs and requiring compatible execution support. Mixed precision keeps different values at different precisions instead of compressing everything equally. The Quantization chapter explains formats, calibration, and algorithms; the deployment decision here is whether a supported representation meets the task and resource requirements.
| Choice | What it targets | What it does not establish |
|---|---|---|
| Lower-bit weights | Weight payload and potentially resident weight bytes. | Equal reductions in application buffers, request state, or total latency. |
| Lower-precision KV state | Retained attention-state storage. | Smaller weights or validated support for a longer model context. |
| Execution precision and backend | How supported operations perform arithmetic. | That the package's storage bit label describes every computation. |
Returning to the budget example, reducing its 2 GiB weight allocation to 1 GiB would save 1 GiB—not half of the 4.5 GiB total. That could resolve capacity while leaving transfer overhead or slow output production unchanged. Conversion overhead and backend support can also make smaller representations slower. A Practical Guide to Efficient AI motivates weight compression, but a deployment still needs its own matched comparison of useful outputs, peak residency, and execution time.
Select precision using representative development cases, then keep the final assessment separate. Repeatedly adjusting quantization, prompts, or decoding after examining the final test set turns that set into selection data. Preserving this separation lets the final result estimate behavior beyond the examples used to choose the package.
Find the delay that matters
Memory capacity determines what can remain available; memory bandwidth describes how quickly bytes move. Compute capacity describes arithmetic throughput. A workload with little computation per byte moved can wait on memory even when arithmetic units have spare capacity. The Roofline model formalizes this relationship, but its upper performance envelope is not an end-to-end latency prediction. Application preparation, transfers, synchronization, queueing, and result delivery remain outside a headline arithmetic rate.
For language generation, prefill processes the supplied prompt; decode incrementally produces subsequent output using retained state. Their different execution shapes can expose different bottlenecks. Long prompts may make response onset expensive even when later output is fluid. Conversely, quick onset can precede slow generation. Recall prefill and decode rather than treating one tokens-per-second figure as the experience.
| Measurement | What it describes | What it leaves open |
|---|---|---|
| Time to first token | For a client benchmark, request send to first response receipt. | Final completion time and later output cadence. |
| Output-token throughput | Generated tokens divided by benchmark duration. | Each user's pace when several requests overlap. |
| Speech real-time factor | Processing time divided by supplied audio duration. | Live capture delay and the time until partial text becomes final. |
Improving one stage saves only the time that stage contributes to the complete request. Consider an illustrative 100 ms request on a separate-memory accelerator path, with all stages running sequentially: 40 ms preparing input, 20 ms transferring it, 20 ms executing the model, 10 ms returning results, and 10 ms delivering them. Halving model execution saves only 10 ms, leaving a 90 ms request. When stages overlap, adding their durations overstates elapsed time. Instead, identify the critical path: the chain of dependent work that determines when the result can be delivered.
Admission control limits the work accepted into a bounded system. On a shared device, cap input size, output work, and concurrent requests before they consume the budget needed for interaction. For continuous media, check whether processing keeps up with arriving audio or frames; accumulating a queue can hide failure until results become stale. When capacity is insufficient, explicitly defer, reduce the promised service, or reject work. Scheduling and admission explains the mechanisms; scheduling cannot make sustained demand above capacity disappear.
Delivery and lifetime
Deliver a compatible package
Model packaging assembles the artifacts and metadata needed to install and execute a capability. A manifest records their identities and compatibility requirements: weights, architecture configuration, preprocessing, output conventions, runtime dependencies, and applicable terms. For text models, a tokenizer maps text to model-specific identifiers, while a chat template serializes message roles and boundaries. Using the wrong template can change behavior even when the weights load successfully. Keep these components together and follow checkpoint-specific serialization.
A package may contain a portable model representation or artifacts prepared for a particular execution target. Apple's documented Core ML download workflow compiles a downloaded model before instantiating it and recommends persisting reusable compiled output. Browser packages also need execution binaries and worker assets, not just weights. Successful delivery must therefore be followed by preparation and compatibility checks for the intended environment.
Bundling makes artifacts part of application delivery; downloading separately can avoid shipping every model to every user but introduces another installation lifecycle. Plan space for the existing package, staged replacement, and preparation output. Keep incomplete downloads outside the active package, and specify whether interruption resumes or restarts acquisition. Chrome's managed models, for example, support documented download resumption and download complete replacements while the existing model remains usable. Those are that platform's guarantees, not properties of every model installer.
Verify origin, integrity, and update freshness separately from compatibility. An authenticated hash can identify approved bytes; it cannot establish that those bytes are safe or that individually valid files form a compatible release. The Update Framework combines trusted keys, signed metadata, hashes, versions, and expiry checks because a valid signature alone does not prove freshness. Broader loader and supply-chain risks belong in AI Security.
A useful installation design stages and validates a complete release before changing a small active-version record. Atomic activation means readers observe the old selection or the new one, not a partly written selection. Android's AtomicFile can replace one file through synchronized writing and rename; it supplies no locking or multi-file package transaction. Package completeness, concurrent access, and recovery remain separate responsibilities. Retain a compatible recovery package only while policy still permits it—recovery is not permission to accept an arbitrarily old signed release.
Change the record, keep release identities
ExampleBoth views keep packages A and B in the same positions; only the active selection moves.
Before: select A
A remains selected while B is staged separately and checked for completeness, compatibility, integrity, origin and freshness. The record cannot select incomplete B.
- 1. Active-version record
- 2. Package A: unchanged release
- 3. Package B: unchanged release
- 4. Active selection
Read coordinates and regions as data
X: 0–10 layout; Y: 0–8 layout, increasing down. Axes scaled independently; screen angles and distances are not comparable.
(3.3, 0.7); (6.7, 0.7); (6.7, 2); (3.3, 2)
(0.6, 4.2); (4.4, 4.2); (4.4, 6.3); (0.6, 6.3)
(5.6, 4.2); (9.4, 4.2); (9.4, 6.3); (5.6, 6.3)
(5, 2); (5, 3); (2.5, 3); (2.5, 4.2)
Active record: A: (5, 1.6)
Package A: (2.5, 4.95)
Same release A: (2.5, 5.65)
Package B: (7.5, 4.95)
Same release B: (7.5, 5.65)
Selects: (5, 2.7)
B staging + checks before selection: (5, 7.2)
After: select B
B is complete and validated before the active record changes. Package identities and contents remain fixed. A may be retained only while recovery policy permits.
- 1. Active-version record
- 2. Package A: unchanged release
- 3. Package B: unchanged release
- 4. Active selection
Read coordinates and regions as data
X: 0–10 layout; Y: 0–8 layout, increasing down. Axes scaled independently; screen angles and distances are not comparable.
(3.3, 0.7); (6.7, 0.7); (6.7, 2); (3.3, 2)
(0.6, 4.2); (4.4, 4.2); (4.4, 6.3); (0.6, 6.3)
(5.6, 4.2); (9.4, 4.2); (9.4, 6.3); (5.6, 6.3)
(5, 2); (5, 3); (7.5, 3); (7.5, 4.2)
Active record: B: (5, 1.6)
Package A: (2.5, 4.95)
Same release A: (2.5, 5.65)
Package B: (7.5, 4.95)
Same release B: (7.5, 5.65)
Selects: (5, 2.7)
B passed checks before selection: (5, 7.2)
Separate installed from ready
Readiness means the capability can accept the specified work now. An installed package may still need loading, compilation, runtime-session creation, or warmup. A cold start performs missing setup; a warm request reuses prepared state. Residency is the decision to keep that state allocated. Reuse can shorten first-response delay, but competes with the rest of the device for memory. Warm execution is not startup.
| Entry condition | Acquisition | Preparation | Request execution |
|---|---|---|---|
| First installation | Required unless bundled. | Verify and prepare the delivered artifacts. | Begins after readiness. |
| Installed cold start | Unnecessary if all valid artifacts persist. | Load and recreate runtime state; reuse valid compiled artifacts where supported. | Still pays missing setup. |
| Resident warm request | Normally unnecessary. | Reuse the live compatible session. | Measures the already-prepared path. |
Eager preparation pays setup before the user asks; lazy preparation waits until the capability is needed. Neither choice eliminates reclamation. Android can terminate processes under memory pressure, so an active inference thread is not durable progress. Chrome can freeze page tasks or discard a page without a final cleanup callback. Save application state before it becomes vulnerable, then distinguish reconstructing a task from saved inputs from resuming the exact interrupted numerical computation.
Artifact loss creates a different recovery path from process loss. Chrome's managed model can be purged under disk pressure or changed eligibility, including during a session; another download may then be necessary. A lost session or accelerator instead requires checking whether installed artifacts can recreate a usable execution path. The Foundry Local demonstration avoided model-download dependence by fetching models in advance. It establishes the value of preparation, not indefinite readiness after every kind of loss.
Session loss and artifact loss need different recovery
ExampleRetained files can enable local reinitialization; missing required files require provisioning.
Read the diagram as text
- Live session lost. Process termination or page discard removes live runtime state. Persistent artifacts may remain. A frozen page is a different condition.
- Check retained artifacts. Establish whether every required artifact is present and valid and whether a usable execution path remains.
- Reinitialize locally. Load artifacts, reuse valid compiled output where supported, and recreate runtime state. Saved inputs can reconstruct a task, not necessarily resume interrupted numerical computation.
- Ready for supported work. Preparation has succeeded for the specified task and execution path. Later reclamation can invalidate readiness.
- Required artifacts lost. For example, a managed model is purged under disk pressure or changed eligibility. Files must be reacquired before they can support a new session.
- Unavailable pending recovery. While disconnected, missing required downloads prevent local recovery. If artifacts remain but execution is unusable, that execution path needs repair.
- Reprovision required artifacts. Acquire missing files when an eligible, permitted provisioning path is available. Before reinitialization, check that all required artifacts are complete and valid and the execution path is usable. Otherwise the capability remains unavailable; reconnection alone does not make it ready.
- Live session lost → Check retained artifacts: Inspect persistent state.
- Check retained artifacts → Reinitialize locally: Complete, valid, usable.
- Reinitialize locally → Ready for supported work: Preparation succeeds.
- Check retained artifacts → Unavailable pending recovery: Required dependency missing or unusable.
- Required artifacts lost → Unavailable pending recovery: Capability requires missing files.
- Unavailable pending recovery → Reprovision required artifacts: Missing files; provisioning permitted and available.
- Reprovision required artifacts → Reinitialize locally: Artifacts complete and valid; execution usable.
Cancellation also has a scope. Chrome's Prompt API distinguishes aborting a prompt from destroying its session; session destruction stops execution and frees session resources, without promising immediate unloading of shared model weights. ONNX Runtime's Java termination flag applies to every incomplete run sharing that RunOptions object. Give independent requests independent cancellation scope where required, and do not report resource release merely because the interface stopped displaying output. See interruption and cancellation.
Sustained operation
Design within energy and heat limits
Power is the rate of energy use; energy per completed task depends on both power and duration. A thermal budget describes the heat load a device can sustain under stated conditions. Thermal throttling reduces performance to control temperature. Short bursts can run at settings that prolonged execution cannot maintain. Ambient conditions, recent use, and device design change the result, so a fast first request does not establish a sustainable processing rate.
Measure the complete work interval, including sensing, preparation, memory movement, and relevant idle overhead. Lower instantaneous power can still consume more energy if execution takes longer. For illustration, 2 watts over 3 seconds uses 6 joules, while 3 watts over 1 second uses 3 joules. This arithmetic is not a device comparison. It explains why an energy decision needs completed work and elapsed time alongside power.
Duty cycle is the fraction of time a workload is active. Apple's October 2017 Hey Siri account described staged sensing: a continuous low-power auxiliary detector woke the main processor for a larger check only after sufficient detection, reducing expensive activation. Accepted audio could then reach Siri's server; the assistant was not entirely local.
Hey Siri: conditional activation
The larger detector runs conditionally.
Read the diagram as text
- Audio.
- Auxiliary processor: detector. Auxiliary processor.
- No wake for this detector. This decision does not determine whether unrelated applications use the main processor.
- Main processor: larger check. Main processor.
- Activation rejected.
- Accepted local detection. An assistant request can continue to external server processing after local checks.
- External Siri server. Possible subsequent audio processing in this historical design; additional server checks may reject an activation.
- Audio → Auxiliary processor: detector: Audio input.
- Auxiliary processor: detector → No wake for this detector: Insufficient detection.
- Auxiliary processor: detector → Main processor: larger check: Sufficient detection.
- Main processor: larger check → Activation rejected: Check rejects.
- Main processor: larger check → Accepted local detection: Check accepts.
- Accepted local detection → External Siri server: Possible subsequent audio transfer.
Other controls change the service offered. Processing fewer frames can miss short events; shorter generated output can omit useful detail; deferring work reduces immediacy. Charging-aware scheduling can move latency-insensitive work away from unplugged use, as discussed in Gemini Nano on device, but it cannot override an API restriction. ML Kit's GenAI APIs require the top foreground application and apply request and battery-use quotas; even a foreground service can receive a background-use error.
Sustained tests must distinguish a symptom from its cause. MELT observed falling throughput across 50 consecutive prompts for four-bit Zephyr-3B on an iPhone 14 Pro, repeating the experiment three times. The authors hypothesized energy and frequency-management changes; they did not directly demonstrate those transitions. To diagnose a similar slowdown, hold request shape and concurrency fixed, then align repeated timings with memory and thermal observations. Growing history, host overhead, and temperature are competing explanations, not interchangeable labels for slowness.
Record ambient conditions, charging state, battery state, and competing work. Android's Power Profiler observes available device-level power rails rather than isolating an application's energy automatically; other activity introduces noise. Missing rail coverage is unavailable information, not zero consumption. Use repeated, comparable workloads and report useful completions alongside energy, latency, and thermal state.
Connectivity and cooperation
Specify the offline capability
Offline inference runs without a live network dependency. Provisioning puts its required artifacts and supporting state in place beforehand. Transformers documents predownloading model files and using an explicit offline or local-files-only loading policy; installing the library alone is insufficient. A whole workflow additionally needs its inputs, supporting data, valid authority, and required downstream operations. A local model calling a web tool is still a network-dependent workflow.
| Condition | Honest capability |
|---|---|
| Provisioned restart with valid local state | Reinitialize locally and run the supported task. |
| Missing model or required runtime asset | Report unavailable until the missing dependency is provisioned. |
| Older supporting data | Offer explicitly reduced freshness if the task permits it; otherwise decline. |
| Required authority cannot be established | Do not perform the protected operation. |
| Remote-only operation | Preserve local work if permitted; report the remote step unavailable or explicitly pending. |
Graceful degradation offers a clearly reduced service when normal operation is unavailable. It must preserve permissions and disclose reduced completeness. A stored reference collection may support useful offline lookup, but cannot reveal changes it has not received; freshness and deletion remain separate obligations. Likewise, an authentication or entitlement dependency needs an explicit offline policy. If the operation requires current remote authority, disconnection cannot establish it. Follow current-authority enforcement.
Distinguish local completion, saved pending work, and a confirmed remote effect. An offline note can be saved successfully while its requested transmission remains pending. Reconnection supplies transport, not new permission to upload it. If a connection fails during a remote action, lack of acknowledgement also does not establish that the action failed; use the uncertain-outcome contract before retrying. Test disconnected startup, process restart, prolonged disconnection, and missing dependencies—not only a prompt after toggling airplane mode.
Control the cloud handoff
Hybrid inference combines local and remote execution. It may send an entire task to a remote model, or partition an application into stages—for example, local transcription followed by an optional remote text operation. This differs from splitting one model's numerical execution across machines, covered in Distributed Training and Inference. Network-sensitive cooperation is not new: the University of Michigan's 2017 Neurosurgeon study investigated layer-level placement because transferring inputs could outweigh faster server computation. Its preferred split depended on network conditions and server load.
For an application-stage handoff, name the outbound representation, operation, recipient, and retention decision. In the proposed transcription design, the remote service receives selected transcript text—not raw audio, the entire recording history, or unspecified intermediate state. Check permission for that exact path before sending. Microphone permission authorizes capture-device access; it is not the application's cloud-transfer policy. Approval belongs to the actual service path, and the interface should show where the optional processing occurs.
Transforming information locally does not automatically anonymize it. An embedding is a numerical representation of an object, such as text; its purpose and geometry are explained in Embeddings and Representation Learning. The 2023 study Text Embeddings Reveal (Almost) As Much As Text demonstrated reconstruction attacks given embeddings and query access to the embedding model. That does not establish universal recoverability, but it rules out treating vectors as inherently safe to disclose.
Availability and permission must remain separate decisions. Firebase's documented hybrid integration distinguishes unavailable, downloadable, downloading, and available local-model states. Requests do not automatically download missing models. Its local-preferred mode permits cloud fallback, while local-only mode fails when local execution cannot proceed; unsupported features can also cause permitted fallback. Responses identify execution location. Configure such behavior to match the product promise: memory pressure, heat, or a missing artifact must not silently convert a local-only request into an upload. Broader selection and fallback design belongs in Model Routing and LLM Gateways.
Permission precedes the remote text operation
ExampleA useful local result can remain available when the optional remote path is prohibited or unreachable.
Read the diagram as text
- Captured audio. On-device input; capture permission is separate from transfer permission.
- Local transcription. A provisioned local capability converts audio to text.
- Local transcript. Text derived from audio, not the audio object itself.
- On-device transfer gate. First check local-only policy and authorization for exact text, operation, recipient and retention; separately check connectivity.
- External approved text service. External recipient for the optional text operation.
- On device: local result retained. Denied authority means prohibited; absent connectivity means unsent. Neither creates automatic later transfer.
- On device: remote result display. On-device presentation identifies remote processing.
- Captured audio → Local transcription: Data: audio.
- Local transcription → Local transcript: Data: derived text.
- Local transcript → On-device transfer gate: Data: selected text proposal.
- On-device transfer gate → External approved text service: Data: only approved selected text; authorized + connected.
- On-device transfer gate → On device: local result retained: Control: prohibited or disconnected.
- External approved text service → On device: remote result display: Data: remote operation result.
Protected remote processing is another option, but it remains remote. Apple's 2024 Private Cloud Compute architecture described encrypted requests sent to validated nodes that access request data to compute a response, with stated deletion and operational-access restrictions. Those protections are architectural claims with their own assurance requirements, not on-device execution. Choose the path for its actual guarantees rather than its product label.
Deployment qualification
Qualify the promised operating conditions
Qualification turns a proposed capability into a bounded support statement. Record the exact package revision, tokenizer or processor, runtime, backend, operating system, device group, input shapes, concurrency, and relevant operating conditions. Define acceptance criteria before selecting the winner, compare changes on matched work, and preserve an independent final test. The release boundary is the intersection of useful behavior, feasible execution, valid lifecycle handling, and permitted data flows.
| Promise | Conditions to exercise | Observation | Response when unmet |
|---|---|---|---|
| Useful output | Representative languages, inputs, difficult cases, and held-out tasks. | Task-specific correctness and unacceptable errors. | Narrow capability or reject the candidate. |
| Supported execution | Exact model, backend, shapes, and platform versions. | Actual operator placement and compatible results. | Use a qualified path or mark the combination unsupported. |
| Readiness | First installation, interrupted acquisition, installed cold start, and warm reuse. | Stage completion and time until requests can run. | Expose preparation or missing dependencies. |
| Memory fit | Low-resource targets, large inputs, overlap, and competing applications. | Peak allocations and memory-pressure behavior. | Limit inputs, concurrency, or residency. |
| Responsive sustained use | Repeated matched work with battery, charging, ambient, and background conditions recorded. | Onset, completion, cadence, energy coverage, and thermal observations. | Reduce work, defer where permitted, or declare the mode unsupported. |
| Offline recovery | Disconnection, restart, missing assets, and older supporting data. | Which promised operations actually complete. | Return an explicit reduced, pending, or unavailable outcome. |
| Controlled disclosure | Permitted and prohibited handoffs, tool calls, diagnostics, and backup settings. | Destinations and payloads within stated observation coverage. | Block the unauthorized path; preserve the local result. |
Benchmark history explains why these boundaries matter. MLPerf Tiny, presented by Colby Banbury, Vijay Janapa Reddi, and collaborators in 2021, paired embedded tasks with quality targets and comparable measurement procedures. Its published timing excluded preprocessing and postprocessing, and energy was measured per inference within that window. This made an inference comparison meaningful without claiming to measure a complete sensor-to-result workflow.
MobileAIBench similarly separated task evaluation from an iOS application's latency and resource measurements. Its reported mobile experiments used an iPhone 14. Summarization scores did not establish factual fidelity, and battery-percentage changes were not joule measurements. Use tools to answer their defined questions, then test the integrated application. The inference benchmark contract supplies the workload and measurement controls.
State the coverage of network observations too. Service workers can mediate browser requests, and disabling them to simplify interception changes application behavior. Browser instrumentation does not cover every native process or operating-system service. Preserve diagnostic identities and outcomes without indiscriminately retaining private payloads; telemetry governance explains that boundary. The final support statement should name supported tasks and conditions, required preparation, unavailable modes, and allowed remote paths. A successful model launch is one observation inside that statement, not its conclusion.
Open questions
Predicting sustainable capability across device fleets remains difficult because thermal design, background activity, runtime behavior, and workload shape interact. Progress would mean reproducible stock-device measurements linking useful completions, latency, energy, and thermal state under documented conditions—not only faster initial requests.
Durable offline readiness competes with platform reclamation and model updates. Applications need stronger ways to state how long a provisioned capability can remain available and how loss is reported. Progress would include testable reservation, lifecycle, and recovery contracts that distinguish retained files from runnable sessions.
Local-cloud cooperation needs useful minimization without assuming that derived representations are anonymous. Progress would combine task-quality evaluation with explicit reconstruction threat models and enforceable recipient-specific transfer policies, so reducing payload size does not become a substitute for protecting information.


































































































































