On-Device and Edge ML Questions
Running models on resource-constrained and privacy-sensitive devices. Covers model optimization for mobile and embedded hardware, on-device inference and privacy architecture, and dedicated neural accelerators. Focuses on the size, latency, power, and privacy tradeoffs of moving inference off the server and onto the edge.
You converted a TensorFlow model to Core ML but observe small numeric differences in outputs compared to the original. Describe a systematic testing strategy to identify the source of discrepancy, including checks for preprocessing differences, data layout mismatches (NHWC vs NCHW), activation/weight precision changes, and op implementation differences. How would you mitigate each identified cause?
Describe the lifecycle of a Core ML model from training to shipping: training and export from frameworks (PyTorch/TensorFlow), conversion to Core ML (.mlmodel), compilation to optimized .mlmodelc, embedding in the app bundle versus downloading at runtime, and strategies for versioning and rollback. What are key considerations at each step for mobile constraints?
How can you design a Core ML model and conversion to support flexible or variable input shapes (for example, varying image resolutions) and what are the runtime trade-offs on ANE and memory usage? Describe the coremltools options you would use to enable flexible inputs and how that affects model size and performance.
Apple devices have varying compute capabilities. Propose a strategy to build, test, and release multiple model variants (small, medium, large) targeting different device classes while minimizing engineering overhead. Cover CI/CD, automated testing on device farms, runtime model selection logic, and strategies for backward compatibility and user migration between variants.
You are asked to implement quantization-aware training (QAT) in PyTorch for a small convolutional model and then convert the trained model to Core ML for ANE execution. Provide a step-by-step procedure that includes model preparation for QAT, training considerations, export path (ONNX or TorchScript), and coremltools conversion notes and pitfalls to watch for.
Unlock Full Question Bank
Get access to all On-Device and Edge ML interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.