[Engine] Inkling-2-Mini vision runs on the CPU on Windows/CUDA, and a picture's KV is not reused between turns

オープン
#7,288 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp

調査の方向性

The report names ink_vision.h, ink_serve.h, ink_cuda_backend.cu, ink_backend.h, and ink_runner.cuh, plus the proposed ink_cuda_vision.cuh. Start by reviewing the vision encoder and image prefix reuse paths, then compare the author's patch and measurements with the engine logs. Done means CUDA vision encoding is faster and follow-up turns reuse cached image tokens; the report notes validation was limited to one Windows/CUDA machine.

索引モデルが issue の本文から書いたものです。

説明

needs-format

What happened

Two problems with pictures on inkling-2-mini with the CUDA engine on Windows:

  1. Encoding a screenshot is CPU work. A 1280×720 screenshot takes about 20 s before the
    first token; the release notes for 0.2.22 (#7043) list the same shape of numbers for the
    CPU path: 0.25 MP 15 s, 1 MP 74 s, 2.1 MP 334 s, 3 MP 743 s.
  2. A picture already in the conversation is read again on the next turn. There is no
    [InkReuse] line and no RESUME in the engine log for a chat that only extends its
    picture history, so the visual tokens are prefilled again.

Together this is what makes a screenshot-heavy chat unusable: 20 s to look at the first
picture, and the same picture paid for again on every follow-up.

Environment

Strata 0.2.22 (Terminal 0.2.22, strata-inkling 0.1.67/0.1.69, CUDA 13)
Windows 11, RTX 5060 Laptop 8 GB, 40 GB RAM
Inkling-2-Mini-Unbound-v2.1-Q4_K_M + Inkling-2-Mini-Vision
--max-context 65536 --kv fp8 --vision <pack>

What I think causes it (from reading the source, please correct me)

  1. The CUDA backend has no ViT kernels for Inkling: ink_vision.h runs the encoder on the
    host and keeps the weights as float, so every request that has a picture walks the ViT on
    the CPU. There is no STRATA_INK_VISION_CUDA style switch to put it on the card.
  2. ink_serve.h's reuse check compares cached_prefix with prompt_ids, and the picture
    branch only reuses an exact prefix when images is non-empty — a picture that arrives
    with new text after it does not reuse the KV that is already in the slot. The same
    SWA/ShortConv rewind limit described in #6627 applies here.

A patch that works on my machine

I built the 0.1.69 CUDA engine from source with two changes and measured on the same
screenshot:

  • CUDA ViT, fp16 weights uploaded once (ink_cuda_vision.cuh, wired through
    ink_cuda_backend.cu / ink_backend.h / ink_runner.cuh): the encoder runs on the card,
    the weights go up as fp16 straight from the pack, no 1.27 GB float staging copy.
    Screenshot encode: ~20 s → 3–5 s.
  • Picture prefix reuse (ink_serve.h, the images branch): a conversation that already
    holds N screenshots reuses their KV and reads only the new tokens. The engine now prints
    [InkReuse] images=2 cached=15723 prompt=16107 match=15723 and RESUME 15723.

Validation

  • Same model, same pack, same 64K context, RTX 5060 Laptop 8 GB.
  • Before: first picture ~20 s, follow-up re-reads the picture.
  • After: first picture 3–5 s, follow-up reads 384 of 16,107 tokens (the rest reused).
  • Output text is unchanged on the prompts I compared (same answer, same tokens).

Limits

  • Measured only on one Windows/CUDA machine (RTX 5060 Laptop, 8 GB).
  • I did not test the Metal or HIP backends.
  • I did not run the repo's test suite; the numbers above are from my own runs.

I can send the patch as a diff if you want it; it is three files plus the new
ink_cuda_vision.cuh.

主要言語
C++
スター
11.6k
フォーク
1k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Niko1221/Strata のほかの issue

Niko1221/Strata の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。