Skip to content

docs(ezpz): salvage MoE TP>1 diagnosis and link checker from #15 - #77

Merged
saforem2 merged 4 commits into
ezpzfrom
docs/salvage-pr15
Nov 12, 2026
Merged

saforem2 merged 4 commits into
ezpzfrom
docs/salvage-pr15

Conversation

@saforem2

@saforem2 saforem2 commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Pulls the two pieces of #15 that exist nowhere else before that PR is closed.

  • moe-tp2-wo-placement.md: the TP>1 early-return diagnosis (81ccd98b, 683acaf4), applied at guides/known-bugs/ instead of the reorg's reference/known-bugs/.
  • scripts/check_doc_links.sh: link checker. On current ezpz it reports 51 dangling references (code->docs and docs->docs). Not wired into CI.

No code changes.

Summary by Sourcery

Restore the MoE TP>1 diagnosis and add safeguards for stale documentation references across the ezpz experiment.

New Features:

  • Add a documentation link checker covering Markdown links, code and prose references, path fragments, case sensitivity, and unsafe path construction.

Bug Fixes:

  • Restore and expand the MoE tensor-parallelism diagnosis, narrowing the remaining runtime cause of missing local-map conversion to mesh resolution during parallelization.

Enhancements:

  • Clarify eliminated hypotheses and document the remaining rank-dependent investigation needed for the MoE TP>1 issue.
  • Correct production documentation links and terminology in the SFT and production status pages.

Documentation:

  • Preserve measured TP>1 diagnosis findings, dead hypotheses, reproduction notes, and next investigative steps in the known-bugs guide.

Applies 81ccd98 and 683acaf from docs/reorg-lifecycle to the current
guides/known-bugs/ path. The reorg branch is being closed; this text was
only on it.
Checks docs->docs links, code->docs paths and depth-counted paths.
On current ezpz it reports 51 dangling references. Not wired into any
hook or CI yet.
Copilot AI balanced review requested due to automatic review settings November 11, 2026 20:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@sourcery-ai

sourcery-ai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Add a standalone checker for dangling documentation links, code path references, and fragile depth-based paths.

  • torchtitan/experiments/ezpz/scripts/check_doc_links.sh L1-294

Documentation

Restore the MoE TP>1 diagnosis, document the TP=2 checks and their limits, and identify runtime mesh resolution as the remaining investigation.

  • torchtitan/experiments/ezpz/docs/guides/known-bugs/moe-tp2-wo-placement.md L329-483

Correct the journal links and wording in the production SFT documentation.

  • torchtitan/experiments/ezpz/docs/production/README.md L97-100
  • torchtitan/experiments/ezpz/docs/production/sft/README.md L3, L87

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 7 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="torchtitan/experiments/ezpz/scripts/check_doc_links.sh" line_range="42-47" />
<code_context>
+    for fn in files:
+        if not fn.endswith(".md"): continue
+        p = os.path.join(r, fn)
+        for m in re.finditer(r'\]\(([^)\s]+\.md)(?:#[^)]*)?\)',
+                             open(p, errors="replace").read()):
+            t = m.group(1)
+            if t.startswith(("http://", "https://", "#")): continue
+            if not os.path.exists(os.path.join(r, t)):
+                bad.append("%s -> %s" % (os.path.relpath(p, root), t))
+
+# 1b. markdown OUTSIDE docs/ that links INTO it
</code_context>
<issue_to_address>
**Broken headings pass link checks**

When an internal Markdown link points to an existing file but names a missing fragment, `check_doc_links.sh` checks only the destination file and drops the fragment, so the link passes even though its heading does not exist.

Validate each fragment against the destination headings in both link scans.

Also at `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:63`.
</issue_to_address>

### Comment 2
<location path="torchtitan/experiments/ezpz/scripts/check_doc_links.sh" line_range="42" />
<code_context>
+    for fn in files:
+        if not fn.endswith(".md"): continue
+        p = os.path.join(r, fn)
+        for m in re.finditer(r'\]\(([^)\s]+\.md)(?:#[^)]*)?\)',
+                             open(p, errors="replace").read()):
+            t = m.group(1)
</code_context>
<issue_to_address>
**Titled links pass unchecked**

When a Markdown link in `docs/` uses a title after its `.md` destination, or a link outside `docs/` uses a single-quoted or parenthesized title, `check_doc_links.sh`'s Markdown-link patterns require `)` after the destination or support only double-quoted titles, so those links are not checked and dangling targets pass.

Update both Markdown-link scans to recognize optional double-quoted, single-quoted, and parenthesized titles before validating each destination.

Also at `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:43`, `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:61-62`.
</issue_to_address>

### Comment 3
<location path="torchtitan/experiments/ezpz/scripts/check_doc_links.sh" line_range="37" />
<code_context>
+bad = []
+
+# 1. docs -> docs
+for r, dirs, files in os.walk(docs):
+    dirs[:] = [d for d in dirs if not d.startswith(".")]
+    for fn in files:
</code_context>
<issue_to_address>
**Unreadable trees pass silently**

