Skip to content

dflash: DFly head projects every block row through the vocab matrix twice #176

Open

Description

@bri-prism

Follow-up from review feedback on #172.

build_dfly_correction_head starts from base = res->t_logits, which the generic head has already projected for every row of the block, and keeps only the anchor column of it. It then projects each corrected row through the same vocabulary-sized matrix again. For a block of N rows that is close to 2N head projections where N would do.

The fix is not local to the hook: res->t_logits is built and expanded into the graph before the hook runs, so the rows cannot be dropped from inside it. Skipping them means not building the full head for a DFly block batch in the first place, which sits in the decoder, while the hook's bail-out paths (non-block batch, block wider than block_size, anchor out of range) still need full logits for every row. So the decoder needs to know, before it builds the head, that the correction head will take over.

Before doing that: profile a DFly draft round and report what fraction of it is the head, so the restructuring is justified by a measurement rather than by the row count. Vocabulary is 151936 here, so the projection is not small, but the drafter is also narrow and the rest of the round may dominate.

No correctness impact; output is unchanged either way.

Activity

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions