mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5256] [Engine] Cache DeepSeek-V4.1 image conversations across slots and shared starts #5366
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#5366
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/5256
Author: @Moeblack
Created: 11/4/2026
Status: 🔄 Open
Base:
main← Head:feat/dsv41-image-slots📝 Commits (1)
f138e79[Engine] cache DeepSeek image conversations across slots and sequences📊 Changes
8 files changed (+471 additions, -142 deletions)
View changed files
📝
docs/DEEPSEEK41.md(+6 -0)📝
serve/ds_pictures.py(+8 -3)📝
serve/server.py(+23 -10)➕
src/dsv41/ds4_images.hpp(+45 -0)📝
src/dsv41/ds4_main.cpp(+101 -83)📝
src/dsv41/ds4_model.cu(+186 -18)📝
src/dsv41/ds4_model.hpp(+8 -2)📝
src/dsv41/ds4_slotmeta.hpp(+94 -26)📄 Description
Problem and result
In
strata-dsv41, conversations containing images were excluded from conversation slots (if (held.empty()) slot_put("")) and could not reuse shared starts (slot_saverejected states when!imgs.empty(), even at restore points before the first image). In addition,heldimage records lived in a single variable inds4_main.cpprather than per-sequence state under--parallel.With this change:
DS4SLOT2/DS4META3), storing each image's{start, len, hash}so prefix matching stops safely before any changed image.prefixes) work for image requests when the shared prefix precedes the first image or contains identical images.seq_park()/seq_unpark()under--parallel.Related discussion
none
Approach
ImageSpan { start, len, hash }insideModel(andSeqStatefor--parallel) instead of a globalheldvector inds4_main.cpp.prefixes, andslotsby comparing image{start, len, hash}spans (image_prefix).slot_saveat restore pointatwhen no image precedesat, or serialize the activeImageSpanlist intoDS4SLOT2/DS4META3when saving full image conversations.(width, height)before invoking the vision encoder so cached image spans skip re-encoding on restore.Validation
Passed:
strata-dsv41on Linux (sm_89, CUDA 13.0) and randeepseek-v4.1-flash-ist-das-2.25bpwwith--vision on --vision-resident --parallel 4andSTRATA_DS4_SLOT_KEEP=1:red squareandblue circle, reusing the 366-token system prefix on the second request:A1..E1) under--parallel 4evicted image conversationAto a RAM slot; follow-upA2restored all 583 tokens without re-reading the image:A3restored the 605-token image conversation from disk (DS4META3) without re-encoding the image:Failed:
Not run:
Limits
DS4SLOT1/DS4META2slot files from earlier runs are not migrated and will be re-read once after upgrading.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.