---
title: DeepSeek-R1-Distill-Llama-3B-4bit-v0
canonical_url: "https://www.modelscope.cn/models/suayptalha/DeepSeek-R1-Distill-Llama-3B-4bit-v0"
md_url: "https://www.modelscope.cn/models/suayptalha/DeepSeek-R1-Distill-Llama-3B-4bit-v0.md"
repository: suayptalha/DeepSeek-R1-Distill-Llama-3B-4bit-v0
last_updated: 2025-05-16
license: mit
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - llama
architectures:
  - LlamaForCausalLM
base_model:
  - meta-llama/Llama-3.2-3B-Instruct
base_model_relation: quantized
parameters: 1.8B
tensor_type:
  - F16
  - F32
  - U8
library_name:
  - pytorch
  - transformer
  - safetensors
frameworks:
  - pytorch
language:
  - en
inference_backends:
  - "deploy_task text/emb"
  - "lmdeploy 0.9.1"
  - "lmdeploy_turbomind 0.9.1"
  - "sglang 0.5.2"
  - "vllm 0.9.2"
downloads: 391
stars: 0
tags:
  - reasoning
  - r1
  - axolotl
---

# DeepSeek-R1-Distill-Llama-3B-4bit-v0

> DeepSeek-R1-Distill-Llama-3B-4bit-v0 - suayptalha 在 ModelScope 开源的模型。DeepSeek-R1-Distill-Llama-3B

suayptalha/DeepSeek-R1-Distill-Llama-3B-4bit-v0 是 ModelScope 魔搭社区上的 1.8B 参数text-generation模型，采用 mit 许可，基于 meta-llama/Llama-3.2-3B-Instruct 构建，可用 deploy_task text/emb、lmdeploy 0.9.1、lmdeploy_turbomind 0.9.1 部署。

- **Repository**: suayptalha/DeepSeek-R1-Distill-Llama-3B-4bit-v0
- **License**: mit
- **Tasks**: text-generation
- **Parameters**: 1.8B
- **Base model**: meta-llama/Llama-3.2-3B-Instruct
- **Inference backends**: deploy_task text/emb, lmdeploy 0.9.1, lmdeploy_turbomind 0.9.1, sglang 0.5.2, vllm 0.9.2
- **Tags**: reasoning, r1, axolotl
- **Downloads**: 391
- **Stars**: 0
- **Last updated**: 2025-05-16

Source: https://www.modelscope.cn/models/suayptalha/DeepSeek-R1-Distill-Llama-3B-4bit-v0

---

# DeepSeek-R1-Distill-Llama-3B

This model is the distilled version of DeepSeek-R1 on Llama-3.2-3B with R1-Distill-SFT dataset.
This model is 4bit quantized! You should import it f16 if you want to use full model.

Example usage:
```py
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "suayptalha/DeepSeek-R1-Distill-Llama-3B-4bit",
    load_in_4bit = True,
    device_map="auto"
)

tokenizer = AutoTokenizer.from_pretrained("suayptalha/DeepSeek-R1-Distill-Llama-3B-4bit")

SYSTEM_PROMPT = """Respond in the following format:
<reasoning>
You should reason between these tags.
</reasoning>

Answer goes here...

Always use <reasoning> </reasoning> tags even if they are not necessary.
"""

messages = [
    {"role": "system", "content": SYSTEM_PROMPT},
    {"role": "user", "content": "Continue the fibonnaci sequence: 1, 1, 2, 3, 5, 8,"},
]
inputs = tokenizer.apply_chat_template(
    messages,
    tokenize = True,
    add_generation_prompt = True,
    return_tensors = "pt",
).to("cuda")
output = model.generate(input_ids=inputs, max_new_tokens=256, use_cache=True, temperature=0.7)
decoded_output = tokenizer.decode(output[0], skip_special_tokens=False)
print(decoded_output)
```

Output:
```
<reasoning>
To continue the Fibonacci sequence, we need to recall the pattern of adding the previous two numbers to get the next number.
</reasoning>

The next numbers in the sequence would be: 13, 21, 34, 55, 89, 144
```


Suggested system prompt:
```
Respond in the following format:
<reasoning>
You should reason between these tags.
</reasoning>

Answer goes here...

Always use <reasoning> </reasoning> tags even if they are not necessary.
```

## Parameters
- lr: 2e-5
- epochs: 1
- optimizer: paged_adamw_8bit

## Support

<a href="https://www.buymeacoffee.com/suayptalha" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
