---
title: Gemma 4 31B on SIE | Superlinked
description: SIE, an open-source inference engine, serves Gemma 4 31B, an open vision model that reads documents and app screens into the JSON your schema asks for.
canonical_url: https://superlinked.com/models/google-gemma-4-31b-it
last_updated: 2026-11-01
---

# Gemma 4 31B

An open vision model that reads documents and app screens into the JSON your schema asks for.

Model id: `google/gemma-4-31B-it` · Endpoint: `generate` · [Hugging Face](https://huggingface.co/google/gemma-4-31B-it)

Listed under [Chat, structured output and reading images](/models#chat) on [the model index](/models.md).

| Accuracy | Time per request | Serverless price |
|---|---|---|
| – (MMLU-Pro, answers right · not measured) | – (Not timed one request at a time) | $0.45 in · $1.50 out per 1M tokens |

## On the task pages

- [Extract more exact field values than Claude Sonnet 5.5, 88% cheaper](/doc-field-extraction): 94.3% Exact field values · 546 documents; $2.12 Cost per 1,000 documents
- [Read app screenshots 69% cheaper than GPT-6.1 Sol](/screenshot-mining): 94.72% Field agreement · 100 screenshots; $1.88 Cost · per 1,000 screenshots

## Call it

On SIE Serverless:

```python
from pathlib import Path
import base64
import json
from sie_sdk import SIEClient

client = SIEClient(api_key="sk-sie-…")

schema = json.loads("""
{
  "type": "object",
  "properties": {
    "items": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "sn": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "type": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "LED Luminaire",
                      "Power Supply",
                      "Control System",
                      "Mounting Bracket",
                      "LED Driver",
                      "Cable Assembly",
                      "Junction Box",
                      "Sensor Module"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "unit": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "pcs",
                      "set",
                      "unit"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "brand": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "Philips",
                      "Osram",
                      "Schneider Electric",
                      "Siemens",
                      "ABB",
                      "Lutron",
                      "Legrand",
                      "Mean Well"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "quantity": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reference": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "productSpecsJson": {
                "type": "object",
                "properties": {
                  "power": {
                    "type": "object",
                    "properties": {
                      "watts": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "efficiency": {
                        "anyOf": [
                          {
                            "description": "Efficiency in percentage, 0-100",
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "powerFactor": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "inputVoltage": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "100-240v",
                              "100-277v",
                              "220-240v"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "watts",
                      "efficiency",
                      "powerFactor",
                      "inputVoltage"
                    ],
                    "additionalProperties": false
                  },
                  "ratings": {
                    "type": "object",
                    "properties": {
                      "protection": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "ip65",
                              "ip66",
                              "ip67"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "protection"
                    ],
                    "additionalProperties": false
                  },
                  "physical": {
                    "type": "object",
                    "properties": {
                      "weight": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "material": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "aluminum",
                              "steel",
                              "plastic"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "mountingType": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "surface",
                              "recessed",
                              "track"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "weight",
                      "material",
                      "mountingType"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "power",
                  "ratings",
                  "physical"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "sn",
              "type",
              "unit",
              "brand",
              "quantity",
              "reference",
              "productSpecsJson"
            ],
            "additionalProperties": false
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "header": {
      "type": "object",
      "properties": {
        "to": {
          "type": "object",
          "properties": {
            "tel": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "email": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "location": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "attention": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "reference": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "vatNumber": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "companyName": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "tel",
            "email",
            "location",
            "attention",
            "reference",
            "vatNumber",
            "companyName"
          ],
          "additionalProperties": false
        },
        "date": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "from": {
          "type": "object",
          "properties": {
            "tel": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "email": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "location": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "reference": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "vatNumber": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "companyName": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "tel",
            "email",
            "location",
            "reference",
            "vatNumber",
            "companyName"
          ],
          "additionalProperties": false
        },
        "projectName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "to",
        "date",
        "from",
        "projectName"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "items",
    "header"
  ],
  "additionalProperties": false
}
""")
instruction = "Extract data from the document image into the JSON schema. Copy values as they appear on the document. Use null for a field the document does not contain. Return only the JSON.\n\nJSON schema:\n{\n  \"type\": \"object\",\n  \"required\": [\n    \"header\",\n    \"items\"\n  ],\n  \"properties\": {\n    \"items\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"required\": [\n          \"sn\",\n          \"type\",\n          \"brand\",\n          \"reference\",\n          \"productSpecsJson\",\n          \"unit\",\n          \"quantity\"\n        ],\n        \"properties\": {\n          \"sn\": {\n            \"type\": \"number\"\n          },\n          \"type\": {\n            \"enum\": [\n              \"LED Luminaire\",\n              \"Power Supply\",\n              \"Control System\",\n              \"Mounting Bracket\",\n              \"LED Driver\",\n              \"Cable Assembly\",\n              \"Junction Box\",\n              \"Sensor Module\"\n            ],\n            \"type\": \"string\"\n          },\n          \"unit\": {\n            \"enum\": [\n              \"pcs\",\n              \"set\",\n              \"unit\"\n            ],\n            \"type\": \"string\"\n          },\n          \"brand\": {\n            \"enum\": [\n              \"Philips\",\n              \"Osram\",\n              \"Schneider Electric\",\n              \"Siemens\",\n              \"ABB\",\n              \"Lutron\",\n              \"Legrand\",\n              \"Mean Well\"\n            ],\n            \"type\": \"string\"\n          },\n          \"quantity\": {\n            \"type\": \"number\"\n          },\n          \"reference\": {\n            \"type\": \"string\"\n          },\n          \"productSpecsJson\": {\n            \"type\": \"object\",\n            \"required\": [\n              \"power\",\n              \"physical\",\n              \"ratings\"\n            ],\n            \"properties\": {\n              \"power\": {\n                \"type\": \"object\",\n                \"required\": [\n                  \"watts\",\n                  \"inputVoltage\"\n                ],\n                \"properties\": {\n                  \"watts\": {\n                    \"type\": \"number\"\n                  },\n                  \"efficiency\": {\n                    \"type\": \"number\",\n                    \"description\": \"Efficiency in percentage, 0-100\"\n                  },\n                  \"powerFactor\": {\n                    \"type\": \"number\"\n                  },\n                  \"inputVoltage\": {\n                    \"enum\": [\n                      \"100-240v\",\n                      \"100-277v\",\n                      \"220-240v\"\n                    ],\n                    \"type\": \"string\"\n                  }\n                }\n              },\n              \"ratings\": {\n                \"type\": \"object\",\n                \"required\": [\n                  \"protection\"\n                ],\n                \"properties\": {\n                  \"protection\": {\n                    \"enum\": [\n                      \"ip65\",\n                      \"ip66\",\n                      \"ip67\"\n                    ],\n                    \"type\": \"string\"\n                  }\n                }\n              },\n              \"physical\": {\n                \"type\": \"object\",\n                \"required\": [\n                  \"material\",\n                  \"mountingType\"\n                ],\n                \"properties\": {\n                  \"weight\": {\n                    \"type\": \"number\"\n                  },\n                  \"material\": {\n                    \"enum\": [\n                      \"aluminum\",\n                      \"steel\",\n                      \"plastic\"\n                    ],\n                    \"type\": \"string\"\n                  },\n                  \"mountingType\": {\n                    \"enum\": [\n                      \"surface\",\n                      \"recessed\",\n                      \"track\"\n                    ],\n                    \"type\": \"string\"\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    },\n    \"header\": {\n      \"type\": \"object\",\n      \"required\": [\n        \"from\",\n        \"to\",\n        \"date\",\n        \"projectName\"\n      ],\n      \"properties\": {\n        \"to\": {\n          \"type\": \"object\",\n          \"required\": [\n            \"companyName\",\n            \"reference\",\n            \"location\",\n            \"attention\",\n            \"tel\",\n            \"email\",\n            \"vatNumber\"\n          ],\n          \"properties\": {\n            \"tel\": {\n              \"type\": \"string\"\n            },\n            \"email\": {\n              \"type\": \"string\"\n            },\n            \"location\": {\n              \"type\": \"string\"\n            },\n            \"attention\": {\n              \"type\": \"string\"\n            },\n            \"reference\": {\n              \"type\": \"string\"\n            },\n            \"vatNumber\": {\n              \"type\": \"string\"\n            },\n            \"companyName\": {\n              \"type\": \"string\"\n            }\n          }\n        },\n        \"date\": {\n          \"type\": \"string\"\n        },\n        \"from\": {\n          \"type\": \"object\",\n          \"required\": [\n            \"companyName\",\n            \"reference\",\n            \"location\",\n            \"tel\",\n            \"email\",\n            \"vatNumber\"\n          ],\n          \"properties\": {\n            \"tel\": {\n              \"type\": \"string\"\n            },\n            \"email\": {\n              \"type\": \"string\"\n            },\n            \"location\": {\n              \"type\": \"string\"\n            },\n            \"reference\": {\n              \"type\": \"string\"\n            },\n            \"vatNumber\": {\n              \"type\": \"string\"\n            },\n            \"companyName\": {\n              \"type\": \"string\"\n            }\n          }\n        },\n        \"projectName\": {\n          \"type\": \"string\"\n        }\n      }\n    }\n  }\n}"
prompt = instruction
image = base64.b64encode(Path("delivery-note.jpg").read_bytes()).decode("ascii")
messages = [
    {"role": "system", "content": prompt},
    {
        "role": "user",
        "content": [
            {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image}"}},
        ],
    },
]
result = client.chat_completions(
    "google/gemma-4-31B-it:h100-96k-hires-out8k-no-spec",
    messages,
    max_completion_tokens=8192,
    extra_body={"temperature":0,"presence_penalty":0},
    response_format={
        "type": "json_schema",
        "json_schema": {"name": "fields", "strict": True, "schema": schema},
    },
)
choices = result["choices"]
content = choices[0]["message"]["content"] if choices else None
if not isinstance(content, str):
    raise ValueError("The model returned no JSON content.")
print(json.loads(content))
```

## Next to the other language models

| Model | MMLU-Pro, answers right | Time per request | Serverless price | Size |
|---|---|---|---|---|
| [Gemma 4 31B](/models/google-gemma-4-31b-it.md) `google/gemma-4-31B-it` | – | – | $0.45 in · $1.50 out per 1M tokens | 31.3B |
| [Qwen3.8 27B](/models/qwen-qwen3-8-27b-fp8.md) `Qwen/Qwen3.8-27B-FP8` | – | 0.74 s per complete reply | $0.25 in · $2.75 out per 1M tokens | 27.8B |
| [GLM-5.3-Flash](/models/zai-org-glm-5-3-flash.md) `zai-org/GLM-5.3-Flash` | – | – | $0.15 in · $0.50 out per 1M tokens | 321.3B |
| [Qwen3.5 4B](/models/qwen-qwen3-5-4b.md) `Qwen/Qwen3.5-4B` | 59.3% | – | $0.305 in · $1.53 out per 1M tokens | 4.7B |
| [Qwen3 4B Instruct 2507](/models/qwen-qwen3-4b-instruct-2507.md) `Qwen/Qwen3-4B-Instruct-2507` | 53.3% | – | Not on Serverless (run in your cloud) | 4.0B |

– = not measured / not timed / not listed.

[All 10 chat and document models](/models#chat)

## Facts

- Size: 31.3B parameters
- License: Apache-2.0
- Reads: Text (up to 8,192 tokens), image
- Endpoint: generate

## Evaluation

- Accuracy: Run on SIE against the public dataset named in each figure
- Time: SIE timed on a GPU server with the client alongside, one request at a time
- Prices: Serverless list prices
- Sources: [Task page runs and their inputs](https://huggingface.co/datasets/superlinked/sie-task-evidence)
