Add Shensi and Shensi-VL models - #48404
Open
zongzhilou wants to merge 2 commits into
Open
Conversation
Contributor
CI recapDashboard: View test results in Grafana |
Contributor
|
Thank you for your contribution 🤗! CI Security Gate — automatic approval blockedThis PR was not automatically approved for CI because the security gate failed. Possible reasons:
See the workflow run for the exact violations. A maintainer can review and manually approve CI if a finding is a false positive. |
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: auto, shensi, shensi_vl |
Contributor
|
Thank you for your contribution 🤗! CI Security Gate — automatic approval blockedThis PR was not automatically approved for CI because the security gate failed. Possible reasons:
See the workflow run for the exact violations. A maintainer can review and manually approve CI if a finding is a false positive. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds two new models sharing a "DeepRecur" design: Shensi (text,
ShensiConfig/ShensiForCausalLM, checkpointlouzongzhi/Shensi-Nano) built onthe DeepSeek-V4 backbone, and Shensi-VL (multimodal,
ShensiVlConfig/ShensiVlForConditionalGeneration, checkpointlouzongzhi/Shensi-VL-Nano) pairingthe Shensi language tower with a Kimi K3 vision tower (MoonshotAI/Kimi-K3).
Shensi (text)
Three changes vs. the vanilla V4 stack:
GDAR-XHC — residual streams reworked following xHC
(arXiv:2607.14530): the residual runs as
hc_mult=16parallel streams with per-stream pre/route/post gating, only theactive streams are updated per step (no Sinkhorn constraint). The Gated Delta
Attention Residual replaces the remaining mHC machinery: each stream does
cross-layer attention internally — a delta rule keeps a per-block slot memory
with decay/erase/write gates, normalized-key retrieval, and softmax routing over
the slots of previous blocks — instead of stacking an extra attention module on
top of the hyper-connection.
Block Router & Block UniPool — router sharing across a block of layers
(arXiv:2603.18297, Path-MoE) combined with a
block-level unified expert pool (arXiv:2605.06665,
UniPool): the block's write layer owns the top-k router and the expert pool, the
read layers of the same block share them — one router and one pool per block
instead of per layer (parameters tied in the state dict). Shared experts are
removed following arXiv:2605.11689
(Slicing and Dicing: shared experts barely move the needle).
Block aux_loss & erc_loss — kept at block level from an information-theoretic
angle: the standard load-balancing
aux_lossminimizes the mutual informationbetween inputs and routed experts (not strictly required once the path constraint
removes the bias, but kept as a regularizer), while
erc_loss(arXiv:2512.23447) maximizes the mutual
information between outputs and routed experts. Together they give routing
stability and expert specialization, stacking on the specialization already
enforced by the path constraint for deep cooperation.
Shensi-VL (multimodal)
Shensi language tower + Kimi K3 vision tower, interleaved into DeepRecur blocks
that rely on GDAR:
retrieve vision evidence, language guidance is written back to vision;
language stream is refined with damped write-backs, and the loop stops on a
data-driven criterion — hidden-stream delta, reasoning-state delta and orbit
recurrence are combined, no hard iteration cap.
Notes
docs/source/en/model_doc/shensi.md,shensi_vl.md; tests:tests/models/shensi,tests/models/shensi_vl.state dicts stay alias-free and save/load round-trips exactly.
Who can review?