Pixtral-Large-Instruct-2411 is a 124B multimodal model built on top of Mistral Large 2, i.e., Mistral-Large-Instruct-2407. Pixtral Large is the second model in our multimodal family and demonstrates frontier-level image understanding. Particularly, the model is able to understand documents, charts and natural images, while maintaining the leading text-only understanding of Mistral Large 2.
128K context window: fits minimum of 30 high-resolution images
System Prompt Handling
We appreciate the feedback received from our community regarding our system prompt handling.
In response, we have implemented stronger support for system prompts.
To achieve optimal results, we recommend always including a system prompt that clearly outlines the bot's purpose, even if it is minimal.
We recommend using Pixtral-Large-Instruct-2411 with the vLLM library
to implement production-ready inference pipelines with Pixtral-Large-Instruct-2411.
1import requests
2import json
3from huggingface_hub import hf_hub_download
4from datetime import datetime, timedelta
56url ="http://<your-server-url>:8000/v1/chat/completions"7headers ={"Content-Type":"application/json","Authorization":"Bearer token"}89model ="mistralai/Pixtral-Large-Instruct-2411"101112defload_system_prompt(repo_id:str, filename:str)->str:13 file_path = hf_hub_download(repo_id=repo_id, filename=filename)14withopen(file_path,"r")asfile:15 system_prompt =file.read()16 today = datetime.today().strftime("%Y-%m-%d")17 yesterday =(datetime.today()- timedelta(days=1)).strftime("%Y-%m-%d")18 model_name = repo_id.split("/")[-1]19return system_prompt.format(name=model_name, today=today, yesterday=yesterday)202122SYSTEM_PROMPT = load_system_prompt(model,"SYSTEM_PROMPT.txt")2324image_url ="https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"2526messages =[27{"role":"system","content": SYSTEM_PROMPT},28{29"role":"user",30"content":[31{32"type":"text",33"text":"Which of the depicted countries has the best food? Which the second and third and fourth? Name the country, its color on the map and one its city that is visible on the map, but is not the capital. Make absolutely sure to only name a city that can be seen on the map.",34},35{"type":"image_url","image_url":{"url": image_url}},36],37},38]3940data ={"model": model,"messages": messages}4142response = requests.post(url, headers=headers, data=json.dumps(data))43print(response.json()["choices"][0]["message"]["content"])44# Determining which country has the "best" food can be subjective and depends on personal preferences. However, based on popular culinary reputations, here are some countries known for their cuisine:4546#1. **Italy** (Brown) - Known for its pasta, pizza, and diverse regional dishes.47# - City: Milan4849#2. **France** (Dark Brown) - Renowned for its fine dining, pastries, and wine.50# - City: Lyon5152#3. **Spain** (Yellow) - Famous for tapas, paella, and a variety of seafood dishes.53# - City: Barcelona5455#4. **Greece** (Yellow) - Known for its Mediterranean cuisine, including moussaka, souvlaki, and fresh seafood.56# - City: Thessaloniki5758#These rankings are based on general culinary reputations and can vary widely depending on individual tastes.
Server (Text-only)
You can also ping the client with a text-only example. The following example
shows how the system prompt can be used to make sure the model always knows
the current date.
py
1import requests
2import json
3from huggingface_hub import hf_hub_download
4from datetime import datetime, timedelta
56url ="http://<your-server-url>:8000/v1/chat/completions"7headers ={"Content-Type":"application/json","Authorization":"Bearer token"}89model ="mistralai/Pixtral-Large-Instruct-2411"101112defload_system_prompt(repo_id:str, filename:str)->str:13 file_path = hf_hub_download(repo_id=repo_id, filename=filename)14withopen(file_path,"r")asfile:15 system_prompt =file.read()16 today = datetime.today().strftime("%Y-%m-%d")17 yesterday =(datetime.today()- timedelta(days=1)).strftime("%Y-%m-%d")18 model_name = repo_id.split("/")[-1]19return system_prompt.format(name=model_name, today=today, yesterday=yesterday)202122SYSTEM_PROMPT = load_system_prompt(model,"SYSTEM_PROMPT.txt")2324image_url ="https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"2526messages =[27{"role":"system","content": SYSTEM_PROMPT},28{29"role":"user",30"content":"Without browsing the web, how many days ago was Mistral founded?"31},32]3334data ={"model": model,"messages": messages}3536response = requests.post(url, headers=headers, data=json.dumps(data))37print(response.json()["choices"][0]["message"]["content"])38# Mistral AI was founded in April 2023. Since the current date is November 18, 2024, we can calculate the number of days between April 2023 and November 18, 2024.3940#First, calculate the days from April 2023 to the end of 2023:41#- April: 27 days (30 - 3)42#- May: 31 days43#- June: 30 days44#- July: 31 days45#- August: 31 days46#- September: 30 days47#- October: 31 days48#- November: 30 days49#- December: 31 days5051#Total days from April 2023 to December 31, 2023: 27 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 = 272 days5253#Next, calculate the days from January 1, 2024, to November 18, 2024:54#- January: 31 days55#- February: 29 days (2024 is a leap year)56#- March: 31 days57#- April: 30 days58#- May: 31 days59#- June: 30 days60#- July: 31 days61#- August: 31 days62#- September: 30 days63#- October: 31 days64#- November: 18 days6566#Total days from January 1, 2024, to November 18, 2024: 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 18 = 323 days6768#Adding the two periods together:69#272 days (from April 2023 to December 2023) + 323 days (from January 2024 to November 18, 2024) = 595 days7071#Therefore, Mistral AI was founded 595 days ago from November 18, 2024.
Offline Example
py
1from vllm import LLM
2from vllm.sampling_params import SamplingParams
3from huggingface_hub import hf_hub_download
4from datetime import datetime, timedelta
56model_name ="mistralai/Pixtral-Large-Instruct-2411"78defload_system_prompt(repo_id:str, filename:str)->str:9 file_path = hf_hub_download(repo_id=repo_id, filename=filename)10withopen(file_path,'r')asfile:11 system_prompt =file.read()12 today = datetime.today().strftime('%Y-%m-%d')13 yesterday =(datetime.today()- timedelta(days=1)).strftime('%Y-%m-%d')14 model_name = repo_id.split("/")[-1]15return system_prompt.format(name=model_name, today=today, yesterday=yesterday)1617SYSTEM_PROMPT = load_system_prompt(model_name,"SYSTEM_PROMPT.txt")1819image_url ="https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"2021messages =[22{"role":"system","content": SYSTEM_PROMPT},23{24"role":"user",25"content":[26{27"type":"text",28"text":"Which of the depicted countries has the best food? Which the second and third and fourth? Name the country, its color on the map and one its city that is visible on the map, but is not the capital. Make absolutely sure to only name a city that can be seen on the map.",29},30{"type":"image_url","image_url":{"url": image_url}},31],32},33]3435sampling_params = SamplingParams(max_tokens=512)3637# note that running this model on GPU requires over 300 GB of GPU RAM38llm = LLM(model=model_name, tokenizer_mode="mistral", tensor_parallel_size=8, limit_mm_per_prompt={"image":4})3940outputs = llm.chat(messages, sampling_params=sampling_params)4142print(outputs[0].outputs[0].text)
The Mistral AI Team
Albert Jiang, Alexandre Sablayrolles, Alexis Tacnet, Alok Kothari, Antoine Roux, Arthur Mensch, Audrey Herblin-Stoop, Augustin Garreau, Austin Birky, Bam4d, Baptiste Bout, Baudouin de Monicault, Blanche Savary, Carole Rambaud, Caroline Feldman, Devendra Singh Chaplot, Diego de las Casas, Diogo Costa, Eleonore Arcelin, Emma Bou Hanna, Etienne Metzger, Gaspard Blanchet, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Harizo Rajaona, Henri Roussez, Hichem Sattouf, Ian Mack, Jean-Malo Delignon, Jessica Chudnovsky, Justus Murke, Kartik Khandelwal, Lawrence Stewart, Louis Martin, Louis Ternon, Lucile Saulnier, Lélio Renard Lavaud, Margaret Jennings, Marie Pellat, Marie Torelli, Marie-Anne Lachaux, Marjorie Janiewicz, Mickaël Seznec, Nicolas Schuhl, Niklas Muhs, Olivier de Garrigues, Patrick von Platen, Paul Jacob, Pauline Buche, Pavan Kumar Reddy, Perry Savas, Pierre Stock, Romain Sauvestre, Sagar Vaze, Sandeep Subramanian, Saurabh Garg, Sophia Yang, Szymon Antoniak, Teven Le Scao, Thibault Schueller, Thibaut Lavril, Thomas Wang, Théophile Gervet, Timothée Lacroix, Valera Nemychnikova, Wendy Shang, William El Sayed, William Marshall