vllm - 💡(How to fix) Fix [Bug]: Gemma 4 31B Structured Outputs weird behaviour / character output - might be a quick solve [10 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vllm-project/vllm#39071Fetched 2026-04-08 02:52:34
View on GitHub
Comments
10
Participants
3
Timeline
19
Reactions
0
Timeline (top)
commented ×10mentioned ×4subscribed ×4labeled ×1

Fix Action

Fix / Workaround

============================== CPU Info

Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 46 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 24 On-line CPU(s) list: 0-23 Vendor ID: GenuineIntel Model name: Intel(R) Core(TM) Ultra 9 285K CPU family: 6 Model: 198 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 24 Stepping: 2 CPU(s) scaling MHz: 31% CPU max MHz: 7200,0000 CPU min MHz: 800,0000 BogoMIPS: 7372,80 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdt_a rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni lam wbnoinvd dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq tme rdpid bus_lock_detect movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr ibt flush_l1d arch_capabilities ibpb_exit_to_user Virtualization: VT-x L1d cache: 768 KiB (20 instances) L1i cache: 1,3 MiB (20 instances) L2 cache: 40 MiB (12 instances) L3 cache: 36 MiB (1 instance) NUMA node(s): 1 NUMA node0 CPU(s): 0-23 Vulnerability Gather data sampling: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected Vulnerability Vmscape: Mitigation; IBPB before exit to userspace

Code Example

==============================
        System Info
==============================
OS                           : Ubuntu 24.04.3 LTS (x86_64)
GCC version                  : (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
Clang version                : Could not collect
CMake version                : Could not collect
Libc version                 : glibc-2.39

==============================
       PyTorch Info
==============================
PyTorch version              : 2.10.0+cu129
Is debug build               : False
CUDA used to build PyTorch   : 12.9
ROCM used to build PyTorch   : N/A

==============================
      Python Environment
==============================
Python version               : 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 16:09:02) [GCC 11.2.0] (64-bit runtime)
Python platform              : Linux-6.8.0-90-generic-x86_64-with-glibc2.39

==============================
       CUDA / GPU Info
==============================
Is CUDA available            : True
CUDA runtime version         : Could not collect
CUDA_MODULE_LOADING set to   : 
GPU models and configuration : GPU 0: NVIDIA RTX PRO 6000 Blackwell Workstation Edition
Nvidia driver version        : 580.126.09
cuDNN version                : Could not collect
HIP runtime version          : N/A
MIOpen runtime version       : N/A
Is XNNPACK available         : True

==============================
          CPU Info
==============================
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        46 bits physical, 48 bits virtual
Byte Order:                           Little Endian
CPU(s):                               24
On-line CPU(s) list:                  0-23
Vendor ID:                            GenuineIntel
Model name:                           Intel(R) Core(TM) Ultra 9 285K
CPU family:                           6
Model:                                198
Thread(s) per core:                   1
Core(s) per socket:                   1
Socket(s):                            24
Stepping:                             2
CPU(s) scaling MHz:                   31%
CPU max MHz:                          7200,0000
CPU min MHz:                          800,0000
BogoMIPS:                             7372,80
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdt_a rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni lam wbnoinvd dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq tme rdpid bus_lock_detect movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr ibt flush_l1d arch_capabilities ibpb_exit_to_user
Virtualization:                       VT-x
L1d cache:                            768 KiB (20 instances)
L1i cache:                            1,3 MiB (20 instances)
L2 cache:                             40 MiB (12 instances)
L3 cache:                             36 MiB (1 instance)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-23
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected
Vulnerability Vmscape:                Mitigation; IBPB before exit to userspace

==============================
Versions of relevant libraries
==============================
[pip3] flashinfer-python==0.6.7
[pip3] numpy==2.2.6
[pip3] nvidia-cublas-cu12==12.9.1.4
[pip3] nvidia-cuda-cupti-cu12==12.9.79
[pip3] nvidia-cuda-nvrtc-cu12==12.9.86
[pip3] nvidia-cuda-runtime-cu12==12.9.79
[pip3] nvidia-cudnn-cu12==9.10.2.21
[pip3] nvidia-cudnn-frontend==1.18.0
[pip3] nvidia-cufft-cu12==11.4.1.4
[pip3] nvidia-cufile-cu12==1.14.1.1
[pip3] nvidia-curand-cu12==10.3.10.19
[pip3] nvidia-cusolver-cu12==11.7.5.82
[pip3] nvidia-cusparse-cu12==12.5.10.65
[pip3] nvidia-cusparselt-cu12==0.7.1
[pip3] nvidia-cutlass-dsl==4.4.2
[pip3] nvidia-cutlass-dsl-libs-base==4.4.2
[pip3] nvidia-ml-py==13.595.45
[pip3] nvidia-nccl-cu12==2.27.5
[pip3] nvidia-nvjitlink-cu12==12.9.86
[pip3] nvidia-nvshmem-cu12==3.4.5
[pip3] nvidia-nvtx-cu12==12.9.79
[pip3] pyzmq==27.1.0
[pip3] torch==2.10.0+cu129
[pip3] torch-c-dlpack-ext==0.1.5
[pip3] torchaudio==2.10.0+cu129
[pip3] torchvision==0.25.0+cu129
[pip3] transformers==5.5.0
[pip3] triton==3.6.0
[conda] numpy                       2.4.4            pypi_0              pypi
[conda] nvidia-cublas               13.1.0.3         pypi_0              pypi
[conda] nvidia-cuda-cupti           13.0.85          pypi_0              pypi
[conda] nvidia-cuda-nvrtc           13.0.88          pypi_0              pypi
[conda] nvidia-cuda-runtime         13.0.96          pypi_0              pypi
[conda] nvidia-cudnn-cu13           9.19.0.56        pypi_0              pypi
[conda] nvidia-cufft                12.0.0.61        pypi_0              pypi
[conda] nvidia-cufile               1.15.1.6         pypi_0              pypi
[conda] nvidia-curand               10.4.0.35        pypi_0              pypi
[conda] nvidia-cusolver             12.0.4.66        pypi_0              pypi
[conda] nvidia-cusparse             12.6.3.3         pypi_0              pypi
[conda] nvidia-cusparselt-cu13      0.8.0            pypi_0              pypi
[conda] nvidia-nccl-cu13            2.28.9           pypi_0              pypi
[conda] nvidia-nvjitlink            13.0.88          pypi_0              pypi
[conda] nvidia-nvshmem-cu13         3.4.5            pypi_0              pypi
[conda] nvidia-nvtx                 13.0.85          pypi_0              pypi
[conda] torch                       2.11.0           pypi_0              pypi
[conda] triton                      3.6.0            pypi_0              pypi

==============================
         vLLM Info
==============================
ROCM Version                 : Could not collect
vLLM Version                 : 0.19.1rc1.dev15+g50cd5674b (git sha: 50cd5674b)
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled
GPU Topology:
        GPU0    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      0-23    0               N/A

Legend:

  X    = Self
  SYS  = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
  NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
  PHB  = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
  PXB  = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
  PIX  = Connection traversing at most a single PCIe bridge
  NV#  = Connection traversing a bonded set of # NVLinks

==============================
     Environment Variables
==============================
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_anonym

---

Given Text: Maybe you would consider adding those to future courses .

Generated aspects for google/gemma-3-27b-it:
[('courses', 'course general', 'neutral')] <- correct.

Position 0 (Selected: '['):
  - '[':  99.98% (logprob:  -0.0002)
  - '[(':   0.02% (logprob:  -8.3752)
  - '[':   0.00% (logprob: -27.9065)
  - '<eos>':   0.00% (logprob:     -inf)
  - '<pad>':   0.00% (logprob:     -inf)

Position 1 (Selected: '(''):
  - '('': 100.00% (logprob:   0.0000)
  - '('.':   0.00% (logprob: -23.2500)
  - '('.',':   0.00% (logprob: -24.2500)
  - '(':   0.00% (logprob: -29.6875)
  - '('.'':   0.00% (logprob: -31.4375)

Position 2 (Selected: 'courses'):
  - 'courses':  99.91% (logprob:  -0.0009)
  - 'future':   0.04% (logprob:  -7.7509)
  - 'NULL':   0.03% (logprob:  -8.2509)
  - 'course':   0.01% (logprob:  -9.0009)
  - 'those':   0.00% (logprob: -10.1259)

...

---

Generated aspects for google/gemma-4-31b:
[('.', 'course general', 'neutral')]

--------------------------------------------------

Top 5 probabilities for each generated token position:

Position 0 (Selected: '[('):
  - '[(':  99.48% (logprob:  -0.0052)
  - '[':   0.50% (logprob:  -5.3020)
  - '[':   0.02% (logprob:  -8.6302)
  - '<eos>':   0.00% (logprob:     -inf)
  - '<pad>':   0.00% (logprob:     -inf)

Position 1 (Selected: ''.'):
  - ''.':  59.25% (logprob:  -0.5234)
  - ''':  40.72% (logprob:  -0.8984)
  - ''.'':   0.02% (logprob:  -8.3202)
  - ''':   0.00% (logprob: -17.5546)
  - '<pad>':   0.00% (logprob:     -inf)

Position 2 (Selected: '','):
  - '',':  99.99% (logprob:  -0.0001)
  - ''':   0.01% (logprob:  -9.8751)
  - ''':   0.00% (logprob: -29.8907)
  - '<eos>':   0.00% (logprob:     -inf)
  - '<pad>':   0.00% (logprob:     -inf)

Position 3 (Selected: ' ''):
  - ' '': 100.00% (logprob:  -0.0000)
  - ' ':   0.00% (logprob: -10.1250)
  - ' ':   0.00% (logprob: -32.8438)
  - '<eos>':   0.00% (logprob:     -inf)
  - '<pad>':   0.00% (logprob:     -inf)

...
RAW_BUFFERClick to expand / collapse

Your current environment

<details> <summary>The output of <code>python collect_env.py</code></summary>
==============================
        System Info
==============================
OS                           : Ubuntu 24.04.3 LTS (x86_64)
GCC version                  : (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
Clang version                : Could not collect
CMake version                : Could not collect
Libc version                 : glibc-2.39

==============================
       PyTorch Info
==============================
PyTorch version              : 2.10.0+cu129
Is debug build               : False
CUDA used to build PyTorch   : 12.9
ROCM used to build PyTorch   : N/A

==============================
      Python Environment
==============================
Python version               : 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 16:09:02) [GCC 11.2.0] (64-bit runtime)
Python platform              : Linux-6.8.0-90-generic-x86_64-with-glibc2.39

==============================
       CUDA / GPU Info
==============================
Is CUDA available            : True
CUDA runtime version         : Could not collect
CUDA_MODULE_LOADING set to   : 
GPU models and configuration : GPU 0: NVIDIA RTX PRO 6000 Blackwell Workstation Edition
Nvidia driver version        : 580.126.09
cuDNN version                : Could not collect
HIP runtime version          : N/A
MIOpen runtime version       : N/A
Is XNNPACK available         : True

==============================
          CPU Info
==============================
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        46 bits physical, 48 bits virtual
Byte Order:                           Little Endian
CPU(s):                               24
On-line CPU(s) list:                  0-23
Vendor ID:                            GenuineIntel
Model name:                           Intel(R) Core(TM) Ultra 9 285K
CPU family:                           6
Model:                                198
Thread(s) per core:                   1
Core(s) per socket:                   1
Socket(s):                            24
Stepping:                             2
CPU(s) scaling MHz:                   31%
CPU max MHz:                          7200,0000
CPU min MHz:                          800,0000
BogoMIPS:                             7372,80
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdt_a rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni lam wbnoinvd dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq tme rdpid bus_lock_detect movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr ibt flush_l1d arch_capabilities ibpb_exit_to_user
Virtualization:                       VT-x
L1d cache:                            768 KiB (20 instances)
L1i cache:                            1,3 MiB (20 instances)
L2 cache:                             40 MiB (12 instances)
L3 cache:                             36 MiB (1 instance)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-23
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected
Vulnerability Vmscape:                Mitigation; IBPB before exit to userspace

==============================
Versions of relevant libraries
==============================
[pip3] flashinfer-python==0.6.7
[pip3] numpy==2.2.6
[pip3] nvidia-cublas-cu12==12.9.1.4
[pip3] nvidia-cuda-cupti-cu12==12.9.79
[pip3] nvidia-cuda-nvrtc-cu12==12.9.86
[pip3] nvidia-cuda-runtime-cu12==12.9.79
[pip3] nvidia-cudnn-cu12==9.10.2.21
[pip3] nvidia-cudnn-frontend==1.18.0
[pip3] nvidia-cufft-cu12==11.4.1.4
[pip3] nvidia-cufile-cu12==1.14.1.1
[pip3] nvidia-curand-cu12==10.3.10.19
[pip3] nvidia-cusolver-cu12==11.7.5.82
[pip3] nvidia-cusparse-cu12==12.5.10.65
[pip3] nvidia-cusparselt-cu12==0.7.1
[pip3] nvidia-cutlass-dsl==4.4.2
[pip3] nvidia-cutlass-dsl-libs-base==4.4.2
[pip3] nvidia-ml-py==13.595.45
[pip3] nvidia-nccl-cu12==2.27.5
[pip3] nvidia-nvjitlink-cu12==12.9.86
[pip3] nvidia-nvshmem-cu12==3.4.5
[pip3] nvidia-nvtx-cu12==12.9.79
[pip3] pyzmq==27.1.0
[pip3] torch==2.10.0+cu129
[pip3] torch-c-dlpack-ext==0.1.5
[pip3] torchaudio==2.10.0+cu129
[pip3] torchvision==0.25.0+cu129
[pip3] transformers==5.5.0
[pip3] triton==3.6.0
[conda] numpy                       2.4.4            pypi_0              pypi
[conda] nvidia-cublas               13.1.0.3         pypi_0              pypi
[conda] nvidia-cuda-cupti           13.0.85          pypi_0              pypi
[conda] nvidia-cuda-nvrtc           13.0.88          pypi_0              pypi
[conda] nvidia-cuda-runtime         13.0.96          pypi_0              pypi
[conda] nvidia-cudnn-cu13           9.19.0.56        pypi_0              pypi
[conda] nvidia-cufft                12.0.0.61        pypi_0              pypi
[conda] nvidia-cufile               1.15.1.6         pypi_0              pypi
[conda] nvidia-curand               10.4.0.35        pypi_0              pypi
[conda] nvidia-cusolver             12.0.4.66        pypi_0              pypi
[conda] nvidia-cusparse             12.6.3.3         pypi_0              pypi
[conda] nvidia-cusparselt-cu13      0.8.0            pypi_0              pypi
[conda] nvidia-nccl-cu13            2.28.9           pypi_0              pypi
[conda] nvidia-nvjitlink            13.0.88          pypi_0              pypi
[conda] nvidia-nvshmem-cu13         3.4.5            pypi_0              pypi
[conda] nvidia-nvtx                 13.0.85          pypi_0              pypi
[conda] torch                       2.11.0           pypi_0              pypi
[conda] triton                      3.6.0            pypi_0              pypi

==============================
         vLLM Info
==============================
ROCM Version                 : Could not collect
vLLM Version                 : 0.19.1rc1.dev15+g50cd5674b (git sha: 50cd5674b)
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled
GPU Topology:
        GPU0    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      0-23    0               N/A

Legend:

  X    = Self
  SYS  = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
  NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
  PHB  = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
  PXB  = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
  PIX  = Connection traversing at most a single PCIe bridge
  NV#  = Connection traversing a bonded set of # NVLinks

==============================
     Environment Variables
==============================
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_anonym
</details>

🐛 Describe the bug

I'm using guided regex since one year now, and it worked fine with Gemma 3 27B, Mistral and other LLMs. I appreciate the work of vLLM!

To be more precise, I'm using it for Aspect-based Sentiment Analysis (ABSA). Given a text, e.g. "The pizza is delicious", ABSA extracts aspect term ("pizza"), category ("food general"), and sentiment ("positive"). However, I noticed weird behavior of Gemma 4 31B now in predicting the aspect term. Although I provide 100 (!) few-shot examples (see prompt here prompt_temp.txt), in most cases, Gemma 4 predicts ".", ",", or ":" as the aspect term which doesn't make any sense.

Notably, I even use guided regex (works fine with Gemma 3 27B) to guide the LLM in predicting a valid list of (aspect term, aspect category, polarity) - tuples (see regex_temp.txt). My regex allows any substring of the given text for the aspect term, although "." is very unrealistic.

Code is here: vllm_guided.py

As an example:

Given Text: Maybe you would consider adding those to future courses .

Generated aspects for google/gemma-3-27b-it:
[('courses', 'course general', 'neutral')] <- correct.

Position 0 (Selected: '['):
  - '[':  99.98% (logprob:  -0.0002)
  - '[(':   0.02% (logprob:  -8.3752)
  - '[':   0.00% (logprob: -27.9065)
  - '<eos>':   0.00% (logprob:     -inf)
  - '<pad>':   0.00% (logprob:     -inf)

Position 1 (Selected: '(''):
  - '('': 100.00% (logprob:   0.0000)
  - '('.':   0.00% (logprob: -23.2500)
  - '('.',':   0.00% (logprob: -24.2500)
  - '(':   0.00% (logprob: -29.6875)
  - '('.'':   0.00% (logprob: -31.4375)

Position 2 (Selected: 'courses'):
  - 'courses':  99.91% (logprob:  -0.0009)
  - 'future':   0.04% (logprob:  -7.7509)
  - 'NULL':   0.03% (logprob:  -8.2509)
  - 'course':   0.01% (logprob:  -9.0009)
  - 'those':   0.00% (logprob: -10.1259)

...

This is the output of Gemma 4 31B:

Generated aspects for google/gemma-4-31b:
[('.', 'course general', 'neutral')]

--------------------------------------------------

Top 5 probabilities for each generated token position:

Position 0 (Selected: '[('):
  - '[(':  99.48% (logprob:  -0.0052)
  - '[':   0.50% (logprob:  -5.3020)
  - '[':   0.02% (logprob:  -8.6302)
  - '<eos>':   0.00% (logprob:     -inf)
  - '<pad>':   0.00% (logprob:     -inf)

Position 1 (Selected: ''.'):
  - ''.':  59.25% (logprob:  -0.5234)
  - ''':  40.72% (logprob:  -0.8984)
  - ''.'':   0.02% (logprob:  -8.3202)
  - ''':   0.00% (logprob: -17.5546)
  - '<pad>':   0.00% (logprob:     -inf)

Position 2 (Selected: '','):
  - '',':  99.99% (logprob:  -0.0001)
  - ''':   0.01% (logprob:  -9.8751)
  - ''':   0.00% (logprob: -29.8907)
  - '<eos>':   0.00% (logprob:     -inf)
  - '<pad>':   0.00% (logprob:     -inf)

Position 3 (Selected: ' ''):
  - ' '': 100.00% (logprob:  -0.0000)
  - ' ':   0.00% (logprob: -10.1250)
  - ' ':   0.00% (logprob: -32.8438)
  - '<eos>':   0.00% (logprob:     -inf)
  - '<pad>':   0.00% (logprob:     -inf)

...

I provide the entire code here: https://gist.github.com/NilsHellwig/12d29f2092513f80013d8d26949ef265

UPDATE: Same Issue for the Gemma-4-31B-it instruct model.

Message me anytime, I will respond quickly. I'm awake between 05:00 AM and 22:00 PM GMT+2 (Germany). I receive a message on my phone.

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

extent analysis

TL;DR

The issue can be mitigated by adjusting the guided regex pattern to exclude punctuation marks as valid aspect terms.

Guidance

  1. Review the guided regex pattern: The current pattern allows any substring of the given text for the aspect term, which includes punctuation marks like ".", ",", and ":".
  2. Exclude punctuation marks: Modify the regex pattern to exclude punctuation marks as valid aspect terms. This can be achieved by adding a condition to match only alphanumeric characters or specific word patterns.
  3. Test with updated regex pattern: Apply the updated regex pattern to the Gemma 4 31B model and verify if the issue is resolved.
  4. Check the model's output: Analyze the output of the Gemma 4 31B model with the updated regex pattern to ensure it predicts valid aspect terms.

Example

The exact code changes depend on the implementation of the guided regex pattern in the vllm_guided.py file. However, the updated regex pattern could be something like r'\b\w+\b' to match only word characters (alphanumeric plus underscore).

Notes

The issue might be specific to the Gemma 4 31B model, and the guided regex pattern may need to be adjusted accordingly. It's essential to test the updated regex pattern with different models and inputs to ensure its effectiveness.

Recommendation

Apply the workaround by adjusting the guided regex pattern to exclude punctuation marks as valid aspect terms. This should mitigate the issue with the Gemma 4 31B model predicting invalid aspect terms.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING