mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #678] Feature request: Optional Intel NPU support for the vision encoder #316
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#316
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @eveloso-web on GitHub (Oct 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/678
Hi Niko,
First of all, thank you for Strata — it’s an impressive piece of engineering and has made running the 125B MoE model on consumer hardware actually practical.
I’d like to propose a possible future improvement: adding optional support for Intel’s NPU (Neural Processing Unit) for the vision encoder.
Current situation
Right now strata-vision can run on:
GPU (fast, but reserves ~1.4 GB of VRAM)CPU (much slower)
On systems with Intel Core Ultra processors (Meteor Lake, Arrow Lake, Lunar Lake, etc.) there is a dedicated NPU that is specifically good at vision workloads (ViT-style models) and is power-efficient.
Why this could be useful
The vision encoder (mmproj / ViT + projector) is relatively small and fits the type of workload NPUs handle well.
Running the encoder on the NPU would:
Free the main GPU completely from vision work (no VRAM reservation)
Avoid slowing down the main text generation pathBe significantly faster and more efficient than the current CPU fallback
Many users with recent Intel CPUs already have the NPU available and idle most of the time.
Suggested approach (low priority / optional)
It would be great if support could be added as an optional backend, for example:
--vision npu or a config option "backend": "npu"Using OpenVINO (which already has mature NPU support) or the Level Zero / NPU driver pathKeeping the current GPU and CPU paths unchanged
I understand this is not a high priority given the main focus on the MoE text engine, and that implementing OpenVINO integration would require extra work. I’m mainly sharing the idea in case it aligns with any future plans or if other users have also requested something similar.
Thanks again for the excellent work on Strata.
Best regards,
Edgar
@Niko1221 commented on GitHub (Oct 7, 2026):
An NPU path for the vision encoder is out of scope for us: it needs OpenVINO and a second runtime, and we have no Intel NPU machine to test on. The practical options today are --vision cpu and a Q8_0 mmproj file (see the tip from #625). Closing.
@page1 commented on GitHub (Oct 14, 2026):
I would love to have someway to take advantage of this piece of silicon that sits idle 100% of the time since I purchased this CPU
@sibnick commented on GitHub (Oct 23, 2026):
An NPU path for the vision encoder now exists and is measured on real hardware, so I am
bringing the evidence back to the original thread per CONTRIBUTING; no pull request until a
maintainer says one is wanted.
What it is:
strata_vision_npu.py, a picture reader that speaks the same resident protocolas
strata-vision.cpp(READY / ENC / OK / QUIT,SVE1output), runs the Qwen3.8 encoder onan Intel NPU through OpenVINO, and
export_npu_encoder.py, which turns a Qwen3.8 mmprojGGUF into the IR it compiles. It never quietly becomes something else: no NPU, no OpenVINO
or a bad IR is one
ERRline and the server's CPU fallback. The default path is untouched -no CLI flag, no setup change, no download asks for it; it runs where a run config or a
runner names it as the
vision.exe, and it keepsgpu: falseso the engine reserves noVRAM for it (which required
cpu_fallbackto stop gating ongpu, the one shared-codechange).
Measured on this PC (desktop, Gigabyte Z890 UD WIFI6E, Intel Core Ultra 7 265K with the
Arrow Lake NPU, kernel 6.8.0-147,
intel_vpu 1.0, userspace driver 1.10.1, openvino 2026.4.1, Ubuntu 24.04, RTX 3090,
2026-10-23/24):
min 0.967598;
correctly, 637 of the 642 prompt tokens were the picture; repeat 1.9 s via the hash cache;
CACHE_DIR(the NPU driver's own cache keeps only one graph of this size -
ZE_INTEL_NPU_CACHE_SIZEchanged nothing at 4 GiB);
bare metal. The published image (GitHub Actions,
ghcr.io/sibnick/strata-npu-vision)was validated on this machine 2026-10-24: health check
devices: ['CPU', 'NPU'],a picture session answering
READY 2560thenOK 576 24 24 2188, and its embeddingsmatched a bare-metal encode of the same picture at cosine mean 1.000000 / min 1.000000.
Against the two reasons for closing: OpenVINO is a pip wheel that only an opt-in user
installs and never enters the shipped engine path; and for "no Intel NPU machine to test
on" - I am that machine, every number above is mine, and the whole thing runs from a
container so any Core Ultra owner can try it in five minutes, merged or not:
podman pull ghcr.io/sibnick/strata-npu-vision:latest(recipe and validation notes:container/npu-vision on https://github.com/sibnick/Strata/tree/npu-vision-reader, hardware
findings including two driver bugs in docs/INTEL_NPU.md). 60 tests run on any PC without a
driver or model (mock reader, synthetic mmproj).
Not tested: Windows, other NPU generations and driver versions, real docker (podman was
used), rootless podman device access, and any
strata launchwiring.If a maintainer wants this as a pull request, the branch is ready
(sibnick/Strata
npu-vision-reader, two commits: reader + public container). If NPU staysout of scope, the branch and the image stay published so idle silicon is at least useful.
@page1 commented on GitHub (Oct 25, 2026):
@sibnick thanks for this. We got your NPU reader running on Windows 11 (Core Ultra 9 285K, Arrow Lake NPU) under a standard user account: the tests pass, the export works, and it reads a 768x768 picture in about 1.85 s on the NPU. I plan to review it and test it with a live server over the next few days, and will post the full numbers here then.
@page1 commented on GitHub (Oct 27, 2026):
@sibnick here are the full Windows numbers I promised, plus a change for pictures that aren't 768x768. All numbers
below are mine.
Setup: Intel Core Ultra 9 285K (Arrow Lake NPU, NPU 3720, PCI
8086:ad1d) with an RTX 3090, Windows 11 Pro10.0.26300, Intel NPU driver 32.0.100.5540, Python 3.13.5,
openvino2026.4.1 from pip, 2026-10-24 to 2026-10-27.The mmproj is
mmproj-Qwen3.8-Flash-Next-BF16.gguf(its SHA-256 matches setup.py's pin). Everything on the NPU ranunder a standard user account, with no admin rights and no driver change.
Your branch as it is (
b3fb0ca9)strata-visiontakes5.0 s with 12 threads.
--cache-dirwarm,READYarrives in 4.1 s.strata-visionon 7 pictures (4032 rows), the same as your Linuxnumber.
and a split export without
--ln-scale maxstayed finite (0.997897).strata-vision-npu.cmdtriespy -3, thenpythonfrom the PATH. Under an account withneither, it exits with 9009 and no
ERRline. With one on the PATH it would pick that Python, not the venv withOpenVINO. Taking the interpreter from an environment variable (for example
STRATA_VISION_NPU_PYTHON) firstwould fix both. I haven't changed it.
vision.exe, a two-colour picture and a 768x768 app screenshot were answeredcorrectly. But a text-heavy 2000x920 screenshot squeezed to 768x768 had letters 2-3 pixels wide, and the model
made up words instead of saying it couldn't read them. The CPU reader at
max_tokens2048 (1827 tokens) readthe same screenshot almost word for word.
Pictures at any size:
--anysizeOne commit on top of your branch: https://github.com/page1/Strata/tree/npu-any-size
tools/vision/npu_anysize.py exportwrites graphs that know a token budget, not a picture size (default budgets576, 1024, 1536 and 2048 tokens).
strata_vision_npu.py --anysize DIR(orSTRATA_VISION_NPU_ANYSIZE) sizes each picture the way mtmd does: theaspect ratio is kept, the picture is letterboxed, and it gets at most
--max-tokenstokens. The reader pads itwith masked rows to the smallest budget that holds it, and passes in the resized positions and rope tables.
tools/test_npu_anysize.pyhas 13 tests. The 3 that need OpenVINO run on its CPU device and check the any-sizegraph against
export_npu_encoder.py's own graph of the same synthetic mmproj (cosine above 0.999 on every row).They also check that padding and chunking change nothing.
docs/INTEL_NPU.mdgets a section on it and the Windows numbers.Two things it took to compile on the NPU:
Chunked attention. A 2048-token budget is 8192 patch rows. One block with the whole 8192 x 8192 score matrix
per head didn't compile in 15 minutes, and the whole encoder didn't compile in 9 hours (85 GB of RAM, no error).
In chunks of 512 query rows, one block compiled in 29 s. The wall on this driver sits between about 5.3 and 8.4
million scores in one step:
NPU_COMPILER_TYPE=PLUGIN,NPU_COMPILATION_MODE_PARAMS=optimization-level=0or=1, andNPU_TILES=1did nothelp.
One block graph for all 27 blocks, with the weights as fp16 inputs. All four budgets compile in about 2
minutes and 2.6 GB. 27 separate graphs for the 2048 budget alone took 18 minutes and 17.6 GB. Passing the weights
in costs about 7% of encode time.
Ten app and terminal screenshots from the repo's docs (800x450 up to 3200x1910), read at up to 2048 tokens, one
resident reader each:
strata-vision, 12 threadsstrata-vision --gpu, RTX 30900.83), and 0.9958 for the GPU (0.93). Whether that changes answers I haven't tested.
power.draw. Per picture above idle: NPU about 143 J (+6.7 W), GPU about 293 J (318 W for 9 s), CPU about 2841 J(214 W).
READYin 5.3 s from a warm--cache-dir.PERFORMANCE_HINT=THROUGHPUT. Each picture then takes twice as long.NPU_TILES=1hangs this NPU (ZE_RESULT_ERROR_DEVICE_LOSTat the first encode, after a 205 s compile). Itrecovered, but the reset glitched audio playback on the PC. It looks like the same error as your Linux
whole-graph hang.
So on screenshots the NPU is about as fast as the CPU reader and 25-30 times slower than a 3090. It takes no VRAM,
almost no CPU, and the least energy per picture of the three. For comparison: in our setup the GPU reader cost the
model no measurable generation speed (about 90-97 tok/s with and without it), so on this PC the GPU stays the
first choice. The NPU fits background work, or a PC without a big GPU.
Not tested:
My
strata-visionreference is a local build from 2026-10-06.@sibnick commented on GitHub (Oct 27, 2026):
Thanks - I added your commit to my branch