Motivation.
Peagle uses COD sampling, which predicts the next token for every possible starting token in a sample. Then also predicts the token after that for some percent of the tokens (e.g. 70%). And then predicts the 3rd token for 70% of the selected 70%, etc.
So our attention mask shape is: $(\text{sequence len} * 2.73)^2$, where $2.73 = \sum_{n=0}^4{0.7^n}$ and 4 is number of speculative tokens. What we're proposing is using num_anchors as starting points for peagle training because a good chunk of the original sequence length will have loss mask 0. That would give us attention masks of size: $(\text{num anchors} \times 2.73) \times (\text{num anchors} \times 1.73 + \text{sequence len})$ This would be smaller and potentially helps us train with longer sequence length.
Proposed Change.
Add the max_anchors parameter to the P-Eagle config that caps the number of COD chain starting points. When set, generate_cod_sample_indices randomly selects max_anchors positions from the loss_mask=1 indices at depth 0 instead of using all positions. The attention mask construction reuses the existing
select_anchors method to identify these starting points, then builds an asymmetric mask where queries are the COD-sampled tokens $(\text{max anchors} × 2.73)$ and keys/values include the full original sequence plus the deeper COD tokens $(\text{max anchors} × 1.73 + \text{sequence len})$. This shrinks the attention mask from
$(\text{sequence len} × 2.73)^2$ to $(\text{num anchors} \times 2.73) \times (\text{num anchors} \times 1.73 + \text{sequence len})$, enabling training with longer sequence lengths under the same memory budget.
Any Other Things.
No response
Motivation.
Peagle uses COD sampling, which predicts the next token for every possible starting token in a sample. Then also predicts the token after that for some percent of the tokens (e.g. 70%). And then predicts the 3rd token for 70% of the selected 70%, etc.
So our attention mask shape is:$(\text{sequence len} * 2.73)^2$ , where $2.73 = \sum_{n=0}^4{0.7^n}$ and 4 is number of speculative tokens. What we're proposing is using $(\text{num anchors} \times 2.73) \times (\text{num anchors} \times 1.73 + \text{sequence len})$ This would be smaller and potentially helps us train with longer sequence length.
num_anchorsas starting points for peagle training because a good chunk of the original sequence length will have loss mask 0. That would give us attention masks of size:Proposed Change.
Add the
$(\text{max anchors} × 2.73)$ and keys/values include the full original sequence plus the deeper COD tokens $(\text{max anchors} × 1.73 + \text{sequence len})$ . This shrinks the attention mask from
$(\text{sequence len} × 2.73)^2$ to $(\text{num anchors} \times 2.73) \times (\text{num anchors} \times 1.73 + \text{sequence len})$ , enabling training with longer sequence lengths under the same memory budget.
max_anchorsparameter to the P-Eagle config that caps the number of COD chain starting points. When set,generate_cod_sample_indicesrandomly selectsmax_anchorspositions from the loss_mask=1 indices at depth 0 instead of using all positions. The attention mask construction reuses the existingselect_anchorsmethod to identify these starting points, then builds an asymmetric mask where queries are the COD-sampled tokensAny Other Things.
No response