Skip to content

First layer residual is inconsistently normalized #243

Description

@lgienapp

For most configurations, the first encoder blocks' pre-norm is skipped due to the embedding layers' post-normalization.

Yet, having this "pseudo-prenorm" in the embedding layer also means that the residual taken in that first block will be normalized.
This is inconsistent with how pre-norm is originally formulated, where the norm is not applied to the residual (https://arxiv.org/pdf/2002.04745, Fig. 1).

Any particular reason why it is implemented differently in ModernBERT?

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