GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: resolve vLLM training gibberish outputs for Gemma 3/4 scanned layers by mesakhcienet · Pull Request #4519 · AI-Hypercomputer/maxtext

Conversation

@mesakhcienet

@mesakhcienet mesakhcienet commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR fixes multiple issues causing gibberish outputs and initialization crashes when using scan_layers=True with Gemma 3 and 4 in vLLM workflows.

Context and Details:

  • Why is this change being made: To enable successful RL training and generation with Gemma 3 and 4 by ensuring KV caches and scanned layer weights are correctly handled in the
    vLLM rollout engine.
  • The problems solved:
    1. vLLM Decoder Gibberish: Fixed missing kv_caches argument in _apply_gemma3_scanned_blocks, which caused loss of attention context.
    2. KV Cache Shape Mismatches: MaxTextVllmRollout ignored rollout_vllm_additional_config, falling back to base configs that conflicted with HuggingFace config head dimensions.
    3. Native NNX Keys & Scalar Bugs: The weight sync preprocessor failed to unstack nested scanned weights because it mismatched on native NNX root keys, and a bug in the scan_length calculation for scalar RNG states caused it to drop all decoder parameters, resulting in random noise generation.
  • Implementation details:
    • Explicitly passed kv_caches and attention_metadata in decoder blocks.
    • Updated the custom preprocessor in MaxTextVllmSampler to use robust string matching for NNX keys, safely ignore scalars when calculating scan_length, and correctly broadcast scalar values during unstacking.

Tests

inference vllm_decode

Run script : here
Run output : log

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mesakhcienet
fix: gemma gibberish characters and scan_layers default to False for …
2ba8b3b
…vllm_decoder
@mesakhcienet
mesakhcienet marked this pull request as ready for review July 17, 2026 11:23
@mesakhcienet
mesakhcienet requested review from A9isha, NuojCheng, RissyRan, SurbhiJainUSC, abhinavclemson, aireenmei, bvandermoon, darisoy, dipannita08, gagika, gobbleturk, hengtaoguo, huytransformer, igorts-git, jiangjy1982, khatwanimohit, parambole, richjames0, shralex, shuningjin, suexu1025, vipannalla and xibinliu as code owners July 17, 2026 11:23
SurbhiJainUSC
SurbhiJainUSC approved these changes Jul 17, 2026
View reviewed changes
hengtaoguo
hengtaoguo approved these changes Jul 20, 2026
View reviewed changes
@SurbhiJainUSC SurbhiJainUSC added the pull ready label Jul 20, 2026
@copybara-service
copybara-service Bot merged commit 5783a8b into main Jul 20, 2026
108 of 113 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@copybara-service
copybara-service Bot deleted the fix/gemma-issues branch July 20, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hengtaoguo hengtaoguo hengtaoguo approved these changes
@SurbhiJainUSC SurbhiJainUSC SurbhiJainUSC approved these changes
@parambole parambole Awaiting requested review from parambole parambole is a code owner
@shuningjin shuningjin Awaiting requested review from shuningjin shuningjin is a code owner
@RissyRan RissyRan Awaiting requested review from RissyRan RissyRan is a code owner
@suexu1025 suexu1025 Awaiting requested review from suexu1025
@jiangjy1982 jiangjy1982 Awaiting requested review from jiangjy1982 jiangjy1982 is a code owner
@gobbleturk gobbleturk Awaiting requested review from gobbleturk gobbleturk is a code owner
@bvandermoon bvandermoon Awaiting requested review from bvandermoon bvandermoon is a code owner
@gagika gagika Awaiting requested review from gagika gagika is a code owner
@shralex shralex Awaiting requested review from shralex shralex is a code owner
@richjames0 richjames0 Awaiting requested review from richjames0
@NuojCheng NuojCheng Awaiting requested review from NuojCheng NuojCheng is a code owner
@xibinliu xibinliu Awaiting requested review from xibinliu xibinliu is a code owner
@huytransformer huytransformer Awaiting requested review from huytransformer
@aireenmei aireenmei Awaiting requested review from aireenmei aireenmei is a code owner
@igorts-git igorts-git Awaiting requested review from igorts-git igorts-git is a code owner
@abhinavclemson abhinavclemson Awaiting requested review from abhinavclemson abhinavclemson is a code owner
@khatwanimohit khatwanimohit Awaiting requested review from khatwanimohit khatwanimohit is a code owner
@vipannalla vipannalla Awaiting requested review from vipannalla vipannalla is a code owner
@A9isha A9isha Awaiting requested review from A9isha A9isha is a code owner
@dipannita08 dipannita08 Awaiting requested review from dipannita08 dipannita08 is a code owner
@darisoy darisoy Awaiting requested review from darisoy darisoy is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

pull ready

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mesakhcienet @hengtaoguo @SurbhiJainUSC
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.