Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Turn on speculative decoding for Gemma 4

Đang mở
#218 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
55/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
dart, flutter

Hướng nghiên cứu

First check the Gemma 4 E2B load log and compare the generation chunks/sec with speculative decoding on and off on a real Android phone; the issue says to do this before coding. Then read lib/data/datasources/llm/flutter_gemma_gateway.dart, lib/data/datasources/llm/local_model_params.dart, and the AIModelRunner and lib/features/shiv/gana/engine/gana_workmanager.dart entry points. Done means speculative decoding is enabled for Gemma 4 only, tests cover other models remaining off or unset, and the measured result supports enabling it; this depends on #216.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement P2-Medium

What

Turn on speculative decoding for the Gemma 4 E2B and E4B models.

What is speculative decoding (simple version)

A small, fast "draft" model guesses the next few words, and the big model checks them in one step. When the guesses are right, you get several words for the price of one, so answers come out faster.

Why

Google's model cards show a big speedup on an S26 Ultra GPU:

Model Without With
Gemma 4 E2B 51.5 tokens/sec 66–92 tokens/sec
Gemma 4 E4B 21.9 tokens/sec 37–49 tokens/sec

Things to know first

  • It speeds up writing the answer, not reading the prompt. Short outputs (Nataraj cards, translations) will gain less than the numbers above.
  • Only Gemma 4 supports it. Not Qwen3, not DeepSeek R1.
  • Today we never pass the setting, so the plugin uses whatever the model file defaults to. It may already be on, or off — we don't know yet.
  • Model files downloaded before May 5, 2026 don't have the draft model. They just ignore the setting — no crash, just no speedup. So no special handling is needed.

Step 1 — measure (do this first)

  1. Load Gemma 4 E2B on a real Android phone and check the log. The engine prints enable_speculative_decoding: true or false when it loads. If it's already true, we may be done.
  2. Run the same prompt with it on and off and compare the generation total ... chunks/sec log line.

Step 2 — code (if it helps)

  • Add an enableSpeculativeDecoding option to FlutterGemmaGateway.getActiveModel (lib/data/datasources/llm/flutter_gemma_gateway.dart)
  • Turn it on for Gemma 4 only (a flag in lib/data/datasources/llm/local_model_params.dart)
  • Pass it in AIModelRunner and in the background Gana path, which calls FlutterGemma.getActiveModel directly (lib/features/shiv/gana/engine/gana_workmanager.dart)
  • Tests for "on for Gemma 4, off/unset for other models"

Estimate: about half a day — 2–3 hours of code, ~1 hour measuring on a phone (plus the ~2.6 GB download if Gemma 4 isn't installed).

Depends on #216 (flutter_gemma 1.8.3 + GPU on Android).

Ngôn ngữ chính
Dart
Star
2
Fork
2
Merge trung bình
18 giờ 53 phút
Pull request đã merge (30 ngày)
35

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của basictech01/uniun

Tất cả issue của basictech01/uniun

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.