mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4067] [Engine] Qwen3.8 native video: token/PLE validation and reference patch #1762
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#1762
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 @RAFOLIE on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4067
Area
[Engine] (server, vision reader and inference engine)
What do you want to do?
Send a short video from an OpenAI-compatible chat client to Qwen3.8-Flash-Next, retaining temporal-pair encoding, video token IDs and timestamps through inference.
I am sharing an AI-assisted, experimental local implementation and its measured results for scope discussion. Maintainers are welcome to inspect, adapt or reimplement useful parts under this repository's MIT license. This is reference material, not a claim that the implementation is ready to merge.
There is already video-input work in #1609, with related work/discussion in #2023 and the closed #2421. This issue supplies additional CUDA evidence and a complete patch for that effort, particularly around preserving
video_padIDs for PLE. I have not run those PR branches and am not reporting a reproduced bug in them or claiming this is the first video implementation.What do you do today instead?
My earlier workaround sampled a video into separate still-image inputs. The attached prototype instead sends pairs of frames through the existing temporal encoder and preserves their video representation in the engine. Audio is not processed. PDF conversion is separate and is outside this patch.
Reference implementation
Base: v0.2.4.2, commit
dfa3f4025c9f1bc4af8cee201b20a2d223061813. The patch contains six implementation files and three test files. No model weights or llama.cpp dependency pin were changed.video.enabled, restricted to the verifiedqwen4exparchitecture. Both rebuilt binaries must confirm support: readerVIDEO_PAIR1, enginenative_video=1.video_urlcontent. Remote video URLs, local video paths and video input through the other API formats are not supported by this prototype.ENCV <frame0> <frame1> <output>protocol takes two decoded frames; it is not wire-compatible with whole-video ENCV proposals. The original imageENCcommand remains available.video_pad(248057) tokens. Original IDs remain available to PLE. The position helper handles per-group[1,H,W]M-RoPE grids and mixed image/video order.The token/timestamp/position choices were checked against the pinned model configuration, Qwen3-VL processor, and Qwen4Exp implementation. This source comparison is not a numerical parity result.
How to try the prototype
Apply the three patch parts below in numbered order to the base commit, then rebuild both
strataandstrata-visionusing the repository's build instructions. Keep the existing pinned llama.cpp revision3cf03257f219afbe7334045ff7c6a06ac68c627d. FFmpeg and ffprobe must be on the server's PATH.Point an existing working server configuration at the rebuilt engine and vision reader, then merge this fragment into that configuration (it is not a complete configuration):
The server adds the native-video flags to its subprocesses. Confirm that
/healthadvertises video support before sending a request. The final local inference checks used--vram-reserve-mib 3072; that is a tested setting for this machine, not a universal recommendation.Example Chat Completions content, with a placeholder that must be replaced by an actual clip's base64 data:
Validation: passed
Environment: Windows x64, RTX 4090 24 GB, Ryzen 9 5950X, 64 GB RAM; CUDA 13.0.48, MSVC 19.44.35229. Model:
Qwen3.8-Flash-Next-GSQ-RCO-IQ3_Swith BF16 mmproj. Context configured to 131,072, int8 KV, speculative depth 4. Setting a context limit is not evidence of testing that full length.Both Release CUDA SM89 binaries compiled and were used for the inference checks. All nine exported source files match the source recorded for those builds.
Relevant Python tests: 455 cases, 451 passed, 4 skipped. Commands below are the executed suite commands with the local Python executable paths normalized to
python. The decoder suite used an environment with FFmpeg/ffprobe available.The standalone
tools/vision/native_video_positions_test.cppcompiled with MSVC and ran successfully:native video/image M-RoPE position tests passed. It checks text/image positions, video IDs and positions, mixed spans and malformed inputs. It is one additional executable check, not included in the Python count.Actual GPU reader comparison: ordinary image A and duplicated temporal pair AA produced bit-identical embeddings. AA versus AB relative L2 was
0.77521067; AB versus BA was0.82118547. All outputs were finite, 252 tokens, grid 12x21, embedding width 2560. This demonstrates that the second frame and its ordering affect encoding; it does not establish reference-encoder parity or video-answer accuracy.A private 15.04-second, 720x1280, 24 fps clip produced 32 sampled frames / 16 pairs / 4,032 video tokens. Normal and streaming Chat Completions completed. The final streaming run, with 3,072 MiB VRAM reserve, returned reasoning, nonempty answer content and
[DONE](4,190 input / 155 output tokens, 7.984 seconds). This is a single observed run, not a speedup benchmark.A separate 34,554-token synthetic text input completed with reasoning and an answer using the same reserve. It was not a replay of the earlier failing client request.
The full exported patch passed
git apply --checkagainst files from the stated base. Applying it reproduced all nine local source files after line-ending normalization. This check does not establish applicability to current main.Validation: failed / observed limitations
An earlier configuration with an explicit 0 MiB VRAM reserve reached zero request-time VRAM headroom and watchdog exit on a roughly 34K-token client request. Later checks used 3,072 MiB reserve. The successful synthetic input does not establish that every long-request failure is fixed. A Windows commit-memory warning was also observed.
The video answers sometimes omit events or misidentify objects. No accuracy benchmark was performed. The existing text/image tests and duplicate-frame comparison passed; exhaustive byte-identical regression coverage of all default behavior has not been established.
Validation: not run
HIP, SYCL, Metal and Linux builds; other GPUs/models; full Transformers embedding parity; long-video quality; full 128K stress; audio; native PDF; side-by-side comparison against the related PR branches. Cross-backend validation remains necessary before an implementation can be proposed for merging.
Complete source patch
Patch part 1/3 · Patch part 2/3 · Patch part 3/3
The three numbered comments contain the complete unified diff, including the five newly added files. Concatenate only the fenced diff contents in order as UTF-8 with LF endings, preserving the final newline, then use
git apply --check native-video.patchfollowed bygit apply native-video.patchin a disposable checkout of the base revision.Full patch: 95,134 bytes, SHA256:
Only source and test code is shared here; the private clip, model files, binaries, crash dump and raw local logs are excluded.
Would preserving video token IDs through PLE and adding these temporal-pair checks be useful to the existing video-input effort? Please feel free to take only the useful pieces; I am sharing the implementation through this issue so maintainers can decide the appropriate integration and scope.
@RAFOLIE commented on GitHub (Oct 25, 2026):
Reference patch — part 1/3
Save the fenced diff as
native-video-part-1.patch(UTF-8, LF). Concatenate the parts in numbered order before applying. This is part of the AI-assisted local prototype described in the issue.Part SHA256:
27b7533f072c342ae1629621a441a1305494a944f1df50ced0bdb85d7363f205@RAFOLIE commented on GitHub (Oct 25, 2026):
Reference patch — part 2/3
Save the fenced diff as
native-video-part-2.patch(UTF-8, LF). Concatenate the parts in numbered order before applying. This is part of the AI-assisted local prototype described in the issue.Part SHA256:
3c5a12eb15dc3688b8b28626a8b5ba353f5ceefe1421df28f1bc164730a31846@RAFOLIE commented on GitHub (Oct 25, 2026):
Reference patch — part 3/3
Save the fenced diff as
native-video-part-3.patch(UTF-8, LF). Concatenate the parts in numbered order before applying. This is part of the AI-assisted local prototype described in the issue.Part SHA256:
02fc4c4b053b6a313d6a8ae572294db8bd4cde599c99ef4ff92886b812c6e920@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.