Add Gemma 4 E2B/E4B support (text-only)#18695
Open
Phineas1500 wants to merge 1 commit intopytorch:mainfrom
Open
Add Gemma 4 E2B/E4B support (text-only)#18695Phineas1500 wants to merge 1 commit intopytorch:mainfrom
Phineas1500 wants to merge 1 commit intopytorch:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add native text-only Gemma 4 support for
google/gemma-4-E2Bandgoogle/gemma-4-E4Bin the ExecuTorch LLM export path.Why
Gemma 4 E2B/E4B do not fit the existing Llama/Qwen config-only path. Supporting them required new model/runtime behavior plus a checkpoint conversion path, not just new repo IDs and JSON configs.
What Changed
gemma4_e2bandgemma4_e4bas first-class export targets.examples/models/gemma4package with configs, converter, BUCK target, and README.examples/models/model_factory.pyexir/_serialize/_flatbuffer.pyValidation
Ran:
Result:
Ran 31 tests ... OKAlso validated with real HF checkpoint conversion/export/runtime smoke tests for both
google/gemma-4-E2Bandgoogle/gemma-4-E4B, including broad greedy-decoding parity checks against HF.Prompt benchmark summary:
E4B: exact match on 11/12 prompts, first-token match on 12/12 promptsE2B: exact match on 8/12 prompts, first-token match on 10/12 promptsThe remaining
E2Bdrift was concentrated in open-ended near-tie generations rather than structural export failures.Not Included In This PR