EnCoRe adapters
adapters for multilingual reasoning in DeepSeek-R1
2 min readupdated
A set of LoRA (a small add-on to the base model) adapters for the deepseek-ai/DeepSeek-R1-Distill-Llama-8B model, created as part of research into training models for reasoning in different languages (Amharic, Hindi, Indonesian, Igbo, Malay, Swahili, and Yoruba). The repository features various fine-tuning conditions, ranging from reasoning entirely in English or the native language to strategic code-mixing. The set helps investigate how language switching during chain-of-thought generation affects task-solving accuracy. The repository will be useful for researchers and developers working with multilingual LLMs and logical inference tasks.
Key features
- Support for seven different languages and multiple context-mixing strategies during reasoning.
- Training performed using the LLaMA-Factory framework via supervised fine-tuning.
- Adapters targeted at improving logical inference on the Global MMLU benchmark under various strategies.
- Full compatibility with the peft library for quick loading of the desired language version and conditions.
What you can do
- Apply a specific adapter to test logic tasks in supported languages via a script.
- Compare the response quality of the base LLM and various language-switching strategies on your own data.
- Integrate the adapters into NLP research pipelines to analyze multilingual model behavior.
Example
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_id = "deepseek-ai/DeepSeek-R1-Distill-Llama-8B"
tokenizer = AutoTokenizer.from_pretrained(base_id)
base = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype="auto", device_map="auto")
model = PeftModel.from_pretrained(base, "Blablablab/EnCoRe-adapters-r1-distill-llama-8b", subfolder="langbridge-sw")
messages = [{"role": "user", "content": "..."}]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
print(tokenizer.decode(model.generate(inputs, max_new_tokens=16000, do_sample=True)[0]))
Read more
DetailsBase model: deepseek-ai/DeepSeek-R1-Distill-Llama-8B
LoRA parameters: rank 8, alpha 16, dropout 0, applied to all linear modules without quantization
Inference framework: vLLM
Limitations: native-bridge and synthetic-csw do not have an adapter for Yoruba










Comments