Repository navigation
dory support for llama.cpp - #30306
brianchmielNV wants to merge 10 commits into
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
Sorry, this is not ready, here's just a brief list of things that need to improve, but I also suggest you study other model PRs closely to get the general gist:
|
…tions. - BF16 parameters: removed the broad allow_non_f32_vectors switch; retained BF16 handling specifically for Dory scale parameters. - Tensor naming: renamed tensors by their function rather than the Dory architecture. - Tests: moved upstream coverage into existing test files; corrected shared-KV tests to respect chunk-dependent behavior. - Generated documentation: removed manual edits to generated operation-support files.
|
I pushed and review changes that should adress all 5 points raised. |
JohannesGaessler
left a comment
There was a problem hiding this comment.
This PR is making unrelated changes to the CUDA backend. For our bookkeeping this is unacceptable for a PR that adds model support.
…m Dory model support
|
I removed in commit a99be4a the CUDA fix and its dedicated tests. without changing the Dory support. |
CUDA specific issue resolved, no comment regarding the rest.
|
@CISC I’ve addressed the five points from your review and removed the unrelated CUDA changes. Johannes confirmed that the CUDA-specific concern is resolved. Could you please re-review the Dory changes and approve the CI workflows when you have time? Please let me know if anything else needs fixing before this is ready for review. Thank you for your time |
…sh PATCH= The Dory build no longer depends on the PR author's fork: the full diff of ggml-org/llama.cpp#30306 (base 6e66cb5 -> head 43e865e, 17 files, +507/-9, MIT notice in the header) is kept in patches/, and build-llama-cuda.sh gained PATCH= to git-apply it on top of stock llama.cpp (skipped if already applied, fails if it doesn't apply). Verified: the patch on 6e66cb5 reproduces the PR tree exactly, and a from-scratch build that way serves Dory at the same speed (28.8 vs 29.3 tok/s, prefill 852 tok/s both, tool call ok). docs/dory-on-8gb.md: new section explaining what the patch adds (dory arch, virtual layers = 16 + 40 x loops + 16 -> why -ngl 999, loop/nGPT graph, KV modes, converter) and the alternative of building the PR commit straight from ggml-org. Corrects the earlier claim that the PR head adds a CUDA precision fix: it moved that TF32 change out, which is a no-op on Turing anyway.
|
The current conversion code does not work with the published checkpoints at https://huggingface.co/nvidia/NVIDIA-Nemotron-Labs-Dory1.0-4B-BF16. Almost all of the parameters in |
Dory (NVIDIA-Nemotron-Labs-Dory1.0-4B) is a looped normalized-GPT: 16 input, 40 recurrent and 16 output layers, the recurrent block run num_loops times per token, with sliding-window and full attention. - Port ggml-org/llama.cpp#30306 (brianchmielNV/llama.cpp @ 98a74c9) as scripts/patches/llama.cpp/dory-*.patch. Only src/ is needed here; the PR's CUDA change does not apply to these builds. sync-vendor.sh on a clean tree reproduces vendor/llama.cpp byte for byte. - kv_overrides (JS load option): model metadata overrides keyed as in the GGUF, e.g. { 'dory.num_loops': 2, 'dory.recurrent_kv_cache_mode': 'last_loop' }. A whole number is an int, any other number a float. - The K2-Horizon release now also fails if a library lacks Dory. - Version 0.13.0-rc.6-k2h.10. Tested on x86 (4 threads) with NVIDIA's Q5_K_M GGUF: coherent output at 1, 2 and 4 loops, and at 2 loops with last_loop caching; 6.1, 4.3 and 2.4 tokens/s at 1, 2 and 4 loops. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JV9oPdgsGMH9vsUiWtW1v4
…ving on the 1070 Ti The excluded dory and lfm3 rows were gated on an engine upgrade, not a retry. That upgrade is now built and proven: /opt/llama.cpp-dory (PR ggml-org/llama.cpp#30306, 1c3cdd2, CUDA sm_61) loaded Dory Q5_K_M and LFM3-1.7B-IQ2_M and answered real chat completions on 127.0.0.1:8892. The running campaign keeps a2878d3 so its 48 configs stay comparable; the next sweep can re-enable those rows as an engine-vs-engine change. Dory per_loop KV costs ~4x normal KV per token.
|
Any idea when this could get merged? Looped models seem to work great at these scales. |
…A numerical, serving, conversion, FP8 and KV-shift checks.
Dory1.0 4B usa l'arch. `dory`, che non esiste in llama.cpp (solo nella PR ggml-org/llama.cpp#30306): con b11457/b11707 il load muore con "unknown model architecture". Il hub ora risolve il binario per modello (engine: 'dory' -> tools/llama-cpp-dory) e tiene il modello fuori dalla lista finché quel motore manca, così non compare mai elencato e rotto. Nemotron 3.5 Bolt E4B era nel registry del hub ma invisibile in Chat: mancava la voce in text.ts. Correggo anche catalogo (puntava a un UD-Q4_K_XL da 5,06 GB con lo SHA del file locale: ogni download finiva con "SHA256 non corrisponde"), manifest, percorsi dei bench ARC/probe-thinking e documentazione. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <[email protected]>
|
/bot review |
Automated code reviewReview of PR #30306 (dory support)Checklists run: General, Security, New model/architecture, Approach & design, Tests, plus the quick-reject gate. Overall this is a well-contained, single-purpose arch PR. The physical/virtual layer indroduction ( Should fix(point 1) Direct (point 2) Graph-wide (point 3) Redundant special case in (point 4) No quantized KV-cache coverage - the new attention path (per-loop caches, shared-cache repeated writes, iswa wrapper) is exactly the kind of feature that silently breaks with Nits(point 5) Formatting drift in (point 6) (point 7) (point 8) (point 9) Process notes: I don't see a linked llama.cpp issue for this feature - features are supposed to start with an issue/discussion first; there is clearly maintainer engagement in the comments already, but linking one would help. The AI disclosure is filled in, thank you - just keep in mind that per This review was generated automatically by pi coding agent using |
|
@brianchmielNV PTAL at the review notes and fix the major ones. |
The same fix landed in ggml-org/llama.cpp#30306 on 2026-10-20 (9e2f3be). NVIDIA's model card still pins 98a74c9, which predates it. Reframe the patch as a backport for that revision and point readers to a newer one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ving on the 1070 Ti The excluded dory and lfm3 rows were gated on an engine upgrade, not a retry. That upgrade is now built and proven: /opt/llama.cpp-dory (PR ggml-org/llama.cpp#30306, 1c3cdd2, CUDA sm_61) loaded Dory Q5_K_M and LFM3-1.7B-IQ2_M and answered real chat completions on 127.0.0.1:8892. The running campaign keeps a2878d3 so its 48 configs stay comparable; the next sweep can re-enable those rows as an engine-vs-engine change. Dory per_loop KV costs ~4x normal KV per token.
ggml-org#30306 squashed onto master: NVIDIA's Nemotron-Labs Dory 1.0, input, looped recurrent and output layer groups, the recurrent group run num_loops times with a cache for each pass. On top of the pull request: its graph budget, 128 nodes a layer, is the model's graph_nodes_per_tensor, as master now sizes graphs; its test harness changes, which no longer apply to master's, are left out. Chaty-Carry: optional
ggml-org#30306 squashed onto master: NVIDIA's Nemotron-Labs Dory 1.0, input, looped recurrent and output layer groups, the recurrent group run num_loops times with a cache for each pass. On top of the pull request: its graph budget, 128 nodes a layer, is the model's graph_nodes_per_tensor, as master now sizes graphs; its test harness changes, which no longer apply to master's, are left out. Chaty-Carry: optional
ggml-org#30306 squashed onto master: NVIDIA's Nemotron-Labs Dory 1.0, input, looped recurrent and output layer groups, the recurrent group run num_loops times with a cache for each pass. On top of the pull request: its graph budget, 128 nodes a layer, is the model's graph_nodes_per_tensor, as master now sizes graphs; its test harness changes, which no longer apply to master's, are left out. Chaty-Carry: optional
ggml-org#30306 squashed onto master: NVIDIA's Nemotron-Labs Dory 1.0, input, looped recurrent and output layer groups, the recurrent group run num_loops times with a cache for each pass. On top of the pull request: its graph budget, 128 nodes a layer, is the model's graph_nodes_per_tensor, as master now sizes graphs; its test harness changes, which no longer apply to master's, are left out. Chaty-Carry: optional
- Use standard RoPE and precision-policy helpers - Improve converter validation and share scale-tensor definitions - Add Q8_0 KV-cache and FFN-only offload regression tests - Fix architecture-test graph reservations
|
@pwilkin I pushed the the review fixes in 8481bd0 and resolved the upstream merge conflicts. Changes:
Two suggested removals were not safe:
Could you please re-review and approve the pending CI workflows? Thank you. |
| // Dory uses physical-layer RoPE profiles and post-RoPE normalization. | ||
| if (model.arch == LLM_ARCH_DORY) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
you sure about this? build_rope can already handled this
add a test case in test_kv_shift just to be use
…ar aún) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
ggml-org#30306 squashed onto master: NVIDIA's Nemotron-Labs Dory 1.0, input, looped recurrent and output layer groups, the recurrent group run num_loops times with a cache for each pass. On top of the pull request: its graph budget, 128 nodes a layer, is the model's graph_nodes_per_tensor, as master now sizes graphs; its test harness changes, which no longer apply to master's, are left out. Chaty-Carry: optional
ggml-org#30306 (8481bd0) squashed onto master: NVIDIA's Nemotron-Labs Dory 1.0, input, looped recurrent and output layer groups, the recurrent group run num_loops times with a cache for each pass. On top of the pull request: its quantization recipe names master's tensor categories as master spells them now (TENSOR_CATEGORY_FFN_*), and its test harness changes, which no longer apply beside master's, are left out. Chaty-Carry: optional

Overview
NVIDIA-Nemotron-Labs-Dory1.0-4B-BF16 is a latent-recurrent / looped large language Model (LLM) trained by NVIDIA. This is the full-precision (BF16) release of Dory1.0-4B. The model employs normalized-GPT architecture with interleaved hybrid sliding window attention (SWA) and full attention layers. By repeatedly applying a shared block of layers, Dory1.0-4B can trade inference compute for accuracy by changing the loop count.
The PR include:
HF-to-GGUF conversion to support Dory model
Support for recurrent loops k=1-4
support of kv cache separate per loops and slaos last loop kv cache shared. last_loop retains historical tokens’ final-loop KV. It changes predictions compared with separate caches, and prefill chunk size matters.
Tested: bf16, q4_k_m and q5_k_m formats
Additional information
Referencing vLLM PR #60149 (vllm-project/vllm#60149).
include: 96/96 numerical comparisons on CPU and CUDA separately; 36/36 real-checkpoint serving smoke tests
limitations: Metal untested; full CI and long-context qualification incomplete; context shifting, runtime re-save, and K>4 unsupported.
Requirements
Yes, Use gpt-6-astra to create the code and tests. including debuging.