Study: upgrade flutter_edge_ai 2.3.2 → 2.7.2 — workarounds we can drop, new features, impact
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- machine-learning, mobile, performance
Hướng nghiên cứu
Start with pubspec.yaml and choose a package set that resolves, then run the unit tests and integration_test/llm_stability_e2e_test.dart on the vivo 1933 with Qwen3 0.6B, Gemma 4 E2B, and DeepSeek R1. Record load time, first-token time, peak memory, and APK size, and re-test the plain Qwen file from #286. Completion means the upgrade’s compatibility, regressions, and costs are measured; migration and feature work are planned as separate PRs.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
We are on flutter_edge_ai 2.3.2 (_litertlm 1.13.2, _mediapipe 1.2.2, _embeddings 2.3.0, _diagnostics 0.2.2; native LiteRT-LM 0.18). Upstream is now at 2.7.2 (_litertlm 1.21.3, _mediapipe 1.3.1, _diagnostics 0.6.1; native LiteRT-LM 0.19.1). This issue studies, from the upstream changelogs, what the upgrade:
- removes from our own workarounds,
- adds that UNIUN can use,
- costs.
Every claim below is from the changelogs, not tested yet. Phase 0 is to measure them.
1. Workarounds we may be able to remove
| Our workaround (where) | Why we have it | Upstream change | Expected result |
|---|---|---|---|
Image turns use createChat(supportImage: true); text turns use openChat (local_llm_runner.dart ~206–222) |
A .litertlm engine rejected images on openChat sessions |
_litertlm 1.20.0: "openChat takes the model's own type and media", and openSession sessions are native conversations with media. Core 2.6.0 deprecates createChat/createSession until 3.0.0. |
One code path for every turn. We have to migrate before 3.0 anyway. |
We add Qwen3's /no_think ourselves (prompt_parts.dart, gana_prompt_builder.dart, local_llm_runner.dart ~232) |
Stop Qwen3 thinking | Core 2.7.0: "/no_think stays out of fullHistory; a replayed chat sends it once per turn" |
Check whether ours is now duplicated, then drop it if so. |
A throwaway openChat per turn that re-feeds system + history + RAG (local_llm_runner.dart) |
Keep the runner stateless; surfaces must not clobber each other | Core 2.6.0: "Engine SPI owns sessions, chat resolution, turn hooks and failed-turn rollback"; _litertlm 1.15.0: "a stopped turn is rewound in place"; 2.7.0 MessageTranscriptCodec |
Possibly reuse sessions and skip re-prefilling history each turn, which is faster replies on weak phones. Needs design + measurement. |
Hand-written GPU→CPU fallback loops (embedding_service.dart ~93–98, gana_workmanager.dart ~482) |
GPU load can fail | _litertlm 1.14.0: backends follow the file, plus backendFallback:; 1.21.0: Adreno GPU failures name the CPU |
Check for overlap; ours may become a single call. |
Per-model maxTokens limits to avoid an engine abort (local_model_params.dart) |
Too-large maxTokens aborts at CalculatorGraph::Run |
Core 2.6.0: ContextLimitException for prompts over the window; _litertlm 1.18.0: thinkingTokenBudget |
Clear error instead of an abort; a cap on runaway Qwen3 thinking. |
Model downloads and checks built by hand (ai_model_repository_impl.dart) |
— | Core 2.5.5: installModelFromCatalog with expectedSize checks; 2.5.3: uninstallModel closes the loaded model |
Catch truncated downloads; simpler delete and logout. |
Pins in pubspec.yaml: background_downloader: 9.5.6, hooks: ^2.0.0 override |
9.5.7 broke our Android Kotlin build; openmls pins hooks ^1 | Native hook moved to litertlm_dart (1.21.0) |
Re-test: maybe drop one or both pins. |
Keep: Qwen3 0.6B uses Qwen3-0.6B_dynamic_wi4b32_afp32.litertlm (#286) |
Plain file fails on LiteRT-LM ≥ 0.17 | Only a README note (1.13.3, #659), no runtime fix listed | Keep it, but re-test the plain file on native 0.19.1. |
2. New things UNIUN can use
| Upstream feature | Where it helps us | User impact |
|---|---|---|
Native library loads off the calling isolate (_litertlm 1.19.1, #756) |
Model load on the UI isolate | Less jank when Shiv starts. Ties to #316 and #306. Measure. |
| MediaPipe 1.3.0: "a streamed reply no longer loses chunks while the UI thread is busy"; failed turns leave history | DeepSeek R1 runs on MediaPipe | Fixes possibly-missing text in R1 replies. Relates to #217. |
| Android GPU keeps Gemma 4 at FP16 above 2,048 tokens (1.21.0); Adreno prefill flush only on Adreno (1.19.2) | Long RAG prompts on Gemma 4 | Long prompts on the GPU stay correct. Our vivo 1933 Adreno GPU crash (AUDIT) needs re-testing. |
flutter_edge_ai_rag 1.2–1.3: hybrid text + vector search (RRF), removeWhere |
Our retrieval is vector-only, plus a separate Hindi keyword path | Better Hindi/Hinglish recall. Relates to #107. Compare with our tostore store before adopting. |
flutter_edge_ai_speech 0.6.x: on-device STT (Whisper, Parakeet, Moonshine) and TTS (incl. Qwen3-TTS, 11 languages) |
Voice input to Shiv or the composer | Relates to #215. |
Experimental Decider (pick 1 of N or abstain) |
Gana's <NOOP> skip, the small-model relevance cut-off |
Possibly more reliable skip decisions than parsing text. Experimental, so study only. |
| Structured tool calls (2.4.x) | Future Shiv actions | Later. |
flutter_edge_ai_diagnostics 0.6.1: memory on Windows, macOS and Linux; iOS peak; gpuMemory() on Adreno |
Performance work | Real numbers for #316 and #306. |
3. Costs and risks
- Breaking: core 2.5.0 removes the members deprecated for 2.5.0 (see upstream
MIGRATION.md). 2.6.0 deprecatescreateSession/createChat/session/chatand movescreateDecider._litertlm1.14.0 changes Gemma 4 audio order and throwsLiteRtLmBundleExceptionon wrong-backend files. - Version constraints:
_litertlm1.20.1 needs core>=2.6.0 <2.7.0, so pick a set thatpub getresolves (likely core 2.7.2 +_litertlm1.21.3) rather than bumping each package blindly. - New native bundle (0.18 to 0.19.1): every model on every backend can change behaviour. Re-run
integration_test/llm_stability_e2e_test.dartand the Shiv/Gana/RAG device tests on the vivo 1933 for Qwen3 0.6B, Gemma 4 E2B and DeepSeek R1. - App size and download size: unknown; measure the APK before and after.
- iOS: cannot be built here; only CI compile.
Plan
- Phase 0, measure: branch, bump to a resolving set, run unit tests and the device tests above. Record load time, first-token time and peak memory with the new diagnostics, plus APK size. Re-test #286 with the plain Qwen file.
- Phase 1, migrate APIs:
createChat/createSessiontoopenChat/openSession(one path for images); drop duplicated/no_think; adoptContextLimitException. - Phase 2, remove workarounds that Phase 0 proved fixed: fallback loops, pins, download checks.
- Phase 3, new features as separate issues: hybrid RAG search, speech, session reuse.
Each phase is its own PR with before/after numbers.
- Ngôn ngữ chính
- Dart
- Star
- 2
- Fork
- 2
- Merge trung bình
- 3 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 10
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của basictech01/uniun
-
documentation good first issue P3-Low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
basictech01/uniun#328 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug good first issue P2-Medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
basictech01/uniun#305 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug good first issue P3-Low
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
basictech01/uniun#327 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug good first issue P2-Medium
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
basictech01/uniun#324 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
app performance is slowĐang mởbug good first issue
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 18/100
basictech01/uniun#316 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của basictech01/uniun
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
TomBursch/kitchenowl#1255 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
maplibre/flutter-maplibre#709 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
getlantern/lantern#9387 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
bannzai/medicalarm#602 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày