Model reference · open weights
internlm2 is an open-weight language model from internlm. internlm2-chat-20b (BF16) weighs 39.7 GB; the smallest configuration that runs it is L40S 48 GB.
Summary of the internlm/internlm2-chat-7b model card, 2026-10-01. The estimate below is for another build of the family.
What it is
| Released by | internlm |
|---|---|
| Released | 2024-01-10 |
| Parameters | 7.7B |
| VRAM | 39.7 GB for the weights |
What it runs on
| Card | Requests at once | Context max | Memory | |
|---|---|---|---|---|
| 8K each | 32K each | |||
| RTX 3060 12 GB … RTX 5090 32 GB 5 smaller cards | — | — | — | |
| L40S 48 GB | 2 | — | 17K | 44.0 GB |
| A100 80 GB | 23 | 5 | all 32K | 78.2 GB |
| H100 80 GB | 20 | 5 | all 32K | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | 30 | 7 | all 32K | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | 39 | 9 | all 32K | 107 GB |
| H200 141 GB | 58 | 14 | all 32K | 138 GB |
| B200 180 GB | 81 | 20 | all 32K | 176 GB |
| 2× RTX 5090 32 GB tensor parallel | 12 | 3 | all 32K | 31.0 GB a card |
| 2× L40S 48 GB tensor parallel | 28 | 7 | all 32K | 44.0 GB a card |
| 4× RTX 4090 24 GB tensor parallel | 31 | 7 | all 32K | 23.4 GB a card |
| 4× RTX 3090 24 GB tensor parallel | 31 | 7 | all 32K | 23.4 GB a card |
| Requests at once | 8K tokens each | 32K tokens each |
|---|---|---|
| 1 | 42.1 GB | 46.9 GB |
| 5 | 48.5 GB | 72.7 GB |
| 8 | 53.4 GB | 92.0 GB |
| 16 | 66.3 GB | 144 GB |
| 32 | 92.0 GB | 247 GB |
| 64 | 144 GB | 453 GB |
One card, with vLLM's small-card settings.
Builds
| Build | Params | Precision | Weights | Smallest setup |
|---|---|---|---|---|
| internlm2-chat-7b ↗ | 7.7B | BF16 | 15.5 GB | 2× RTX 3060 12 GB |
| internlm2-7b ↗ | — | BF16 | 15.5 GB | 2× RTX 3060 12 GB |
| internlm2-chat-20b (above) ↗ | 19.9B | BF16 | 39.7 GB | L40S 48 GB |
From the model card
💻Github Repo • 🤔Reporting Issues • 📜Technical Report
InternLM2 has open-sourced a 7 billion parameter base model and a chat model tailored for practical scenarios. The model has the following characteristics:
200K Context window: Nearly perfect at finding needles in the haystack with 200K-long context, with leading performance on long-context tasks like LongBench and L-Eval. Try it with LMDeploy for 200K-context inference.
Outstanding comprehensive performance: Significantly better than the last generation in all dimensions, especially in reasoning, math, code, chat experience, instruction following, and creative writing, with leading performance among open-source models in similar sizes. In some evaluations, InternLM2-Chat-20B may match or even surpass ChatGPT (GPT-3.5).
Code interpreter & Data analysis: With code interpreter, InternLM2-Chat-20B obtains compatible performance with GPT-4 on GSM8K and MATH. InternLM2-Chat also provides data analysis capability.
Stronger tool use: Based on better tool utilization-related capabilities in instruction following, tool selection and reflection, InternLM2 can support more kinds of agents and multi-step tool calling for complex tasks. See examples.
We conducted a comprehensive evaluation of InternLM using the open-source evaluation tool OpenCompass. The evaluation covered five dimensions of capabilities: disciplinary competence, language competence, knowledge competence, inference competence, and comprehension competence. Here are some of the evaluation results, and you can visit the OpenCompass leaderboard for more evaluation results.
| Dataset\Models | InternLM2-7B | InternLM2-Chat-7B | InternLM2-20B | InternLM2-Chat-20B | ChatGPT | GPT-4 |
|---|---|---|---|---|---|---|
| MMLU | 65.8 | 63.7 | 67.7 | 66.5 | 69.1 | 83.0 |
| AGIEval | 49.9 | 47.2 | 53.0 | 50.3 | 39.9 | 55.1 |
| BBH | 65.0 | 61.2 | 72.1 | 68.3 | 70.1 | 86.7 |
| GSM8K | 70.8 | 70.7 | 76.1 | 79.6 | 78.2 | 91.4 |
| MATH | 20.2 | 23.0 | 25.5 | 31.9 | 28.0 | 45.8 |
| HumanEval | 43.3 | 59.8 | 48.8 | 67.1 | 73.2 | 74.4 |
| MBPP(Sanitized) | 51.8 | 51.4 | 63.0 | 65.8 | 78.9 | 79.0 |
Limitations: Although we have made efforts to ensure the safety of the model during the training process and to encourage the model to generate text that complies with ethical and legal requirements, the model may still produce unexpected outputs due to its size and probabilistic generation paradigm. For example, the generated responses may contain biases, discrimination, or other harmful content. Please do not propagate such content. We are not responsible for any consequences resulting from the dissemination of harmful information.
To load the InternLM2 7B Chat model using Transformers, use the following code:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("internlm/internlm2-chat-7b", trust_remote_code=True)
# Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and cause OOM Error.
model = AutoModelForCausalLM.from_pretrained("internlm/internlm2-chat-7b", torch_dtype=torch.float16, trust_remote_code=True).cuda()
model = model.eval()
response, history = model.chat(tokenizer, "hello", history=[])
print(response)
# Hello! How can I help you today?
response, history = model.chat(tokenizer, "please provide three suggestions about time management", history=history)
print(response)
The responses can be streamed using stream_chat:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "internlm/internlm2-chat-7b"
model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.float16, trust_remote_code=True).cuda()
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = model.eval()
length = 0
for response, history in model.stream_chat(tokenizer, "Hello", history=[]):
print(response[length:], flush=True, end="")
length = len(response)
LMDeploy is a toolkit for compressing, deploying, and serving LLM, developed by the MMRazor and MMDeploy teams.
pip install lmdeploy
You can run batch inference locally with the following python code:
import lmdeploy
pipe = lmdeploy.pipeline("internlm/internlm2-chat-7b")
response = pipe(["Hi, pls intro yourself", "Shanghai is"])
print(response)
Or you can launch an OpenAI compatible server with the following command:
lmdeploy serve api_server internlm/internlm2-chat-7b --model-name internlm2-chat-7b --server-port 23333
Then you can send a chat request to the server:
curl http://localhost:23333/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "internlm2-chat-7b",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "IntroducQuoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.