Device-side AI and AI PC/AI Phone implementation solutions
🛒 The end-side AI implementation solution for developers and end users covers AI PC/AI Phone local large model deployment, NPU accelerated inference, end-side application development and privacy computing, realizing offline and private AI capabilities.
Device-side AI and AI PC/AI Phone implementation solutions
Solution overview
This solution is oriented to device-side AI deployment and local AI application development scenarios, covering the two terminal forms of AI PC and AI Phone, helping developers and technical teams run large language models and related AI capabilities directly on user devices. Through local reasoning, it achieves privacy protection without data leaving the device, offline availability without network dependence, and millisecond-level low-latency response, while reducing cloud API call costs.
The core tool chain includes: Ollama, LM Studio, Tongyi Qianwen, 豆包, ChatGPT, Claude, DeepSeek, as well as end-side reasoning frameworks and platform capabilities such as llama.cpp and Apple Intelligence.
Target users: client-side AI application developers, AI PC/Phone product managers, privacy computing engineers, and enterprise IT architects.
Prerequisites:
- Have basic command line operation capabilities (macOS/Linux/Windows)
- Have an AI PC that supports NPU or independent GPU (Apple Silicon, Qualcomm Snapdragon X Elite, Intel Core Ultra, etc.), or a flagship AI Phone (Snapdragon 8 Gen 3/Dimensity 9300 and above)
- Understand basic concepts such as model quantification and inference framework
- Basics of Python and API integrated development
Toolchain list
| Tools | Purpose | Required Account Level | Estimated Fees | Alternatives |
|---|---|---|---|---|
| Ollama | Local model management and inference engine | Free | Free | llama.cpp directly compile and run |
| LM Studio | Graphical local inference client | Free | Free | Ollama + Open WebUI |
| llama.cpp | Underlying high-performance inference engine | Open source | Free | MLX (Apple Silicon) |
| Qwen | Client-side small model (1.5B-72B) | Free/open source | Free | DeepSeek |
| Apple Intelligence | Apple on-device AI framework | Built-in system | Free (requires M1+/A17+) | Qualcomm AI Engine |
| ChatGPT | Cloud comparison/auxiliary annotation | Free version/Plus version $20/month | By API usage | Claude |
| DeepSeek | Open source lightweight model (R1/V3) | Free/open source | Free | 豆包Device side |
Preparation
Before starting implementation, please confirm the following preparations one by one:
- [ ] Confirm that the terminal device supports NPU or GPU hardware acceleration (Apple Neural Engine / Qualcomm Hexagon / Intel NPU)
- [ ] Install the latest device driver and NPU SDK (such as Apple CoreML, Qualcomm AI Engine Direct)
- [ ] Prepare 10-20GB of free disk space for model file storage
- [ ] Install Homebrew (macOS) or package manager (Linux/Windows)
- [ ] Confirm that the network environment can download the Hugging Face / Ollama model warehouse
- [ ] Confirm Python 3.10+ development environment
- [ ] Confirm with the security team the compliance requirements for the scope of private data processing
Step-by-step guide
Step 1: Equipment evaluation and model selection
⏱ Estimated time: 1-2 days 🎯 Goal: Determine the most appropriate device-side model specifications and quantification levels based on the computing power, memory and business scenarios of the target device. ⚠️ Prerequisite: The device hardware list has been confirmed
Operation instructions
End-side model selection is the basis of the entire link. The NPU computing power, memory bandwidth and video memory capacity of different devices determine the maximum number of model parameters that can be run. For example, an AI PC with 8GB of memory is suitable for quantization models below 7B, and 16GB can run a 13B quantization model, while an AI Phone can usually only carry a parameter scale of 1.5B-7B.
Specific operations
- Run the device benchmark tool (such as Ollama’s built-in
ollama run --benchmark) to record the tokens/s inference speed of the device - Select model specifications based on available memory (refer to the table below), giving priority to the largest model that can be run.
- Determine the quantization level: Q4_K_M is the best balance between accuracy and performance; Q2_K is suitable for extremely resource-constrained scenarios; Q8_0 is suitable for accuracy-first scenarios
- For AI Phone, give priority to 1.5B-3B end-side dedicated small models (such as Qwen2.5-1.5B-Instruct, DeepSeek-R1-Distill-Qwen-1.5B)
- Record the selection decision matrix: model name, quantification level, estimated memory usage, target tokens/s
Selection reference matrix
| Device type | Recommended model size | Recommended quantification | Typical models | Estimated inference speed |
|---|---|---|---|---|
| AI PC (32GB+) | 13B-72B | Q4_K_M / Q5_K_M | Qwen2.5-14B, DeepSeek-R1-Distill-Qwen-14B | 15-40 tokens/s |
| AI PC (16GB) | 7B-13B | Q4_K_M | Qwen2.5-7B, Llama-3.1-8B | 25-50 tokens/s |
| AI PC (8GB) | 1.5B-7B | Q4_K_M / Q3_K_M | Qwen2.5-7B-Q4, Phi-3-mini | 30-60 tokens/s |
| AI Phone (12GB+) | 3B-7B | Q4_K_M / Q3_K_S | Qwen2.5-3B, DeepSeek-R1-Distill-Qwen-1.5B | 10-30 tokens/s |
| AI Phone (8GB) | 1.5B-3B | Q4_K_M | Qwen2.5-1.5B, Gemma-2-2B | 15-35 tokens/s |
Verification method
- ✅ The selection matrix document passed the team review
- ✅ The target model can run stably on the target device at ≥10 tokens/s
- ✅ After the model is loaded, the device’s free memory is ≥ 2GB (to avoid system freezes)
Step 2: Set up local inference environment
⏱ Estimated time: 1-2 days 🎯 Goal: Complete the installation, model download and basic operation verification of Ollama / LM Studio inference environment on the target device ⚠️ Prerequisites: The model selection matrix has been confirmed and the basic equipment environment is ready
Operation instructions
Ollama is currently the most mature device-side inference framework, supporting macOS/Linux/Windows. It has a built-in model warehouse and an OpenAI compatible API. You can download and run the model with one command. LM Studio provides a GUI interface, suitable for non-command line users and model performance comparison. llama.cpp is the underlying engine on which Ollama and LM Studio are built. If you need to deeply customize inference parameters, you can use llama.cpp directly.
Specific operations
- Install Ollama (macOS/Linux/Windows):
#macOS brew install ollama #Linux curl -fsSL https://ollama.com/install.sh | sh # Windows Download the installation package from ollama.com - Download and run the selected model:
# Pull model (take Qwen2.5-7B as an example) ollama pull qwen2.5:7b # Start interactive conversation ollama run qwen2.5:7b - Verify OpenAI compatible API:
curl http://localhost:11434/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{"model": "qwen2.5:7b", "messages": [{"role": "user", "content": "Hello"}]}' - Install LM Studio (alternative GUI option):
- Download and install from lmstudio.ai
- Search and download models through the interface
- Start the local HTTP service (Settings > Local HTTP Server)
- Configure multi-model management: Configure different models for different tasks, such as lightweight models for simple conversations and large models for complex reasoning.
Key access control
- ✅ The Ollama service starts automatically after the device is turned on (
ollama serveis registered as a system service) - ✅ API response time < 500ms (after first load)
- ✅ LM Studio GUI can load and run at least 3 different models normally
- ✅ Confirm that model files are stored in the expected path (default
~/.ollama/models/)
Step 3: NPU/GPU acceleration configuration
⏱ Estimated time: 1-3 days 🎯 Goal: Enable hardware acceleration capabilities of device NPU or GPU to increase inference efficiency to usable levels ⚠️ Precondition: The basic inference environment is running normally
Operation instructions
The performance bottlenecks of end-side inference are usually memory bandwidth and computing units. Apple Silicon's Unified Memory architecture allows CPU/GPU/NPU to share the memory pool without CPU-GPU data copying, which is naturally suitable for large model reasoning. Qualcomm Snapdragon X Elite’s Hexagon NPU and Intel Core Ultra’s integrated NPU also offer dedicated AI acceleration units. Different platforms have different acceleration solutions and require targeted configuration.
Specific operations
-
Apple Silicon (Metal GPU acceleration):
# Ollama automatically detects Metal, no additional configuration is required # Confirm Metal is enabled ollama run --verbose qwen2.5:7b # Check "llama_print_timings" in the output to confirm that Metal is used # If you need to use the MLX framework (Apple official optimization) pip install mlx-lm python -m mlx_lm.generate --model Qwen/Qwen2.5-7B-Instruct-MLX - Qualcomm Snapdragon X Elite / AI Phone (Qualcomm AI Engine):
# Deploy the optimization model using Qualcomm AI Hub pip install qai-hub #Install SNPE or QNN SDK # Refer to Qualcomm official documentation for model quantification and deployment - Intel Core Ultra (OpenVINO/Intel NPU):
# Run Ollama using the OpenVINO backend OLLAMA_INTEL_OPENVINO=1 ollama serve # Or use Intel NPU Acceleration Library pip install intel-npu-acceleration-library - Verify acceleration takes effect: Compare the inference speed of CPU-only and NPU/GPU modes, the difference should be 2-5 times
Acceleration effect reference
| Equipment | Acceleration solution | 7B model inference speed (CPU only) | Speed after acceleration | Improvement multiple |
|---|---|---|---|---|
| MacBook Pro M3 Max | Metal GPU | 15 tokens/s | 45 tokens/s | 3x |
| MacBook Air M2 | Metal GPU | 10 tokens/s | 28 tokens/s | 2.8x |
| Snapdragon X Elite | Hexagon NPU | 8 tokens/s | 22 tokens/s | 2.75x |
| Intel Core Ultra 7 | OpenVINO NPU | 6 tokens/s | 15 tokens/s | 2.5x |
| Snapdragon 8 Gen 3 Phone | Qualcomm AI Engine | 4 tokens/s | 12 tokens/s | 3x |
Verification method
- ✅ The inference speed reaches the target threshold (chat scenario ≥ 20 tokens/s, code scenario ≥ 15 tokens/s)
- ✅ 30 minutes of continuous inference device temperature not triggering throttling (< 85°C)
- ✅ Acceptable impact on battery life (AI Phone continuous inference consumes less than 15% power for 30 minutes)
Step 4: Integrated development of end-side applications
⏱ Estimated time: 3-7 days 🎯 Goal: Integrate local reasoning capabilities into target business applications to achieve a complete functional closed loop of end-side AI products ⚠️ Preconditions: The inference environment is stable and the acceleration configuration takes effect
Operation instructions
The ultimate value of on-device AI is reflected in specific applications. The integration method depends on the target scenario: desktop applications call Ollama local services through HTTP API, and mobile terminals load quantitative models through frameworks such as TensorFlow Lite / CoreML / ONNX Runtime. The key is to design a hybrid inference strategy of "client-side as the main part and cloud as the supplement" - simple/private tasks go to the device-side and complex tasks fallback to the cloud.
Specific operations
-
Desktop application integration (Python/TypeScript):
# Python example: local chat via Ollama API import requests def local_chat(prompt: str) -> str: response = requests.post( "http://localhost:11434/v1/chat/completions", json={ "model": "qwen2.5:7b", "messages": [{"role": "user", "content": prompt}], "stream": False } ) return response.json()["choices"][0]["message"]["content"] - AI Phone integration (Android/iOS):
- Android: Load TFLite models using Qualcomm AI Engine Direct or MediaTek NeuroPilot SDK
- iOS: Use CoreML to convert the model to
.mlpackageformat and run it through Apple Neural Engine - Cross-platform solution: use lightweight inference engines such as MNN or NCNN
- Hybrid reasoning strategy implementation:
def hybrid_inference(prompt: str, privacy_level: str = "local"): if privacy_level == "local" or is_sensitive_data(prompt): return local_chat(prompt) #Device-side reasoning else: return cloud_chat(prompt) # Cloud API (such as ChatGPT/Claude) - Build end-side RAG pipeline (privacy scenario):
- Local vector database (Chroma/LanceDB) + local Embedding model
- All document indexing is completed within the device, and the data does not leave the device
- Implement streaming output: Use SSE (Server-Sent Events) to achieve ChatGPT-like typing effect
Privacy Data Processing Policy
| Data type | Processing method | Recommended model | Description |
|---|---|---|---|
| Medical records | Device-side only | Qwen2.5-7B-Q4 | The data does not leave the device, and only the summary is retained in the inference log |
| Financial transactions | Client side only | DeepSeek-R1-Distill-Qwen-7B | Reject cloud fallback |
| Code snippets | Client-side priority | Qwen2.5-Coder-7B | Can fallback to the cloud (after anonymization) |
| Daily conversation | Client-side priority | Any 3B-7B model | Fallback available |
| Document summary | Client-side processing | Qwen2.5-7B-Q4 | Full text processing, only output summary |
Verification method
- ✅ The end-to-end inference link is available end-to-end, from user input to AI response ≤ 3 seconds
- ✅ The hybrid routing strategy is correct: private data will never trigger cloud fallback
- ✅ The streaming output experience is smooth without obvious pauses.
- ✅ The app runs in the background of the device for > 4 hours without crashing
Step 5: Privacy Security and Performance Testing
⏱ Estimated time: 2-3 days 🎯 Goal: Verify that the data does not leave the device, and evaluate the overall performance, power consumption and stability of end-side AI ⚠️ Prerequisites: The application integration development is completed and the functional logic passes the preliminary review
Operation instructions
One of the core values of on-device AI is privacy protection. However, "data does not leave the device" requires a verifiable evidence chain and cannot rely solely on trust statements. At the same time, the power consumption, heat dissipation and stability of end-side inference directly affect the user experience, and quantitative indicators must be established.
Specific operations
- Privacy Audit:
- Use network packet capture tool (Wireshark/Charles) to verify that no data is sent out
- Check the app permission list to make sure no unnecessary network permissions are used
- Use the system firewall to confirm that the inference process is only listening on localhost
-
Performance Benchmark Test:
import time def benchmark_inference(model: str, prompt: str, iterations: int = 10): times = [] for _ in range(iterations): start = time.time() # Call local inference API result = local_chat(prompt) elapsed = time.time()-start times.append(elapsed) return { "avg": sum(times) / len(times), "min": min(times), "max": max(times), "p95": sorted(times)[int(len(times) * 0.95)] } - Power consumption test (AI Phone):
- Use Android Battery Historian / iOS Energy Log to record inference power consumption
- Compare the energy consumption of the same task on the device side vs. the cloud
- Stability test: 100 rounds of continuous inference, monitoring whether OOM, token degradation or inference stuck
Acceptance Criteria
- [ ] Network packet capture confirms zero data outgoing (except cloud fallback scenario)
- [ ] First token delay ≤ 500ms (end side)
- [ ] Application no-load memory usage ≤ 500MB, during inference ≤ 2GB (AI PC) / ≤ 1GB (AI Phone)
- [ ] Continuous inference of 30 minutes of device temperature not triggering the thermal throttling threshold
- [ ] The privacy data processing process has been audited by the security team
Expected results
| Indicators | Cloud solution | Device-side solution (this solution) |
|---|---|---|
| Inference delay (first token) | 500-2000ms (including network) | 100-500ms |
| Data privacy | Rely on cloud service provider's commitment | Data does not leave the device, can be audited and verified |
| Offline availability | Not available | Runs completely offline |
| Single inference cost | $0.001-0.01 | Close to zero (only electricity cost) |
| Model accuracy | High (full cloud accuracy) | Medium-high (95-98% after quantification) |
| Deployment method | Cloud hosting | Device can be installed and used locally |
Acceptance criteria
- [ ] Client-side inference delay ≤ 500ms, meeting real-time interaction requirements
- [ ] Privacy audit report passed review by security team
- [ ] The device-side AI function can run completely in a non-network environment
- [ ] App runs continuously for 4 hours without crashes or memory leaks
- [ ] Hybrid inference strategy correctly routes all private data
Frequently Asked Questions and Troubleshooting
Q: My device only has 8GB of memory. How big of a model can it run? A: It is recommended to use the Q4_K_M quantization model of 1.5B-7B for 8GB devices. When running the 7B model, there is about 2-3GB of free memory left, which can satisfy the system operation. If you encounter OOM, switch to Q3_K_M quantization or select a model below 3B.
Q: Is there a big gap between the accuracy of the client-side model and that of the cloud model? A: Q4_K_M quantification can usually retain 95-98% of the capabilities of the original model, and the difference is not obvious in scenarios such as general dialogue, document summary, and code completion. However, in scenarios such as complex mathematical reasoning and accurate understanding of long texts, the end-side quantization model may suffer a 5-10% accuracy loss. It is recommended to add manual review links at key business nodes.
Q: What should I do if the effect is not obvious after NPU acceleration? A: First confirm that the NPU driver has been installed correctly and the inference framework has indeed called the NPU backend (check the backend information in the log). Some NPUs have limited acceleration effect in the batch size=1 scenario, because the parallel computing advantages of NPU require a certain amount of calculation to be realized. At this time, you can try the GPU backend. Generally, GPU performs better in small batch scenarios.
Q: How to verify the privacy protection of the client-side model? A: This solution provides triple verification: ① Network packet capture confirms that no data is sent out; ② System firewall confirms that the inference process only listens to localhost; ③ Code audit confirms that the hybrid routing strategy correctly intercepts private data. It is recommended to invite a third-party security team to conduct penetration testing.
Q: How to choose between client-side solution and cloud solution? A: The client-side solution gives priority to the following scenarios: ① High data privacy requirements (medical, financial, legal); ② Need to be available offline (travel, military industry, remote areas); ③ Delay-sensitive scenarios (real-time translation, voice assistant). The cloud solution is suitable for: ① high-precision reasoning of large models is required; ② real-time knowledge update is required; ③ the number of model parameters exceeds the equipment carrying range. The two can be combined into a hybrid solution.
Period and result
| Stage | Estimated time | Output |
|---|---|---|
| Equipment evaluation and model selection | 1-2 days | Selection matrix document |
| Local inference environment setup | 1-2 days | Runnable inference service |
| NPU/GPU acceleration configuration | 1-3 days | Acceleration performance report |
| Device-side application integrated development | 3-7 days | Application prototype integrating AI capabilities |
| Privacy security and performance testing | 2-3 days | Test report and audit certification |
| Total | 8-17 days | Deliverable on-device AI application |
Advantages and Disadvantages
Advantages
- Privacy Protection: Data does not leave the device, avoiding the risk of cloud leakage and meeting GDPR/"Personal Information Protection Act" compliance requirements
- Low Latency: Eliminate network transmission overhead, reasoning delay < 500ms, suitable for real-time interaction scenarios
- Offline available: Completely independent of network dependence, suitable for travel, remote areas and military scenarios
- Controllable Cost: No ongoing API call fees, marginal cost approaches zero after one-time investment in hardware
- Personalization: Models can be fine-tuned and continuously learned locally to achieve a personalized experience without exposing privacy
Disadvantages
- Model accuracy is limited: Due to the limitation of equipment computing power, the number of parameters of the device-side model is much smaller than that of the large cloud model, and the accuracy of complex inference scenarios is not as good as that of the cloud.
- Device fragmentation: NPU architectures and SDKs from different manufacturers are incompatible, and cross-platform adaptation costs are high
- Model update lag: Client-side model updates require re-downloading or OTA push, and the iteration cycle is longer than that of the cloud API
- Hardware Threshold: Smooth experience requires NPU or independent GPU support, and low-end devices have poor experience
Tool summary
| Tool name | Type | Role in this scenario |
|---|---|---|
| Ollama | Inference framework | Local model management and inference engine (core) |
| LM Studio | Inference framework | Graphical client, model comparison test |
| llama.cpp | Inference engine | Low-level high-performance inference, the cornerstone of Ollama/LM Studio |
| Qwen | End-to-end model | Recommended main end-to-end model series |
| Doubao (Doubao) | End-to-side model | Domestic end-to-side model alternative |
| Apple Intelligence | System Framework | Apple Device Side AI Capability Platform |
| DeepSeek | Device-side model | Device-side deployment solution of open source inference model |
| ChatGPT | Cloud comparison | Cloud fallback and comparison testing |
| Claude | Cloud comparison | Cloud alternative for security-sensitive scenarios |
Advancement and Expansion
This solution adopts a layered architecture design and can be gradually expanded according to business development:
- Device-side RAG knowledge base: Deploy local vector database (Chroma/LanceDB) + local Embedding model to build a completely offline knowledge question and answer system. All document indexing and retrieval are completed within the device
- Device-side Agent System: Utilize the Function Calling capability of the local model and combine it with the MCP protocol to call local tools (calendar, files, emails) to build a private and secure personal AI assistant.
- Multi-device collaborative reasoning: In the home/office LAN, cross-device model loading is achieved through distributed reasoning (such as mobile phones processing lightweight requests and PCs processing complex requests)
- Device-side fine-tuning and personalization: Use technologies such as QLoRA/Lora to incrementally train the basic model on the device to achieve a personalized experience without exposing user data
- Quantitative distillation pipeline: Build a distillation pipeline from the cloud large model to the end-side small model, and customize lightweight dedicated models for specific business scenarios.
- Device-side multi-modal: Extended support for local image understanding (LLaVA/Qwen-VL), speech recognition (Whisper) and speech synthesis (XTTS) to achieve complete end-side multi-modal capabilities
User Reviews