Running the Reasoning model
Here is a code snippet demonstrating the model's usage with the transformers library's generate function:
import re
import requests
import torch
from PIL import Image
from transformers import AutoProcessor, AutoModelForImageTextToText
model_id = "ServiceNow-AI/Apriel-1.6-15b-Thinker"
model = AutoModelForImageTextToText.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
processor = AutoProcessor.from_pretrained(model_id)
chat = [
{
"role": "user",
"content": [
{"type": "text", "text": "What is the capital for France?"},
],
}
]
inputs = processor.apply_chat_template(chat, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt")
inputs = {k: v.to(model.device) if isinstance(v, torch.Tensor) else v for k, v in inputs.items()}
inputs.pop("token_type_ids", None)
with torch.no_grad():
output_ids = model.generate(**inputs, max_new_tokens=1024, do_sample=True, temperature=0.6)
generated_ids = output_ids[:, inputs['input_ids'].shape[1]:]
output = processor.decode(generated_ids[0], skip_special_tokens=True)
response = re.findall(r"\[BEGIN FINAL RESPONSE\](.*?)(?:<\|end\|>)", output, re.DOTALL)[0].strip()
print("Text-only Response:", response)
url = "https://picsum.photos/id/237/200/300"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
chat = [
{
"role": "user",
"content": [
{"type": "text", "text": "Which animal is this?"},
{"type": "image"},
],
}
]
prompt = processor.apply_chat_template(chat, add_generation_prompt=True, tokenize=False)
inputs = processor(text=prompt, images=[image], return_tensors="pt").to(model.device)
with torch.no_grad():
output_ids = model.generate(**inputs, max_new_tokens=1024, do_sample=True, temperature=0.6)
generated_ids = output_ids[:, inputs['input_ids'].shape[1]:]
output = processor.decode(generated_ids[0], skip_special_tokens=True)
response = re.findall(r"\[BEGIN FINAL RESPONSE\](.*?)(?:<\|end\|>)", output, re.DOTALL)[0].strip()
print("Image Response:", response)
Usage Guidelines
- Use the model’s default chat template, which already includes a system prompt.
- We recommend setting temperature to
0.6.
- We ensure the model starts with
Here are my reasoning steps:\n during all our evaluations. This is implemented in the default chat template.
- For multi-turn conversations, intermediate turns (historical model outputs) are expected to contain only the final response, without reasoning steps.
Chat Template
<|begin_system|>
You are a thoughtful, systematic AI assistant from ServiceNow Language Models (SLAM) lab. Analyze each question carefully, present your reasoning step-by-step, then provide the final response after the marker [BEGIN FINAL RESPONSE].
<|begin_user|>
# user message here
<|begin_assistant|>
Here are my reasoning steps:
# thoughts here
[BEGIN FINAL RESPONSE]
# assistant response here
<|end|>
The model will first generate its thinking process and then generate its final response, starting with [BEGIN FINAL RESPONSE]. Here is a code snippet demonstrating the application of the chat template:
from transformers import AutoTokenizer
model_name = "ServiceNow-AI/Apriel-1.6-15b-Thinker"
tokenizer = AutoTokenizer.from_pretrained(model_name)
custom_system_prompt = "Answer like a pirate."
prompt = "You are an expert assistant in the implementation of customer experience management aspect of retail applications \n \nYou will be using Python as the programming language. \n \nYou will utilize a factory design pattern for the implementation and following the dependency inversion principle \n \nYou will modify the implementation based on user requirements. \n \nUpon user request, you will add, update, and remove the features & enhancements in the implementation provided by you. \n \nYou will ask whether the user wants to refactor the provided code or needs a sample implementation for reference. Upon user confirmation, I will proceed accordingly. \n \n**Guidelines:** \n 1. **User Requirements:** \n - You have to ask users about their requirements, clarify the user expectations, and suggest the best possible solution by providing examples of Python code snippets. \n - Ask users about which type of reports they need to assess the AI model's performance, accuracy, and reliability. \n - After providing the solution, you have to ask the user about the trial of the solution and modify the solution based on the user feedback. \n \n 2. **Libraries/Frameworks:** \n - You will be utilizing Python as a programming language. \n - You will be using Flask framework for REST APIS implementation \n \n 3. **Communication Gesture:** \n - Your conversation with the user should be interactive, supportive, courageous, and professional. \n - You have to break down the complex concepts into sub-concepts and try to explain them to the user. \n - You have to ask the user for the required parameters. If the user refuses to provide in 2 attempts, politely exit the conversation. \n - You have to provide your supported parameters to the user, if the user refuses to accept them then you have to put an apology note and exit the conversation. \n - You have to track the conversation about unasked questions by the user. If some/one of the questions remain then you have to remind the user about these questions and proceed to answer them based on the user's confirmation \n \n 4. **Implementation:** \n - Your code/implementations should be reliable, scaleable, modular, and reusable. \n - You will be providing unit tests for the implementation upon user request. \n - You will be following MVC architecture for the applications \n - Your implementations must be well-commented and readable \n \n \n- Today's date is 23rd August 2024. \n- The default sender email is sender-assistant@email.com.\nHi, I am conducting research on retail customer feedback systems and I need assistance with designing and implementing them. Could you kindly provide me with a list of general customer feedback system modules?"
messages = [
{"role": "user", "content": custom_system_prompt + "\n\n" + prompt}
]
tools = [{"type": "function", "function": {"name": "getRetailFeedbackModules", "description": "Returns the list of modules usually present in the retail industry", "parameters": {"type": "object", "properties": {"page": {"type": "integer", "description": "The current page number.", "default": 1}, "page_size": {"type": "integer", "description": "The number of items per page.", "default": 3}}}}}, {"type": "function", "function": {"name": "verifyImplementation", "description": "Returns the list of modules usually present in the retail industry", "parameters": {"type": "object", "properties": {"coding_language": {"type": "string", "description": "The supported languages for verification of implementation.", "default": "python", "enum": ["python", "java", "php"]}, "code": {"type": "string", "description": "The code which needs verification"}, "design_pattern": {"type": "string", "description": "The design pattern to verify in the implementation", "enum": ["factory", "strategy", "singleton"]}, "verify_best_practices": {"type": "boolean", "description": "The verification of the coding style based on the language selected", "default": true}}}}}]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
tools=tools
)
model_inputs = tokenizer([text], return_tensors="pt")
Running with vLLM
As the upstream PR is not yet merged, you can use this custom image as an alternate way to run the model with tool and reasoning parsers enabled.
Docker Image
docker.io/amant555/vllm_apriel:latest
Start Command
python3 -m vllm.entrypoints.openai.api_server \
--model ServiceNow-AI/Apriel-1.6-15b-Thinker \
--served-model-name Apriel-1p6-15B-Thinker \
--trust_remote_code \
--max-model-len 131072 \
--enable-auto-tool-choice \
--tool-call-parser apriel \
--reasoning-parser apriel
Additional Inference Options
Apriel-1.6-15b-Thinker is available on Together AI for hosted inference and on Ollama for local use.
Training Details
Training stack: Fast-LLM, VERL
Continual Pre-training: Billions of tokens covering math, code, science, logical reasoning, and multimodal image-text data
SFT: 2.4M samples spanning math, code, instruction-following, function calling, and conversation, followed by an incremental lightweight multimodal SFT.
RL: Multi-stage RL with verifiable rewards and GSPO on text and vision tasks. Our RL stage optimizes reasoning efficiency: using fewer tokens by discouraging unnecessary intermediate steps, stopping earlier when confident, and giving direct answers on simple queries.
For more details on our training methodology, see our blog post.
Limitations
- Factual accuracy: May produce incorrect, misleading, or outdated content. Outputs should be verified before use in critical contexts.
- Bias: May reflect societal, cultural, or systemic biases present in training data.
- Ethics: Do not use the model to produce harmful, unlawful, or unethical content.
- Language: Strongest performance is in English. Output quality may degrade in underrepresented languages.
- Critical use: Not suitable for medical, legal, financial, or other high-risk applications without safeguards.
Security and Responsible Use
Security Responsibilities:
Deployers and users are strongly encouraged to align their security practices with established frameworks and regulatory guidelines such as the EU AI Act and the NIST AI Risk Management Framework (RMF).
- Regularly conduct robustness assessments to identify and mitigate adversarial inputs.
- Implement validation and filtering processes to prevent harmful or biased outputs.
- Continuously perform data privacy checks to guard against unintended data leaks.
- Document and communicate the model's limitations, intended usage, and known security risks to all end-users.
- Schedule periodic security reviews and updates to address emerging threats and vulnerabilities.
- Follow established security policies and usage guidelines provided by deployers.
- Protect and manage sensitive information when interacting with the model.
- Report anomalies, suspicious behavior, or unsafe outputs to deployers or developers.
- Maintain human oversight and apply judgment to mitigate potential security or ethical risks during interactions.
Disclaimer:
Users accept responsibility for securely deploying, managing, and using this open-source LLM. The model is provided "as-is," without explicit or implied warranty regarding security or fitness for any specific application or environment.
License
MIT
Citation
@misc{radhakrishna2025apriel1515bthinker,
title={Apriel-1.5-15b-Thinker},
author={Shruthan Radhakrishna and Aman Tiwari and Aanjaneya Shukla and Masoud Hashemi and Rishabh Maheshwary and Shiva Krishna Reddy Malay and Jash Mehta and Pulkit Pattnaik and Saloni Mittal and Khalil Slimi and Kelechi Ogueji and Akintunde Oladipo and Soham Parikh and Oluwanifemi Bamgbose and Toby Liang and Ahmed Masry and Khyati Mahajan and Sai Rajeswar Mudumba and Vikas Yadav and Sathwik Tejaswi Madhusudhan and Torsten Scholak and Sagar Davasam and Srinivas Sunkara and Nicholas Chapados},
year={2025},
eprint={2510.01141},
archivePrefix={arXiv},
primaryClass={cs.AI},
url={https://arxiv.org/abs/2510.01141},
}