Skip to content

E7: qwen3_moe model-family contract first (contract → code → parity) #5056

Closed as not planned

Description

@noahgift

Child of #4001 (Any Model).

First architecture added contract-first: contracts/model-families/qwen3_moe.yaml, validated by pv, with falsification tests, plus the MoE rows in apr-architecture-schema-v1, arch-constraints-v1 and architecture-requirements-v1. Code is derived from the contract afterwards (GH-323 codegen path), never written ahead of it.

Done when: pv validate is green on the family contract; ArchConstraints for qwen3moe is generated from it; CPU parity vs llama.cpp is measured on more than one prompt. CUDA MoE parity waits on #4378.

Refs #4001 #4801

Activity

  1. added this to the 0.74.0 milestone on Oct 10, 2026
  2. noahgift commented on Oct 10, 2026

    @noahgift
    MemberAuthor

    Finding rows (la-0.74, on la-74/wip, no PR; these ride this ticket's PR, and no new ticket is minted because the E7 child budget is 3/3):

    • F1. Model-family contracts: there are two copies and no sync guard. crates/aprender-core/build.rs reads crates/aprender-core/contracts/model-families/ (16 families, fix: PMAT-517 — publish safety gate prevents broken crates.io releases (19 incidents) #701) before the root contracts/model-families/ (29). As a result, 13 root families never reach build_default_registry, and qwen3_5.yaml already differs between the two copies. qwen3_moe is guarded by FALSIFY-MF-QWEN3MOE-005 (the two copies must be byte-identical); no other family has a guard.
    • F2. Arch-requirements logic: three hand-written copies that are not derived from the contract. (a) cuda/types.rs WeightValidation skipped the dense FFN when is_moe. This is fixed here: the contract now has the is_moe cells (1.1.0) and the skip is deleted. (b) aprender-core/src/format/layout_contract_enforce.rs keeps its own hand-written (qk_norm, bias) table. That table has no MoE row and is still open. (c) arch_requirements_fallback.rs is regenerated in this branch. Also, KANI-ARCH-001..003, which the contract names, have no Rust harness.
    • F3. serve codegen read an archived contract. Fixed in f4facac. build.rs looked for ../../../provable-contracts/, which resolved only from ~/src/aprender, to the archived sibling repo. Every worktree and CI build therefore used the fallback.
    • F4. A restored contract is not re-read. When the YAML is missing, build.rs emits no rerun-if-changed for it, so restoring the file does not regenerate the code. This was observed on intel: a planted mutant ran against a stale fallback until build.rs was touched. This is still open.

    R4 evidence: on intel @7459baae12, FALSIFY-ARCH-013 is green both through the contract and through the fallback (54/54 each). A planted mutant (the MoE cell changed to base) turns 3 of the 54 tests red.

  3. noahgift commented on Oct 10, 2026

    @noahgift
    MemberAuthor

    F4 fixed on la-74/wip @84160930ff: a missing architecture-requirements YAML now watches its parent dir. Intel lane (move YAML away, build, restore without touching build.rs, build): control 8f388bd stays on the fallback, 8416093 regenerates from the contract. A second no-op check with the YAML missing reruns nothing (#4614 cost not reintroduced).

  4. 70 remaining items

  5. noahgift commented on Oct 14, 2026

    @noahgift
    MemberAuthor

    merged into #5315 (master ticket for epic #4001; triage rule 7b, 2026-10-14). It is a checklist row there; reopen this issue when work on it starts or its PR opens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions