Model reference · open weights

internlm2-sft

Available as managed deployment Licence fee LLMs internlm Text gen 1 variants 3k dl/mo

internlm2-sft is an open-weight language model from internlm. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.

Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.

What it is

Released byinternlm
TypeLanguage models
TaskText gen
Parameters (lead)7.7B
Context32k tokens
Runs withtransformers
Released2024-01-11
Popularity3k downloads / month
LicenceCommercial licence needed

About

What internlm2-sft is

💻Github Repo🤔Reporting Issues📜Technical Report

Introduction

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.

Read the full model card
  • 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.

  • InternLM2-Chat-7B-SFT

    InternLM2-Chat-7B-SFT is the SFT version based on InternLM2-Base, and InternLM2-Chat-7B is further trained from InternLM2-Chat-7B-SFT by Online RLHF. We release the SFT version so that the community can study the influence of RLHF deeply.

    Performance Evaluation

    We conducted a comprehensive evaluation of InternLM2 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\ModelsInternLM2-7BInternLM2-Chat-7BInternLM2-20BInternLM2-Chat-20BChatGPTGPT-4
    MMLU65.863.767.766.569.183.0
    AGIEval49.947.253.050.339.955.1
    BBH65.061.272.168.370.186.7
    GSM8K70.870.776.179.678.291.4
    MATH20.223.025.531.928.045.8
    HumanEval43.359.848.867.173.274.4
    MBPP(Sanitized)51.851.463.065.878.979.0
    • The evaluation results were obtained from OpenCompass (some data marked with *, which means come from the original papers), and evaluation configuration can be found in the configuration files provided by OpenCompass.
    • The evaluation data may have numerical differences due to the version iteration of OpenCompass, so please refer to the latest evaluation results of 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 InternLM 7B Chat model using Transformers, use the following code:

    import torch
    from transformers import AutoTokenizer, AutoModelForCausalLM
    tokenizer = AutoTokenizer.from_pretrained("internlm/internlm2-chat-7b-sft", 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-sft", 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-sft"
    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)
    

    Deployment

    LMDeploy

    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-sft")
    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-sft --model-name internlm2-chat-7b-sft --server-port 23333
    

    Then you can send a chat request to the server:

    curl http://localhost:23333/v1/c

    From the published model card. Full card on the HuggingFace links in the sidebar.

    Using it via the API

    Call it like any OpenAI endpoint

    Once AxForge deploys internlm2-sft for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (internlm2-sft below is illustrative; you get the exact model name on deployment.)

    $ curl -sS https://api.axforge.ai/v1/chat/completions \
      -H "Authorization: Bearer $AXFORGE_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"model":"internlm2-sft","messages":[{"role":"user","content":"Hello"}]}'

    Create an account — your API key is available in the console. 3M free tokens every 30 days with every new account.

    © 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms