Let a one-shot request skip the prompt-cache work (~45 ms per call that is never reused)
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- ai-infra-agents, backend-api-design, performance
Hướng nghiên cứu
Start by reading the prompt-cache flow in src/program/generate.cpp and how requests are handled in serve/server.py; the issue notes that serve/server.py does not currently read cache_prompt. Determine how a request-level opt-out should avoid the turn split and checkpoint without disabling cache reuse for other conversations. Done means one-shot requests can opt out, while interactive chats retain reuse; the CPU fallback and trace-counter questions are separate investigations.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
A follow-up to part 2 of #519. Your explanation there of the fixed cost of the batched read (with about 40 % of the experts outside VRAM, a short batch still has to bring in nearly all the missing ones) matches what I see on 0.1.39: over 35 warm batched reads of 212 to 558 tokens the time fits about 245 ms + 0.33 ms per token. Following your suggestion, I moved the checkpoint to the end of the fixed instruction with --prompt-cache-root 64, which saves 20 to 40 ms per call. What is left on the cache side still costs about 45 ms per call.
Setup
- RTX 5090 32 GB (no display), Ryzen 9 5950X (AVX2), 96 GB DDR4-3200, Windows 11
- Strata 0.1.39 release, Swift IQ3_XXS,
--expert-cache auto(14,864 slots, 24.2 GiB),--prefill auto:32768,--max-context 32768,--kv int8,--pcie-frac 0.20,--spec 4 --spec-min-p 0.70,--prompt-cache-root 256for the numbers below (production now runs 64),STRATA_IQ_MT_MIN=1 - The workload: a fixed system prompt of ~100 tokens, then a user message of 150 to 450 tokens of code,
max_tokens1, thinking off. Every call has a different user message, and the same server also takes interactive chats that do reuse their conversations. - The numbers below use the same shape built from public text: a 278-character system prompt (about 70 tokens) and excerpts of v0.1.32's
src/program/generate.cpp, the same prompts in every run, 12 calls per size with the first 2 skipped, client on the same PC. I can share the script.
What the prompt cache costs on these calls
| User message | Prompt tokens read | prompt_ms, cache on |
prompt_ms, --prompt-cache 0 |
|---|---|---|---|
| ~150 tokens | 230 | 375 | 328 |
| ~300 tokens | 379 | 434 | 388 |
| ~450 tokens | 487 | 460 | 407 |
That is about 46 ms of prompt_ms and about 40 ms of wall time per call. With the cache on, the prompt is read in two parts, split at the last <|im_start|>, and a checkpoint is taken there. That checkpoint ends after the user message, which is different on every call, so nothing reuses it. With STRATA_TRACE=1, a 486-token prompt shows read 479 tokens (batched) in 403.5 ms, refilled 190 slots ... in 14.0 ms and read 6 tokens (windows) in 14.4 ms against prompt 486 tokens ... read in 460 ms. The trace leaves about 27 ms outside the timed reads, so the checkpoint itself costs at most that and the rest comes from the split.
--prompt-cache 0 removes this for the whole server, and the interactive chats lose their reuse with it. serve/server.py doesn't read cache_prompt, so a request can't ask for it.
Question
Could a request opt out of both the split at the last turn and the checkpoint when it has nothing to keep, for example by honouring cache_prompt: false, or automatically when a one-turn prompt's only reusable part is already a root? I'd expect it to save up to what --prompt-cache 0 saves on calls like these.
Separately: for a short batch where most of the missing experts are needed anyway, would running the non-resident ones on the CPU, as the decode windows do with misses, ever beat streaming them? If there's a trace counter that splits the batched read into transfer and compute time, I'd run it here.
I can share the traces and the script, and run a build with a change on this machine.
- Ngôn ngữ chính
- C++
- Star
- 11.6k
- Fork
- 1k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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 Niko1221/Strata
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 3 ngày
-
[Benchmark] Tesla T4 (sm_75): kIlRows_75 gives +12% on a T4; MMVQ_IL_TABLE.md says sm_75 is offĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Niko1221/Strata#4962 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[Other] tools/test_strata_mcp.py: unittest.main() sits before the last three test classes, so a direct run skips 7 testsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 3 ngày
-
[Other] tools/test_strata_mcp.py: the Mac DeepSeek list test fails on main (it still expects the two IST-DAS sets)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 3 ngày
-
[Engine] "Download and prepare" asks for the full 128 GB on an installed NVFP4 pack: the disk check looks in models\<family-tag><model> while setup writes models\<owner>--<repo>Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Niko1221/Strata#4892 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của Niko1221/Strata
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
colbymchenry/codegraph#3223 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
The `ufw` decoder requires the kernel's monotonic timestamp, so UFW lines read from journald decode without any fieldCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
arduino/ArduinoCore-megaavr#152 ·
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
microsoft/microsoft-ui-xaml#12515 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
BlueQuartzSoftware/simplnx#1906 ·
Maintainer thường phản hồi trong vòng 4 ngày