A reviewer asked the author to split commit 4a8997dba into its own PR and add a warning to its docstring, then asked a maintainer for their view.
This PR
Still has the commit; the docstring is not updated yet.
Status
Open: waiting on the maintainer's answer. Suggested answer: yes, split it, and add the docstring (staged reply C1).
Three pages on this PR, one question each. This one: should one commit leave the PR.
What the commit does, in short.
During training, the loss needs the
logprobs of each token.
Their backward pass needs a gradient buffer exactly as big as the
logits.
Before, it made a new buffer. The commit writes the gradient into the logits' own memory instead, which the PR estimates saves about 12 GiB on its GB200 run.
The catch: after backward, the logits tensor holds gradient numbers, not logits. Any code that reads it afterwards gets wrong values, and in some cases no error is raised.
The third page draws how this works.
What was asked
The reviewer pointed out that the docstring does not warn that the logits get overwritten, and listed ways a later reader could silently get the gradient instead (reading the logits after backward, or keeping a reference some other way). Then two asks:
1. Update the docstring. 2. Move this change (4a8997dba2) into its own PR to derisk merging this PR, since it carries this risk. The other three changes can stay here.
Then the reviewer tagged the maintainer: "wdyt 4a8997dba?" That is the open question: do you agree with the split?
It is correct today. The review checked every reader of those logits on the one path that turns the flag on (prepare_packed_loss_input). None reads them after the overwrite. A CPU check gave the same gradients with the flag on and off.
But it is the only change that touches the training loss everyone shares. The other three only touch token capture or the critic. If this one causes a memory or accuracy problem, it should be revertible alone.
Nothing in CI runs it. No shipped config turns on the fp32 LM head, and the packing test never sets a chunk size. The 12 GiB is the size of one tensor, not a measurement.
Its own comment is wrong. It says this is the logits' "sole consumer", but a second logprob call reads the same logits. It is safe only because that call always runs with chunking off. Passing use_chunking instead of True puts that rule in the code.
Splitting is cheap. The commit touches two files and one test, so the rest of the PR can merge without waiting for the new tests and numbers.
The reply is staged as C1 in your pending review: it agrees with the reviewer and lists asks 2–4 from the figure for the new PR.
So what. Answer "agree, split it". The memory saving is real and the code looks right, but it changes code every packed run with an fp32 LM head and chunked logprobs would use, and nothing tests it yet. On its own PR it gets a test at real tensor- and context-parallel sizes and a measured memory number, and the rest of #4776 can merge now.