Skip to content

Unify DSV4 onto the canonical MoE fold and requalify to K3 = 0 - #48

Closed
kiddyboots216 wants to merge 0 commit into
feature/canonical-moe-fold-unification-20260810from
dsv4-canonical-unify
Closed

Unify DSV4 onto the canonical MoE fold and requalify to K3 = 0#48
kiddyboots216 wants to merge 0 commit into
feature/canonical-moe-fold-unification-20260810from
dsv4-canonical-unify

Conversation

@kiddyboots216

Copy link
Copy Markdown
Contributor

Trainer half of the DSV4 canonical-fold unification (serving half: togethercomputer/xorl-sglang#18). Built on #45 plus a merge of #44, this migrates DSV4 off the architecture-scoped NCCL-tree contributor-order reproduction onto the shared canonical_moe_fold_v1 — the deliberate byte change #45 flagged as requiring full requalification, which this branch carries end to end (K3 exactly 0.0 at the 64-decision trained-adapter promotion replay, k3_max 0.0, decode 5.5 tok/s).

Fold switch (1adc5db7)

  • exchange_variable_and_nccl_tree_chain_sum ([1..7,0] left-associative chain) is retired; exchange_variable_and_canonical_fold keeps DSV4's variable-row all-to-all transport and reduces the rank-ordered arrivals with canonical_moe_fold_v1 — the same byte program serving evaluates through its gated canonical post-experts combine.
  • New unit witnesses include a byte-divergence test proving the fold is the balanced tree and not any left-associative chain (half-ulp tie construction).

Launch-geometry mirroring (facace92)

  • The trainer's Marlin row pad to 48 is retired: under the chunked exact-Marlin program (xorl-sglang#18) the pad made the trainer's decode segment run its live row in an M=10 chunk while serving launches M=1, diverging value-dependently. The trainer now launches exactly the serving runner's M per gathered segment.

Exact-head scoring kernel (41bd2c54)

  • Serving's deterministic mode interposes log_softmax with the batch-invariant Triton kernel, whose BF16 rounding differs from ATen's on boundary rows (proven at one decision: the f64 truth sits 5.5e-8 past the bf16 boundary; the entire trunk through final-norm was byte-equal). The DSV4 exact head's forward VALUE now uses the serving kernel; the surrogate VJP keeps FP32 reference math.

Qualification record (e940116f, plan doc + lane log)

  • Base ruler byte-equal at 4 AND 64 decisions (engagement witness: decode bytes changed vs the DSV4-Flash active-LoRA zero-K3: full qualification closed (K3 = 0 at 64-decision promotion) #45 program); A-join zero/nonzero joins green with the perturbed negative control correctly diverging; training gate with a correctly-diverging post-step control; B-join with the saved dsv4_expert_banks adapter; 64-decision promotion at K3 = 0.0.
  • Three latent campaign-1 value-luck defects were burned down along the way (off-path serving combine gate, Marlin multi-block-expert completion-order race, ATen-vs-BI log_softmax split); the lane log carries the full localization record.

Merge conflicts with #44 resolved per the reconciliation notes (auto.py keeps both the Qwen capability resolution and the DSV4 fail-closed registration; single-writer + 948-factor export both preserved). Supersedes the combine-order half of #45; intended for the #41 -> #43 -> #44 -> #45 restack by the reconciliation owner.

@broly-code-security-scanner

broly-code-security-scanner Bot commented Aug 11, 2026

Copy link
Copy Markdown

Broly Security Scan

Note

Summary

0 actionable finding(s) in this PR
3 total in scan · 0 dismissed false positives

3 finding(s) below the medium reporting threshold are not listed above — see the repository Security tab for the full set.

No finding is at or above high, so this check is not blocking. The findings above are still tracked and reported.

Note

Re-scan this PR anytime with /broly scan — useful after /broly undismiss, or to refresh findings without a new push.

Broly — SAST (zai-org/GLM-5.2) · Secrets · SCA · IaC · GH Actions · Base Images · Supply Chain Threats · Exploit Chains · Adversarial Verification

We're continuously improving Broly's accuracy and finding quality — your feedback is valuable. False positives, missed findings, bugs, and feature requests all welcome.

Ask in #security-engineering   Powered by Together AI

Comment on lines +79 to +83
trainer = torch.load(
RD / f"campaign2/dumps_dec39_trainer/components.rank{args.rank}.pt",
map_location="cpu",
weights_only=False,
)


def load_pass(path: Path) -> dict:
d = torch.load(path, map_location="cpu", weights_only=False)
Comment on lines +48 to +52
trainer = torch.load(
RD / "campaign2/dumps_dec39_trainer2/components.rank0.pt",
map_location="cpu",
weights_only=False,
)
else:
pass_file = args.pass_file

sampler = torch.load(pass_file, map_location="cpu", weights_only=False)
Comment thread scripts/reproduce_dsv4_hash_topk.py Outdated
parser.add_argument("--vocab-size", type=int, default=129280)
args = parser.parse_args()

capture = torch.load(args.capture, map_location="cpu", weights_only=False)
Comment on lines +25 to +32
trace = json.load(open(args.trace))
doctored = copy.deepcopy(trace)
for cap in doctored["captures"]:
cap["output_ids"][args.decision] = args.token
prompt_len = len(cap["prompt_ids"])
cap["full_ids"][prompt_len + args.decision] = args.token
doctored["label"] = f"{trace['label']}-doctored-d{args.decision}-t{args.token}"
json.dump(doctored, open(args.output, "w"), indent=1)
Comment on lines +25 to +29
trainer = torch.load(
RD / "campaign2/dumps_dec39_trainer2/components.rank0.pt",
map_location="cpu",
weights_only=False,
)


def _post(url: str, payload: dict[str, Any]) -> dict[str, Any]:
response = requests.post(f"{url.rstrip('/')}/generate", json=payload, timeout=900)
Comment thread scripts/capture_dsv4_exact_trace.py Outdated
Comment on lines +75 to +77
tokenizer = AutoTokenizer.from_pretrained(
str(model_path), trust_remote_code=True, local_files_only=True
)
Comment on lines +61 to +65
response = requests.post(
f"{url.rstrip('/')}/api/v1/retrieve_future",
json={"request_id": request_id},
timeout=300,
)
@kiddyboots216

Copy link
Copy Markdown
Contributor Author

Folded into #45 by the reconciliation restack. Final trainer head: b8b73ef4a217d9ce8e423e5d2f430b2fbcffbf57, pinned to xorl-sglang #17 at 9680d4bda91ad21f5eb592d02eeebcbe2d901e4f. The production Campaign 2 summary is retained; campaign-only lane artifacts remain out of the public diff.

@kiddyboots216

kiddyboots216 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Final reconciled heads after the live gitlink and hygiene audits: trainer #45 is d09fb81540bde8e3689c14c725e8229a301e2643, pinned to sampler #17 at 9680d4bda08bb7b9878aec1642d74688db36dfaa. The campaign-only hash-topk replay helper was removed from the public diff to close Broly findings.

@kiddyboots216
kiddyboots216 deleted the dsv4-canonical-unify branch August 17, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants