π€ Hugging Face | π€ ModelScope | π₯οΈ GitHub
Ling-Coder-Lite is a MoE LLM provided and open-sourced by InclusionAI, which has 16.8B parameters with 2.75B activated parameters. This model demonstrates state-of-the-art performance on 12 coding benchmarks, while simultaneously offering competitive latency and throughput compared to code LLMs of similar size. In addition to open-sourcing the model itself, we also release a substantial amount of code-related data, including synthetic QA, SFT and DPO datasets.
You can download the following table to see the various parameters for your use case. If you are located in mainland China, we also provide the model on ModelScope.cn to speed up the download process.
Model | #Total Params | #Activated Params | Context Length | Download |
---|---|---|---|---|
Ling-Coder-lite-base | 16.8B | 2.75B | 16K | π€ HuggingFace π€ ModelScope |
Ling-Coder-lite | 16.8B | 2.75B | 16K | π€ HuggingFace π€ ModelScope |
Ling-Coder-lite-GPTQ-Int8 | 16.8B | 2.75B | 16K | π€ HuggingFace π€ ModelScope |
Model | Samples | Download |
---|---|---|
Ling-Coder-SyntheticQA | 24M | π€ HuggingFace π€ ModelScope |
Ling-Coder-SFT | 5M | π€ HuggingFace π€ ModelScope |
Ling-Coder-DPO | 250K | π€ HuggingFace π€ ModelScope |
Detailed evaluation results are reported in our technical report. For detailed evaluation code, please refer to the evaluation method of Ling-Coder-Lite in CodeFuse-Evaluation.
Here is a code snippet to show you how to use the chat model with transformers
:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "inclusionAI/Ling-Coder-lite"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
model_name,
trust_remote_code=True
)
prompt = "Write a quick sort algorithm in python."
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
If you're in mainland China, we strongly recommend you to use our model from π€ ModelScope.
vLLM supports offline batched inference or launching an OpenAI-Compatible API Service for online inference.
Since the Pull Request (PR) has not been submitted to the vLLM community at this stage, please prepare the environment by following the steps below:
git clone -b v0.7.3 https://github.com/vllm-project/vllm.git
cd vllm
git apply Ling-Coder-Lite/inference/vllm/bailing_moe.patch
pip install -e .
from transformers import AutoTokenizer
from vllm import LLM, SamplingParams
tokenizer = AutoTokenizer.from_pretrained("inclusionAI/Ling-Coder-lite")
sampling_params = SamplingParams(temperature=0.7, top_p=0.8, repetition_penalty=1.05, max_tokens=512)
llm = LLM(model="inclusionAI/Ling-Coder-lite", dtype='bfloat16')
prompt = "Give me a short introduction to large language models."
messages = [
{"role": "system", "content": "You are Ling-Coder-Lite, an assistant created by CodeFuse-AI"},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
outputs = llm.generate([text], sampling_params)
vllm serve inclusionAI/Ling-lite \
--tensor-parallel-size 2 \
--pipeline-parrallel-size 1 \
--use-v2-block-manager \
--gpu-memory-utilization 0.90
For detailed guidance, please refer to the vLLM instructions
.
Requirement: vllm==0.6.3.post1
.
Patch ling_gptq.patch
onto vLLM by executing:
patch -p1 < ling_gptq.patch -d $(python -c "from importlib.util import find_spec; print(find_spec('vllm').submodule_search_locations[0])")
from vllm import LLM
from vllm.sampling_params import SamplingParams
from transformers import AutoTokenizer
model_name = "inclusionAI/Ling-Coder-lite-GPTQ-Int8"
model = LLM(model_name, trust_remote_code=True, gpu_memory_utilization=0.80, max_model_len=4096)
tokenizer = AutoTokenizer.from_pretrained(
model_name,
trust_remote_code=True
)
prompt = "Write a quick sort algorithm in python."
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
sample_params = SamplingParams(max_tokens=1024, ignore_eos=False)
outputs = model.generate(text, sampling_params=sample_params, prompt_token_ids=None)
for output in outputs:
generated_text = output.outputs[0].text
print(generated_text)
Note: No extra parameters required by this GPTQ Int8 quantized model for vLLM online serving.
We recommend you to use Llama-Factory to finetune Ling with SFT, DPO, etc.
We use identity
to demonstrate how to finetune our Ling models by replacing name
with Ling
and author
with inclusionAI
.
{
"instruction": "hi",
"input": "",
"output": "Hello! I am Ling-Coder-Lite, an AI assistant developed by CodeFuse-AI. How can I assist you today?"
}
We provide a demo configuration of Llama-Factory
to SFT Ling models as follows:
llamafactory-cli train examples/sft/ling_full_sft.yaml
This code repository is licensed under the MIT License.
If you find our work is useful or helpful, please feel free to cite our paper as below.
@misc{codefuse2025samplemattersleveragingmixtureofexperts,
title={Every Sample Matters: Leveraging Mixture-of-Experts and High-Quality Data for Efficient and Accurate Code LLM},
author={Codefuse and Ling Team},
year={2025},
eprint={2503.17793},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2503.17793},
}