Skip to content

Add Softcapping implementation #397

@gkielian

Description

@gkielian

Consider adding this as a separate option inside the attention block:

https://huggingface.co/blog/gemma2#soft-capping-and-attention-implementations

From the above

Putting it all together, the logits are calculated by: logits ← soft_cap ∗ tanh(logits/soft_cap)

Gemma 2 employs soft capping for the final layer and for every attention layer. The attention logits are capped at 50.0, and the final logits at 30.0.

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