Skip to content

TP oracle test: read Phi3 head_dim from the config (tiny repo now sets head_dim 8) - #18101

Merged
danielhanchen merged 1 commit into
mainfrom
ci-tp-oracle-phi3-head-dim
Nov 17, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-tp-oracle-phi3-head-dim

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

tests/test_tp_native_oracle.py fails on main in the CPU rest shard (seen on the staging run of #18003, reproduces on main):

test_plan_covers_every_layer[phi3]
    assert parts["qkv_proj"] == (...)
E   assert (32, 16, 16) == (8, 4, 4)
test_fused_qkv_under_a_packed_plan_keeps_the_gqa_layout
E   AssertionError: {'o_proj': (8,), 'qkv_proj': (32, 16, 16)}

Cause

No Unsloth change. trl-internal-testing/tiny-Phi3ForCausalLM-3 has a new revision whose config sets head_dim: 8 next to hidden_size: 8 and 4 heads (the previous revision had no head_dim). The fused qkv_proj weight is now [64, 8], so its parts really are (4 * 8, 2 * 8, 2 * 8) = (32, 16, 16), which is what the TP plan derives. The tests computed the head size as hidden_size // num_attention_heads = 2, which only held for the old config.

The plan is right, and the packed-plan test's logits check still matches the unsharded model with the new shapes, so tensor parallel handles a head_dim that is not hidden_size // heads.

Fix

A _head_dim(text) helper reads the config's head_dim and falls back to hidden_size // num_attention_heads when it is unset, so both repo revisions give the right expectation. Both call sites use it.

Verification

  • main: 2 failed, 46 passed.
  • this branch: 48 passed, 1 skipped.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T07:29:37.221902Z f058307 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: f058307a45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 3f2182c into main Nov 17, 2026
@danielhanchen
danielhanchen deleted the ci-tp-oracle-phi3-head-dim branch November 17, 2026 07:33
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.

1 participant