[![evaluation](https://github.com/InternLM/InternLM/assets/22529082/f80a2a58-5ddf-471a-8da4-32ab65c8fd3b)](https://github.com/internLM/OpenCompass/)
[💻Github Repo](https://github.com/InternLM/InternLM) • [🤔Reporting Issues](https://github.com/InternLM/InternLM/issues/new) • [📜Technical Report](https://arxiv.org/abs/2403.17297)
## Introduction
While maintaining the InternLM2 architecture, various new technical explorations have been conducted, resulting in the next-generation model, InternLM2.5. InternLM2.5 leverages a large amount of synthetic data and continuously uses the InternLM for the iterative process of the model, thanks to the model's capability flywheel. The base model of InternLM2.5 has the following technical characteristics:
- Outstanding reasoning capability: Compared to InternLM2, the reasoning performance of InternLM2.5 has been improved by 20%;
- 1M Context window: Achieving near full accuracy in "finding a needle in a haystack" within a 1M context, and reaching leading levels among models of the same scale on LongBench and L-Eval.
## InternLM2.5-7B
### Performance Evaluation
We have evaluated InternLM2.5 on several important benchmarks using the open-source evaluation tool [OpenCompass](https://github.com/open-compass/opencompass). Some of the evaluation results are shown in the table below. You are welcome to visit the [OpenCompass Leaderboard](https://rank.opencompass.org.cn) for more evaluation results.
| Benchmark | InternLM2.5-7B | InternLM2-7B | LLaMA3-8B | Yi-1.5-9B |
|-----------|----------------|--------------|-----------|-----------|
| MMLU | 71.6 | 65.8 | 66.4 | 71.6 |
| CMMLU | 79.1 | 66.2 | 51.0 | 74.1 |
| BBH | 70.1 | 65.0 | 59.7 | 71.1 |
| MATH | 34.0 | 20.2 | 16.4 | 31.9 |
| GSM8K | 74.8 | 70.8 | 54.3 | 74.5 |
| GPQA | 31.3 | 28.3 | 31.3 | 27.8 |
- The evaluation results were obtained from [OpenCompass](https://github.com/open-compass/opencompass) , and evaluation configuration can be found in the configuration files provided by [OpenCompass](https://github.com/open-compass/opencompass).
- The evaluation data may have numerical differences due to the version iteration of [OpenCompass](https://github.com/open-compass/opencompass), so please refer to the latest evaluation results of [OpenCompass](https://github.com/open-compass/opencompass).
**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.
### Import from Transformers
To load the InternLM2.5-7B model using Transformers, use the following code:
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("internlm/internlm2_5-7b", trust_remote_code=True)
# Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and might cause OOM Error.
model = AutoModelForCausalLM.from_pretrained("internlm/internlm2_5-7b", torch_dtype=torch.float16, trust_remote_code=True).cuda()
model = model.eval()
inputs = tokenizer(["A beautiful flower"], return_tensors="pt")
for k,v in inputs.items():
inputs[k] = v.cuda()
gen_kwargs = {"max_length": 128, "top_p": 0.8, "temperature": 0.8, "do_sample": True, "repetition_penalty": 1.0}
output = model.generate(**inputs, **gen_kwargs)
output = tokenizer.decode(output[0].tolist(), skip_special_tokens=True)
print(output)
# A beautiful flowering shrub with clusters of pinkish white flowers in the summer. The foliage is glossy green with a hint of bronze. A great plant for small gardens or as a pot plant. Can be grown as a hedge or as a single specimen plant.
```
## Open Source License
The code is licensed under Apache-2.0, while model weights are fully open for academic research and also allow **free** commercial usage. To apply for a commercial license, please fill in the [application form (English)](https://wj.qq.com/s2/12727483/5dba/)/[申请表(中文)](https://wj.qq.com/s2/12725412/f7c1/). For other questions or collaborations, please contact