ibm-granite/granite-4.1-8b 🔢📝❓✓ → 📝

⭐ Official ▶️ 41.3K runs 📅 Apr 2026 ⚙️ Cog 0.19.2 🔗 GitHub ⚖️ License
code-generation code-understanding document-summarization question-answering text-embedding text-generation

Performance

4.2sTypical run time
~734sCold start (first call)
41.3KTotal runs

About

Granite-4.1-8B is a 8B parameter long-context instruct model finetuned from Granite-4.1-8B-Base using a combination of open source instruction datasets with permissive license and internally collected synthetic datasets.

Example Output

Prompt:

"What is Pi?"

Output

Pi (π) is a mathematical constant that represents the ratio of a circle's circumference to its diameter. It is an irrational number, meaning it cannot be expressed as a simple fraction and its decimal representation goes on forever without repeating. The value of pi is approximately 3.14159, but it has been calculated to trillions of decimal places for various computational purposes.

Key points about pi:

  1. Irrationality: Pi cannot be exactly expressed as a fraction of two integers. Its decimal expansion is infinite and non-repeating.

  2. Symbol: The symbol π was first used to represent this constant by Welsh mathematician William Jones in 1706, and it was popularized by Swiss mathematician Leonhard Euler.

  3. Approximations: Common approximations include 22/7 and 3.14, though these are not exact. More precise approximations are used in calculations requiring higher accuracy.

  4. Applications: Pi is fundamental in many areas of mathematics, including geometry (for calculating areas and volumes of circles and spheres), trigonometry, and calculus. It also appears in various formulas across physics, engineering, and statistics.

  5. Historical significance: The concept of pi has been studied for thousands of years, with ancient civilizations like the Babylonians and Egyptians having approximations of it. Archimedes of Syracuse is credited with one of the first rigorous calculations of pi.

  6. Computational challenges: Calculating pi to high precision has been a challenge and a benchmark for computational algorithms and supercomputers. As of 2023, pi has been computed to over 100 trillion digits.

Pi's ubiquity in mathematics and science makes it one of the most well-known and studied constants in all of mathematics.

Performance Metrics

4.25s Prediction Time
733.74s Total Time
All Input Parameters
{
  "stop": [],
  "tools": [],
  "top_k": 50,
  "top_p": 0.9,
  "prompt": "What is Pi?",
  "stream": false,
  "messages": [],
  "documents": [],
  "min_tokens": 0,
  "temperature": 0,
  "chat_template_kwargs": {},
  "add_generation_prompt": true
}
Input Parameters
seed Type: integer
Random seed. Leave unspecified to randomize the seed.
stop Type: array
A list of sequences to stop generation at. For example, ["<end>","<stop>"] will stop generation at the first instance of "<end>" or "<stop>".
tools Type: array
Tools for request. Passed to the chat template.
top_k Type: integer
The number of highest probability tokens to consider for generating the output. If > 0, only keep the top k tokens with highest probability (top-k filtering).
top_p Type: number
A probability threshold for generating the output. If < 1.0, only keep the top tokens with cumulative probability >= top_p (nucleus filtering). Nucleus filtering is described in Holtzman et al. (http://arxiv.org/abs/1904.09751).
prompt Type: string
Completion API user prompt.
stream Type: boolean
Request streaming response.
messages Type: array
Chat completion API messages.
documents Type: array
Documents for request. Passed to the chat template.
max_tokens Type: integer
max_tokens is deprecated in favor of the max_completion_tokens field.
min_tokens Type: integerDefault: 0
The minimum number of tokens the model should generate as output.
temperature Type: number
The value used to modulate the next token probabilities.
tool_choice Type: string
Tool choice for request. If the choice is a specific function, this should be specified as a JSON string.
chat_template Type: string
A template to format the prompt with. If not specified, the chat template provided by the model will be used.
system_prompt Type: string
Completion API system prompt. The chat template provides a good default.
response_format Type: object
An object specifying the format that the model must output.
presence_penalty Type: number
Presence penalty
frequency_penalty Type: number
Frequency penalty
repetition_penalty Type: number
Repetition penalty
chat_template_kwargs Type: object
Additional arguments to be passed to the chat template.
add_generation_prompt Type: booleanDefault: true
Add generation prompt. Passed to the chat template. Defaults to True.
max_completion_tokens Type: integer
An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
Output Schema

Output

Type: arrayItems Type: string

Example Execution Logs
INFO 04-22 18:53:44 [predict.py:428] predict() commencing request_id=2
INFO 04-22 18:53:44 [logger.py:63] Received request cmpl-2-0: params: SamplingParams(n=1, presence_penalty=0.0, frequency_penalty=0.0, repetition_penalty=1.0, temperature=0.0, top_p=1.0, top_k=0, min_p=0.0, seed=None, stop=[], stop_token_ids=[], bad_words=[], thinking_token_budget=None, include_stop_str_in_output=False, ignore_eos=False, max_tokens=512, min_tokens=0, logprobs=None, prompt_logprobs=None, skip_special_tokens=True, spaces_between_special_tokens=True, structured_outputs=None, extra_args=None), lora_request: None.
DEBUG 04-22 18:53:48 [predict.py:614] finish_reason=stop response_text=Pi (π) is a mathematical constant that represents the ratio of a circle's circumference to its diameter. It is an irrational number, meaning it cannot be expressed as a simple fraction and its decimal representation goes on forever without repeating. The value of pi is approximately 3.14159, but it has been calculated to trillions of decimal places for various computational purposes.

Key points about pi:

1. **Irrationality**: Pi cannot be exactly expressed as a fraction of two integers. Its decimal expansion is infinite and non-repeating.

2. **Symbol**: The symbol π was first used to represent this constant by Welsh mathematician William Jones in 1706, and it was popularized by Swiss mathematician Leonhard Euler.

3. **Approximations**: Common approximations include 22/7 and 3.14, though these are not exact. More precise approximations are used in calculations requiring higher accuracy.

4. **Applications**: Pi is fundamental in many areas of mathematics, including geometry (for calculating areas and volumes of circles and spheres), trigonometry, and calculus. It also appears in various formulas across physics, engineering, and statistics.

5. **Historical significance**: The concept of pi has been studied for thousands of years, with ancient civilizations like the Babylonians and Egyptians having approximations of it. Archimedes of Syracuse is credited with one of the first rigorous calculations of pi.

6. **Computational challenges**: Calculating pi to high precision has been a challenge and a benchmark for computational algorithms and supercomputers. As of 2023, pi has been computed to over 100 trillion digits.

Pi's ubiquity in mathematics and science makes it one of the most well-known and studied constants in all of mathematics.
INFO 04-22 18:53:48 [predict.py:625] Generation took 4.24s
DEBUG 04-22 18:53:48 [predict.py:628] prompt_tokens=12, completion_tokens=355, total_tokens=367
INFO 04-22 18:53:48 [predict.py:638] predict() complete
Version Details
Version ID
a26487d16449b2481fc268509e6b7a076d9258d8ac45a34f41e5c0fbf6c228b8
Version Created
May 26, 2026
Run on Replicate →