Guides
Gemini Nano and Core ML: a local assistant in five steps
Build a small assistant around a bounded task, such as rewriting a note. Gemini Nano and Core ML are different routes, not interchangeable models: availability, integration and costs depend on the platform and device.
1. Define the task and choose a route
Collect representative notes and expected rewrites, including supported languages and sensitive cases. On Android, check the current Gemini Nano API and device requirements; access is not the same as bundling your own model. On Apple platforms, Core ML runs compatible models: choose a suitable model, check its license and convert it with the appropriate tools if needed.
2. Integrate and check availability
Follow the platform's setup and version requirements. Check model and device availability before enabling the feature; a model may need a download or may not be supported. For a supplied model, plan its distribution, storage, updates and integrity checks. Keep inference behind a service rather than coupling it to the screen.
3. Run without blocking the interface
Load and run inference asynchronously, show loading and progress states, and allow cancellation. Bound input and output lengths to the model's limits. Release resources when the session ends and handle initialization or inference errors without freezing the UI.
4. Present and verify the result
Stream partial output only if the chosen API supports it; otherwise show a progress state and the completed answer. Let users edit or discard the suggestion. Generated text can be incorrect or unsafe, so do not treat it as a fact or perform consequential actions without validation and user confirmation.
5. Test and provide a fallback
Measure quality on your examples and record device, OS and model versions. On supported phones, test cold start, time to first and complete response, peak memory, battery, storage and repeated use. Exercise offline use after setup, missing or downloading models, low memory and cancellation; offer a non-AI path when inference is unavailable or fails.
Privacy, cost and limits
Local inference can avoid a cloud inference charge and sending the prompt to a server, but downloads, integration, updates and support still cost money. Audit logs, analytics, backups and crash reports for sensitive text. If you offer a cloud fallback, explain what is sent and obtain appropriate consent before sending it; local inference alone does not guarantee security or compliance.