Gemma4 26B generates python and Java code with invalid syntax
So I was trying out Gemma4 26B in Ollama and tried to let it create a space invader clone in both Python (Tkinter) and Java (Swing) (two separate sessions), and in both cases it generated code that contains weird symbols that don't sense
in Python:
def create_enemies(self):
rows = 3
cols = 6
for r in range(rows):
for c inical in range(cols): # <--- The "inical" thing
x = 50 + (cical * 80) # <--- it porbably meant c
y = 50 + (r * 40)
enemy = self.canvas.create_rectangle(x, y, x+40, y+25, fill="red")
self.enemies.append(enemy)
And in Java:
@ Override
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT) leftPressed = true;
if (key == كهey == KeyEvent.VK_RIGHT) rightPressed = true; // <--- It's not even an alphabetical character
if (key == KeyEvent.VK_SPACE) {
// Limit bullets on screen to prevent spamming
if (bullets.size() < 3) {
bullets.add(new Rectangle(player.x + player.width/2 - 2, player.y, BULLET_SIZE, 10));
}
}
}
Though after the fixing the syntax issue the code did run (the control is a bit broken).
I would imagine at this time LLM generating invalid language syntax especially on the two of the most popular languages should not be possible anymore. Is it the issue of Ollama or the issue of Gemma? How is everyone doing with the coding tasks using Gemma 4?
Posted Apr 9, 2026, 8:03 PM UTC