Skip to content

bug: gemma4 infinitely repeating a token randomly... #627

Description

@onzag

Issue description

gemma4 infinitely repeating a token randomly...

Expected Behavior

Not repeating the same token or phrase forever

Actual Behavior

Image

This might be related.

ggml-org/llama.cpp#21726

Thinking is off.

No grammar, in fact the one with grammar seems to be fine.

Tried on many gemma 4 versions, with the same issue.

Steps to reproduce

Tried this one
https://huggingface.co/unsloth/gemma-4-31B-it-GGUF/blob/main/gemma-4-31B-it-UD-Q8_K_XL.gguf

and various of
https://huggingface.co/mradermacher/Gemma-4-31B-StyleTune-GGUF

The bug seems to happen, randomly, so there's no reliable way to generate it.

My Environment

Dependency Version
Operating System Windows
CPU ryzen 5
Node.js version 24.11.1
node-llama-cpp version 3.19.0

npx --yes node-llama-cpp inspect gpu output:

Result of running `npx --yes node-llama-cpp inspect gpu`

OS: Windows 10.0.26200 (x64)
Node: 24.11.1 (x64)

node-llama-cpp: 3.19.0
Prebuilt binaries: b9842

CUDA: available
Vulkan: available

CUDA device: NVIDIA GeForce RTX 3090
CUDA used VRAM: 5.19% (1.25GB/24GB)
CUDA free VRAM: 94.8% (22.75GB/24GB)

Vulkan devices: NVIDIA GeForce RTX 3090, AMD Radeon(TM) Graphics
Vulkan used VRAM: 4.66% (2.64GB/56.58GB)
Vulkan free VRAM: 95.33% (53.94GB/56.58GB)
Vulkan unified memory: 21.97GB (38.82%)

CPU model: AMD Ryzen 7 9800X3D 8-Core Processor
Math cores: 8
Used RAM: 27.35% (16.86GB/61.66GB)
Free RAM: 72.64% (44.8GB/61.66GB)
Wired RAM: 2.07% (1.28GB/61.66GB)
Used swap: 46.96% (33.28GB/70.86GB)
Max swap size: 70.86GB
mmap: supported

Additional Context

I think this is about an underlying llama.cpp bug or something akin.

Relevant Features Used

  • Metal support
  • CUDA support
  • Vulkan support
  • Grammar
  • Function calling

Are you willing to resolve this issue by submitting a Pull Request?

Yes, I have the time, and I know how to start.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrequires triageRequires triaging

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions