0

Granite 4.0-1B text generation with OpenVINO

Run the dense, all-attention Granite 4.0-1B instruction model locally with OpenVINO GenAI. Export and compress its weights with Optimum Intel and NNCF, stream chat responses, summarize a short document, and call an offline temperature-conversion tool.

Example · مثال

Content

Granite 4.0-1B text generation with OpenVINO

Run the dense, all-attention Granite 4.0-1B instruction model locally with OpenVINO GenAI. Export and compress its weights with Optimum Intel and NNCF, stream chat responses, summarize a short document, and call an offline temperature-conversion tool.

The Granite 4.0-1B checkpoint is instruction tuned and licensed under Apache-2.0. Although its class is GraniteMoeHybridForCausalLM, this checkpoint has only attention layers and no experts; it is not granite-4.0-h-1b.

Experimental: the notebook uses unreleased OpenVINO fixes and a pinned Optimum Intel PR. Full-model output quality has not yet been validated.

Notebook contents

The tutorial consists of the following steps:

  1. Install the pinned dependencies and select CPU or an Intel GPU.
  2. Export a pinned source revision to OpenVINO IR with INT8, INT4 or FP16 weights.
  3. Stream a chat response and pass conversation history with OpenVINO GenAI.
  4. Summarize a short document without downloading an additional dataset.
  5. Validate a generated tool call, run a permitted offline temperature conversion, and return the result to the model.
  6. Launch a Gradio chat interface with bounded input and output tokens.

INT8 weight compression is selected by default. NPU is not offered because support for this exact checkpoint has not been established. No OpenVINO-author preconverted IR was found when the notebook was prepared.

Installation Instructions

This is a self-contained example that relies solely on its own code.

We recommend running the notebook in a virtual environment. You only need a Jupyter server to start. For details, please refer to the [Installation Guide](../../README.md).

The install cells pin Optimum Intel to commit c9c3b841cd74728fc14952e7ef0680be416d1833 of PR 2117 for GPU activation scaling, and use OpenVINO/Tokenizers/GenAI >=2026.5.0 packages for the GPU runtime fix and position-ID transformation. Transformers 5.5.0, NNCF 3.4.0 and Gradio 6.32.0 are also pinned.

See the [notebook](./granite-4.0.ipynb) for the complete installation and examples. The tool example never evaluates generated code or calls an external service.

Source and license

Source
Intel OpenVINO Notebooks
Original
openvinotoolkit/openvino_notebooks/notebooks/granite-4.0
License
Apache-2.0