Update README.md
Browse files
README.md
CHANGED
@@ -15,6 +15,160 @@ language:
|
|
15 |
|
16 |
- **Developed by:** HoangHa
|
17 |
- **License:** apache-2.0
|
18 |
-
- **Convert to GGUF from model :** HoangHa/Pensez-v0.1-e5
|
19 |
|
20 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
- **Developed by:** HoangHa
|
17 |
- **License:** apache-2.0
|
18 |
+
- **Convert to GGUF from model :** [HoangHa/Pensez-v0.1-e5](https://huggingface.co/HoangHa/Pensez-v0.1-e5)
|
19 |
|
20 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
21 |
+
|
22 |
+
|
23 |
+
<div align="center">
|
24 |
+
|
25 |
+
# Pensez: Less Data, Better Reasoning – Rethinking French LLM
|
26 |
+
|
27 |
+
[**About**](#about) | [**How to Run Locally**](#run-locally) | [**Models and Datasets**](#models-and-datasets) | [**Benchmarks**](#benchmarks) | [**Training Details**](#training-details)
|
28 |
+
|
29 |
+

|
30 |
+
</div>
|
31 |
+
|
32 |
+
## About
|
33 |
+
|
34 |
+
Pensez is a bilingual (French-English) reasoning model designed to maximize efficiency with significantly reduced training data. The model leverages a curated dataset focusing on daily reasoning tasks and scientific questions to enhance performance.
|
35 |
+
|
36 |
+
Key strategies for improved reasoning:
|
37 |
+
- **Concise reasoning** for simple tasks to prevent overthinking.
|
38 |
+
- **Extended reasoning** for complex domains like mathematics, coding, and science.
|
39 |
+
- **Special tokens (`<think>...</think>`)** to explicitly guide the model’s reasoning process.
|
40 |
+
|
41 |
+
These optimizations result in superior reasoning capabilities while maintaining robust general understanding compared to models like [DeepSeek-R1-Distill-Qwen-7B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B).
|
42 |
+
|
43 |
+
## Models and Datasets
|
44 |
+
|
45 |
+
### Model Versions
|
46 |
+
|
47 |
+
Pensez is built upon [Qwen 2.5 Instruct 7B](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) and trained over five epochs.
|
48 |
+
|
49 |
+
| Model | Backbone | Size | Download Link |
|
50 |
+
|---------------|----------------------------------------|------|---------------|
|
51 |
+
| Pensez-v0.1-e1 | Qwen2.5-7B-Instruct | 7B | [🤗 Pensez-v0.1-e1](https://huggingface.co/HoangHa/Pensez-v0.1-e1) |
|
52 |
+
| Pensez-v0.1-e2 | Qwen2.5-7B-Instruct | 7B | [🤗 Pensez-v0.1-e2](https://huggingface.co/HoangHa/Pensez-v0.1-e2) |
|
53 |
+
| Pensez-v0.1-e3 | Qwen2.5-7B-Instruct | 7B | [🤗 Pensez-v0.1-e3](https://huggingface.co/HoangHa/Pensez-v0.1-e3) |
|
54 |
+
| Pensez-v0.1-e4 | Qwen2.5-7B-Instruct | 7B | [🤗 Pensez-v0.1-e4](https://huggingface.co/HoangHa/Pensez-v0.1-e4) |
|
55 |
+
| Pensez-v0.1-e5 | Qwen2.5-7B-Instruct | 7B | [🤗 Pensez-v0.1-e5](https://huggingface.co/HoangHa/Pensez-v0.1-e5) |
|
56 |
+
|
57 |
+
### Dataset
|
58 |
+
|
59 |
+
Pensez was trained on the hand-curated [Pensez v0.1](https://huggingface.co/datasets/HoangHa/Pensez-v0.1) dataset containing 2,000 samples (1,000 French, 1,000 English).
|
60 |
+
|
61 |
+
| Dataset | Description | Size | Link |
|
62 |
+
|--------------|----------------------|-------|-------|
|
63 |
+
| Pensez v0.1 | SFT Training Dataset | 2K samples | [🤗 Pensez v0.1](https://huggingface.co/datasets/HoangHa/Pensez-v0.1) |
|
64 |
+
|
65 |
+
## Benchmarks
|
66 |
+
|
67 |
+
Pensez was evaluated on French-specific benchmarks, demonstrating strong reasoning ability and improved task-specific performance:
|
68 |
+
|
69 |
+
| Benchmark | Pensez-v0.1-e5 | DeepSeek-R1-Distill-Qwen-7B | Qwen2.5-7B-Instruct |
|
70 |
+
|-----------|---------------|-----------------------------|----------------------|
|
71 |
+
| Math-hard (fr) | 0.3458 | 0.3403 | 0.2253 |
|
72 |
+
| MMLU (fr) | 0.5766 | 0.4961 | 0.6612 |
|
73 |
+
| BoolQA (fr) | 0.9157 | 0.7079 | 0.9382 |
|
74 |
+
| Trivia (en) | 0.4421 | 0.2711 | 0.5316 |
|
75 |
+
| HellaSwag (en) | 0.5050 | 0.3540 | 0.5258 |
|
76 |
+
|
77 |
+
**Key Observations:**
|
78 |
+
- Pensez outperforms Qwen2.5-7B-Instruct in reasoning tasks.
|
79 |
+
- Comparable to DeepSeek-R1-Distill-Qwen-7B in reasoning while maintaining strong understanding.
|
80 |
+
- Reduced degradation in knowledge-based tasks.
|
81 |
+
|
82 |
+
<details>
|
83 |
+
<summary>Click for detailed benchmark results</summary>
|
84 |
+
|
85 |
+
| Tasks | Pensez v0.1 e1 | Pensez v0.1 e2 | Pensez v0.1 e3 | Pensez v0.1 e4 | Pensez v0.1 e5 | Qwen 7B instruct | R1 distil |
|
86 |
+
|------------------------------------------------|---------------|---------------|---------------|---------------|---------------|-----------------|-----------|
|
87 |
+
| leaderboard_math_hard_fr | 0.0918 | 0.2547 | 0.2783 | 0.3035 | 0.3458 | 0.2253 | 0.3403 |
|
88 |
+
| leaderboard_math_algebra_hard_fr | 0.1029 | 0.3914 | 0.3971 | 0.5114 | 0.5000 | 0.4229 | 0.4771 |
|
89 |
+
| leaderboard_math_counting_and_prob_hard_fr | 0.0765 | 0.1378 | 0.1939 | 0.2041 | 0.2398 | 0.1224 | 0.2347 |
|
90 |
+
| leaderboard_math_geometry_hard_fr | 0.0388 | 0.1019 | 0.1408 | 0.1359 | 0.1748 | 0.1019 | 0.2330 |
|
91 |
+
| leaderboard_math_num_theory_hard_fr | 0.1198 | 0.2581 | 0.3502 | 0.3548 | 0.4332 | 0.3180 | 0.3963 |
|
92 |
+
| leaderboard_math_prealgebra_hard_fr | 0.1681 | 0.4425 | 0.4690 | 0.4956 | 0.5841 | 0.3274 | 0.4867 |
|
93 |
+
| leaderboard_math_precalculus_hard_fr | 0.0357 | 0.0714 | 0.1190 | 0.1190 | 0.1429 | 0.0595 | 0.2143 |
|
94 |
+
| leaderboard_mmlu_fr | 0.3806 | 0.3329 | - | - | 0.5766 | 0.6612 | 0.4961 |
|
95 |
+
| french_bench_arc_challenge | 0.5047 | 0.5021 | 0.4919 | 0.4859 | 0.4842 | 0.5518 | 0.3447 |
|
96 |
+
| french_bench_boolqa | 0.9326 | 0.9326 | 0.9326 | 0.9270 | 0.9157 | 0.9382 | 0.7079 |
|
97 |
+
| french_bench_fquadv2 | 0.4325 | 0.4400 | 0.4412 | 0.4375 | 0.4387 | 0.4800 | 0.2988 |
|
98 |
+
| french_bench_hellaswag | 0.4970 | 0.5055 | 0.5092 | 0.5058 | 0.5050 | 0.5258 | 0.3540 |
|
99 |
+
| french_bench_trivia | 0.4763 | 0.4763 | 0.4553 | 0.4395 | 0.4421 | 0.5316 | 0.2711 |
|
100 |
+
|
101 |
+
</details>
|
102 |
+
|
103 |
+
## Run Locally
|
104 |
+
|
105 |
+
You can run Pensez using Hugging Face’s `transformers` library:
|
106 |
+
|
107 |
+
```python
|
108 |
+
import torch
|
109 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
110 |
+
|
111 |
+
model_path = "HoangHa/Pensez-v0.1-e5"
|
112 |
+
|
113 |
+
# Load tokenizer and model
|
114 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
115 |
+
model = AutoModelForCausalLM.from_pretrained(
|
116 |
+
model_path, torch_dtype=torch.float16, device_map="auto"
|
117 |
+
)
|
118 |
+
|
119 |
+
# Example input
|
120 |
+
messages = [{"role": "user", "content": "Bonjour!"}]
|
121 |
+
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors='pt').to("cuda")
|
122 |
+
|
123 |
+
generated_ids = model.generate(input_ids, max_new_tokens=2500, temperature=0.8, repetition_penalty=1.1, do_sample=True, eos_token_id=tokenizer.eos_token_id)
|
124 |
+
response = tokenizer.decode(generated_ids[0], skip_special_tokens=True, clean_up_tokenization_space=True)
|
125 |
+
print(f"Réponse: {response}")
|
126 |
+
```
|
127 |
+
|
128 |
+
## Training Details
|
129 |
+
|
130 |
+
Pensez was trained with:
|
131 |
+
- **Packing Inputs Without Cross-Contamination Attention** ([Reference](https://github.com/MeetKai/functionary/tree/main/functionary/train/packing))
|
132 |
+
- **Liger Kernel** ([Reference](https://github.com/linkedin/Liger-Kernel))
|
133 |
+
- **DeepSpeed 3** ([Reference](https://github.com/deepspeedai/DeepSpeed))
|
134 |
+
- **NEFTune Noise** ([Reference](https://arxiv.org/abs/2310.05914)) for robustness.
|
135 |
+
|
136 |
+
| **Parameter** | **Value** |
|
137 |
+
|--------------|----------|
|
138 |
+
| Epochs | 5 |
|
139 |
+
| Global Batch Size | 200 |
|
140 |
+
| Learning Rate | 1e-5 |
|
141 |
+
| Scheduler | Cosine |
|
142 |
+
| Optimizer | AdamW |
|
143 |
+
| Warmup Ratio | 0.05 |
|
144 |
+
| Weight Decay | 0.01 |
|
145 |
+
| Max Sequence Length | 16,384 |
|
146 |
+
|
147 |
+
More details: [Training Config]() | Loss curves: [Wandb](https://wandb.ai/hahuyhoanghhh41/llamafactory?nw=nwuserhahuyhoanghhh41)
|
148 |
+
|
149 |
+
## Citation
|
150 |
+
|
151 |
+
```bibtex
|
152 |
+
@misc{dao2025alphamazeenhancinglargelanguage,
|
153 |
+
title={Pensez: Less Data, Better Reasoning – Rethinking French LLM},
|
154 |
+
author={Ha Huy Hoang},
|
155 |
+
year={2025},
|
156 |
+
archivePrefix={arXiv},
|
157 |
+
primaryClass={cs.CL},
|
158 |
+
url={},
|
159 |
+
}
|
160 |
+
```
|
161 |
+
|
162 |
+
|
163 |
+
## Acknowledgement
|
164 |
+
|
165 |
+
- [llama-factory](https://github.com/hiyouga/LLaMA-Factory)
|
166 |
+
- [Deepseek R1](https://github.com/deepseek-ai/DeepSeek-R1)
|
167 |
+
- [Qwen 2.5](https://github.com/QwenLM/Qwen2.5)
|
168 |
+
- [NEFTune Noise](https://arxiv.org/abs/2310.05914)
|
169 |
+
- [Packing Inputs Without Cross-Contamination Attention](https://github.com/MeetKai/functionary/tree/main/functionary/train/packing)
|
170 |
+
- [Liger Kernel](https://github.com/linkedin/Liger-Kernel)
|
171 |
+
- [Deepspeed](https://github.com/deepspeedai/DeepSpeed)
|
172 |
+
- [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness)
|
173 |
+
- [Hyperbolic](https://hyperbolic.xyz/)
|
174 |
+
- [Modal](https://modal.com/)
|