File size: 3,083 Bytes
2f6b433
 
 
143cae6
2f6b433
 
 
 
 
 
143cae6
 
 
 
2f6b433
 
 
 
 
143cae6
 
 
 
 
 
 
2f6b433
 
 
 
 
 
 
 
143cae6
2f6b433
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143cae6
2f6b433
 
 
143cae6
2f6b433
 
143cae6
2f6b433
 
143cae6
2f6b433
 
 
143cae6
2f6b433
 
 
143cae6
2f6b433
143cae6
2f6b433
 
 
 
 
143cae6
2f6b433
 
 
143cae6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
license: apache-2.0
datasets:
- huihui-ai/FineQwQ-142k
base_model:
- huihui-ai/Llama-3.2-3B-Instruct-abliterated
tags:
- llama3.2
- abliterated
- uncensored
library_name: transformers
pipeline_tag: text-generation
language:
- en
---
# MicroThinker-3B-Preview

MicroThinker-3B-Preview, a new model fine-tuned from the [huihui-ai/Llama-3.2-3B-Instruct-abliterated](https://huggingface.co/huihui-ai/Llama-3.2-3B-Instruct-abliterated) model, focused on advancing AI reasoning capabilities. 

## Use with ollama

You can use [huihui_ai/microthinker](https://ollama.com/huihui_ai/microthinker) directly
```
ollama run huihui_ai/microthinker:3b
```

## Training Details

This is just a test, but the performance is quite good. 

Now, I'll introduce the test environment.

The model was trained using 1 RTX 4090 GPU(24GB) .

The fine-tuning process used 142k from the FineQwQ-142k dataset, max_length(tokens) 21710, quant_bits 4.

The [SFT (Supervised Fine-Tuning)](https://github.com/modelscope/ms-swift) process is divided into several steps, and no code needs to be written.
1. Create the environment.

```
conda create -yn ms-swift python=3.11
conda activate ms-swift

git clone https://github.com/modelscope/ms-swift.git

cd ms-swift
pip install -e .
cd ..
```


2. Download the model and dataset.

```
huggingface-cli download huihui-ai/Llama-3.2-3B-Instruct-abliterated --local-dir ./huihui-ai/Llama-3.2-3B-Instruct-abliterated
huggingface-cli download --repo-type  dataset huihui-ai/FineQwQ-142k --local-dir ./data/FineQwQ-142k
```


3. Used only the huihui-ai/FineQwQ-142k, Trained for 1 epoch:

```
swift sft --model huihui-ai/Llama-3.2-3B-Instruct-abliterated --model_type llama3_2 --train_type lora --dataset "data/FineQwQ-142k/FineQwQ-142k.jsonl" --num_train_epochs 1 --per_device_train_batch_size 1 --per_device_eval_batch_size 1 --max_length 21710 --quant_bits 4 --bnb_4bit_compute_dtype bfloat16 --bnb_4bit_quant_storage bfloat16 --lora_rank 8 --lora_alpha 32 --gradient_checkpointing true --weight_decay 0.1 --learning_rate 1e-4 --gradient_accumulation_steps 16 --eval_steps 100 --save_steps 100 --logging_steps 20 --system "You are a helpful assistant. You should think step-by-step." --output_dir output/MicroThinker-3B-Preview/lora/sft --model_author "huihui-ai" --model_name "MicroThinker-3B-Preview"
```

4. Save the final fine-tuned model. After you're done, input `exit` to exit.
Replace the directories below with specific ones.

```
swift infer --model huihui-ai/Llama-3.2-3B-Instruct-abliterated --adapters output/Llama-3.2-3B-Instruct-abliterated/lora/sft/v0-20250106-193759/checkpoint-8786 --stream true --merge_lora true 
```


This should create a new model directory: `checkpoint-8786-merged`, Rename the directory to `MicroThinker-3B-Preview`, Copy or move this directory to the `huihui` directory.

5. Perform inference on the final fine-tuned model.

```
swift infer --model huihui/MicroThinker-3B-Preview --stream true --infer_backend pt --max_new_tokens 8192
```

6. Test examples.

```
How many 'r' characters are there in the word "strawberry"?
```