FunctionGemma redecode contract: LM head + argmax run over all SEQ positions (36 % of every step, 1 GB scratch at SEQ 1024 in a 32-bit process); parameter archives are per-SEQ
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ó
- 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ính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- kotlin
- Lĩnh vực
- machine-learning
Hướng nghiên cứu
Start with FunctionGemmaExportHarness.kt at the ops.argMax(logits, dim = -1) call and trace how the exported redecode graph receives its inputs and emits parameters. The issue proposes changing position selection before the LM head and making position tables independent of SEQ; inspect the export and parameter archive paths to scope both changes. Done means the target position is computed without full-SEQ LM-head and argmax scratch, and one archive works across SEQ sizes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The exported redecode graph (func @gemma(tensor<1xSEQxi32>) -> tensor<SEQxi32>) computes the LM head for every position and then materialises three more SEQ×262144 tensors for the argmax, although the caller only ever reads one position per step:
%v3325 = stablehlo.dot_general %hidden, %embT : (tensor<1x64x640xf32>, tensor<640x262144xf32>) -> tensor<1x64x262144xf32>
%v3327 = stablehlo.reduce(... maximum ...) -> tensor<1x64xf32>
%v3329 = stablehlo.compare EQ ... -> tensor<1x64x262144xi1>
%v3330 = stablehlo.iota dim = 2 : tensor<1x64x262144xi32>
%v3332 = stablehlo.select ... -> tensor<1x64x262144xi32>
%v3334 = stablehlo.reduce(... minimum ...) -> tensor<1x64xi32>
(ops.argMax(logits, dim = -1) at FunctionGemmaExportHarness.kt:207.)
Measured consequences (arm32 Android device, IREE 3.11.0, FP32 archive, 13-token prompt)
| graph (SEQ 64) | CPU arm32 local-task, 4 threads |
Vulkan (Mali, host-side gather) |
|---|---|---|
| as exported | 10.40 s / step | 4.00 s |
| head sliced to the target position before the dot (hand-patched MLIR) | 6.61 s (−36 %) | 3.16 s |
| body only, no head | 4.49 s | — |
- SEQ 1024 (needed for an 853-token tool catalog prompt) cannot run in a 32-bit process: the step dies on
calloc(1, 1076363436)— the1024×262144i32 iota/select scratch. With the head sliced, SEQ 1024 runs on both CPU (77.3 s) and GPU (29.9 s). - Cost is linear in SEQ (SEQ 256 = 4.03× SEQ 64), so every prompt token costs ≈ 0.16 s per generated token on the CPU.
- Parameter archives are per-SEQ: the export bakes SEQ-sized position tables into the parameters (parameter
t46is 32 KB at SEQ 64, 128 KB at SEQ 256; a SEQ 256 module opened against the SEQ 64.irpafails withparameter 't46' range out of bounds). A cartridge shipping two SEQ tiers ships two 1 GB archives.
Proposal
- Add the target position as an input (or define "last non-pad position" semantics) and slice the hidden state before the LM head; return
tensor<1xi32>(or keepSEQxi32with the one computed position, for compatibility). - Emit the RoPE/position tables as computed values or as SEQ-independent parameters so one
.irpaserves every SEQ. - Both are prerequisites for the KV-cache contract (separate issue) and for the Vulkan tier, which is otherwise the fastest path on this device.
Context. Measured on 2026-09-03 while bringing FunctionGemma-270M up as an NLU cartridge on an arm32 Android device (Android 14, armeabi-v7a-only 32-bit process, 4× ARMv8 @ 2.0 GHz, Mali GPU) with SKaiNET 0.53.0 + SKaiNET-transformers 0.53.0 from Maven Central. Harness and raw result files: a local harness (can share on request).
- Ngôn ngữ chính
- Kotlin
- Star
- 8
- Fork
- 3
- Merge trung bình
- 1 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 48
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 SKaiNET-developers/SKaiNET-transformers
-
documentation good first issue size:xs skill:docs sub-issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
SKaiNET-developers/SKaiNET-transformers#478 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement skill:kotlin-core
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
SKaiNET-developers/SKaiNET-transformers#502 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
SKaiNET-developers/SKaiNET-transformers#483 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
coding good first issue size:s skill:kotlin-core sub-issue
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 64/100
SKaiNET-developers/SKaiNET-transformers#477 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
coding good first issue size:s skill:numerics sub-issue
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
SKaiNET-developers/SKaiNET-transformers#476 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SKaiNET-developers/SKaiNET-transformers
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
commons-app/apps-android-commons#7072 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug ci good first issue help wanted severity: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
dhananjay-nautiyal/music#17 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Watch Next: last engagement time is in seconds for played items and in milliseconds for the othersĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 79/100
damontecres/Wholphin#2112 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
beppe2880/opencode-mobile#60 ·
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 72/100