Chuyển đến nội dung chính

Bài đăng

Hiển thị các bài đăng có nhãn OnDevice

Gemma on-device trong Flutter: flutter_gemma và LiteRT-LM

AI cloud không phải đường duy nhất. Model on-device giữ dữ liệu cục bộ, chạy offline và cắt cost theo request. Câu chuyện Flutter ở đây là flutter_gemma cộng runtime LiteRT-LM của Google. Vì sao LiteRT-LM quan trọng Nó trừu tượng hóa khác biệt phần cứng và nhắm tăng tốc GPU/NPU trên Android, iOS, Web, Windows, Linux, macOS — đúng sáu đích Flutter ship. Pattern sản phẩm hiệu quả Trợ giúp thị giác — frame camera → mô tả ngắn có cấu trúc (kiểu Gemma Vision). Huấn luyện task — kế hoạch nhiều bước local, không round trip. Dictation/note nhạy privacy — text không rời máy. Checklist kỹ thuật UX tải model (vài trăm MB) có resume. Ngân sách thermal/battery trên phone tầm trung. Path fallback khi thiếu NPU/driver. Thông điệp rõ: xử lý nằm trên máy. Cạm bẫy Đừng chặn UI isolate khi sinh token. Đánh đổi quantization: đo chất lượng trên task của bạn , không chỉ benchmark. Bài viết gốc đăng tại FlutterCook . Bản trên đó là bản được cập nhật mới nhất.

On-device Gemma in Flutter: flutter_gemma and LiteRT-LM

Cloud AI is not the only path. On-device models keep data local, work offline, and cut per-request cost. Flutter’s story here is flutter_gemma plus Google’s LiteRT-LM inference runtime. Why LiteRT-LM matters It abstracts hardware differences and aims at GPU/NPU acceleration across Android, iOS, Web, Windows, Linux, and macOS — the same six targets Flutter ships. Product patterns that work Vision assist — camera frames → short structured descriptions (Gemma Vision style). Task coaching — local multi-step planning without a round trip. Privacy-sensitive dictation/notes — text never leaves the device. Engineering checklist Model download UX (multi-hundred MB) with resume. Thermal/battery budgets on mid-tier phones. Fallback path when NPU/driver is missing. Clear user messaging that processing is local. Pitfalls Do not block the UI isolate on token generation. Quantization tradeoffs: measure quality on your tasks, not benchmarks alone. Originally published on ...