When a docs or source subdirectory cannot be read during the scan, `os.walk` defaults to ignoring directory traversal errors, so it skips an unreadable subtree and the checker can still print `all internal doc links resolve` without checking its contents. The other scans use the same default and likewise omit inaccessible files.

Pass an `onerror` handler that records the error and makes the checker exit nonzero.

Also at `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:56`, `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:82`, `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:125`, `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:162`, `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:183`.
</issue_to_address>

### Comment 4
<location path="torchtitan/experiments/ezpz/scripts/check_doc_links.sh" line_range="119" />
<code_context>
+# Only flags a path whose FIRST segment names a real (or once-real) docs
+# directory, so an unrelated docs path in an external URL and other coincidental
+# matches stay quiet.
+bare = re.compile(r'docs/([A-Za-z0-9_./-]+)')
+known_tops = set(os.listdir(docs)) | {
+    "production", "evals", "guides", "experiments", "summaries", "scaling",
</code_context>
<issue_to_address>
**External docs URLs fail checks**

When a Markdown, Python, or shell line contains an HTTP(S) URL with a `docs/<known-top>/...` path absent from local docs, `bare.finditer` treats the URL path as a local docs reference, so `os.path.exists` adds a valid external link to `bad` and the checker exits 1.

Exclude HTTP(S) URLs from the bare-path scan before checking local docs paths.

Also at `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:134-137`.
</issue_to_address>

### Comment 5
<location path="torchtitan/experiments/ezpz/scripts/check_doc_links.sh" line_range="47" />
<code_context>
+            t = m.group(1)
+            if t.startswith(("http://", "https://", "#")): continue
+            if not os.path.exists(os.path.join(r, t)):
+                bad.append("%s -> %s" % (os.path.relpath(p, root), t))
+
+# 1b. markdown OUTSIDE docs/ that links INTO it
</code_context>
<issue_to_address>
**Case-mismatched links pass unnoticed**

When the checker runs on a case-insensitive filesystem and a Markdown target differs from the tracked path only by capitalization, on a case-insensitive filesystem, `os.path.exists` accepts a target whose capitalization differs from the tracked path, even though the published URL is case-sensitive. The checker then misses the broken link and reports a clean result.

Validate targets against exact-case repository paths rather than relying on host filesystem path lookup.

Also at `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:68`.
</issue_to_address>

### Comment 6
<location path="torchtitan/experiments/ezpz/docs/guides/known-bugs/moe-tp2-wo-placement.md" line_range="394" />
<code_context>
+.venv/bin/python -c "
+from torchtitan.experiments.ezpz.moe.config_registry import moe_debugmodel
+cfg = moe_debugmodel(); cfg.parallelism.tensor_parallel_degree = 2
+m = cfg.model_spec.model; m.update_from_config(config=cfg)
+sc = m.layers[0].attention.inner_attention.sharding_config
+print(sc.local_map, {k: sorted(a.value for a in v.axes())
</code_context>
<issue_to_address>
**Reproduction snippet fails immediately**

When a reader runs the reproduction snippet as written, `moe_debugmodel()` returns a config whose model is stored in `cfg.model`; it has no `model_spec` attribute. Copying the snippet therefore raises `AttributeError` before the documented checks run.

Use `m = cfg.model` in the snippet.
</issue_to_address>

### Comment 7
<location path="torchtitan/experiments/ezpz/docs/guides/known-bugs/moe-tp2-wo-placement.md" line_range="351-353" />
<code_context>
+agpt  in q_TNH/k_TNH/v_TNH, out, 3x grad   ->  all ['cp', 'dp', 'tp']
+```
+
+`resolve_shared_mesh` therefore receives identical input from both, so
+`resolved_mesh is None` cannot distinguish them either. **All three exits are
+eliminated.**
+
+Also checked and identical: both `parallelize_moe` and `parallelize_llama` take
</code_context>
<issue_to_address>
**Mesh exit ruled out prematurely**

When the q and k/v placement layouts have equal axes but different partition specs, the write-up treats equal axis sets as identical resolver input and rules out `resolved_mesh is None`, even though the q and k/v layouts differ in `partition_spec`; readers are told to eliminate a cause that remains possible.

Compare the complete placement layouts and verify the actual resolver result before ruling out the `resolved_mesh is None` exit.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

check_doc_links.sh: case-sensitive lookup, titled links ('', "", ()),
#fragment checked against GitHub heading slugs, unreadable dirs fail
the run, external URLs skipped in the path scans. Count on current
ezpz goes 51 -> 71; the 20 new ones are broken heading links.

moe-tp2-wo-placement.md: resolved_mesh exit is open, not eliminated
(only axis sets were compared). Snippet uses cfg.model and is marked
as a 2026-08 record; it no longer runs after the October sync.
@saforem2
saforem2 merged commit 731f713 into ezpz Nov 12, 2026
2 checks passed
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