Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- GetSoloTech/Code-Reasoning
|
4 |
+
base_model:
|
5 |
+
- GetSoloTech/Gemma3-Code-Reasoning-4B
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
tags:
|
8 |
+
- coding
|
9 |
+
- reasoning
|
10 |
+
- problem-solving
|
11 |
+
- algorithms
|
12 |
+
- python
|
13 |
+
- c++
|
14 |
+
- code-reasoning
|
15 |
+
- competitive-programming
|
16 |
+
---
|
17 |
+
|
18 |
+
# Gemma3-Code-Reasoning-4B-GGUF
|
19 |
+
|
20 |
+
This repository contains GGUF (GGML Universal Format) quantized versions of the [GetSoloTech/Gemma3-Code-Reasoning-4B](https://huggingface.co/GetSoloTech/Gemma3-Code-Reasoning-4B) model, optimized for local inference with various quantization levels to balance performance and resource usage.
|
21 |
+
|
22 |
+
## π― Model Overview
|
23 |
+
|
24 |
+
This is a **LoRA-finetuned** version of `gemma-3-4b-it` specifically optimized for competitive programming and code reasoning tasks. The model has been trained on the high-quality Code-Reasoning dataset to enhance its capabilities in solving complex programming problems with detailed reasoning.
|
25 |
+
|
26 |
+
## π Key Features
|
27 |
+
|
28 |
+
- **Enhanced Code Reasoning**: Specifically trained on competitive programming problems
|
29 |
+
- **Thinking Capabilities**: Inherits the advanced reasoning capabilities from the base model
|
30 |
+
- **High-Quality Solutions**: Trained on solutions with β₯85% test case pass rates
|
31 |
+
- **Structured Output**: Optimized for generating well-reasoned programming solutions
|
32 |
+
- **Efficient Training**: Uses LoRA adapters for efficient parameter updates
|
33 |
+
- **Multiple Quantization Levels**: Available in various GGUF formats for different hardware capabilities
|
34 |
+
|
35 |
+
## π Available GGUF Models
|
36 |
+
| Model File | Size | Quantization | Use Case |
|
37 |
+
|------------|------|--------------|----------|
|
38 |
+
| `Gemma3-Code-Reasoning-4B.f16.gguf` | 7.77 GB | FP16 | Highest quality, requires more VRAM |
|
39 |
+
| `Gemma3-Code-Reasoning-4B.Q8_0.gguf` | 4.13 GB | Q8_0 | High quality, good balance |
|
40 |
+
| `Gemma3-Code-Reasoning-4B.Q6_K.gguf` | 3.19 GB | Q6_K | Good quality, moderate VRAM usage |
|
41 |
+
| `Gemma3-Code-Reasoning-4B.Q5_K_M.gguf` | 2.83 GB | Q5_K_M | Balanced quality and size |
|
42 |
+
| `Gemma3-Code-Reasoning-4B.Q4_K_M.gguf` | 2.49 GB | Q4_K_M | Good compression, reasonable quality |
|
43 |
+
| `Gemma3-Code-Reasoning-4B.Q3_K_M.gguf` | 2.1 GB | Q3_K_M | Smaller size, moderate quality |
|
44 |
+
| `Gemma3-Code-Reasoning-4B.Q2_K.gguf` | 1.73 GB | Q2_K | Smallest size, basic quality |
|
45 |
+
| `Gemma3-Code-Reasoning-4B.IQ4_XS.gguf` | 2.28 GB | IQ4_XS | Intel optimized, good quality |
|
46 |
+
|
47 |
+
## π§ Usage
|
48 |
+
|
49 |
+
### Using with llama.cpp
|
50 |
+
|
51 |
+
```bash
|
52 |
+
# Download a GGUF model file
|
53 |
+
wget https://huggingface.co/GetSoloTech/Gemma3-Code-Reasoning-4B-GGUF/resolve/main/Gemma3-Code-Reasoning-4B.Q4_K_M.gguf
|
54 |
+
|
55 |
+
# Run inference with llama.cpp
|
56 |
+
./llama.cpp/main -m Gemma3-Code-Reasoning-4B.Q4_K_M.gguf -n 4096 --repeat_penalty 1.1 -p "You are an expert competitive programmer. Solve this problem: [YOUR_PROBLEM_HERE]"
|
57 |
+
```
|
58 |
+
|
59 |
+
### Using with Python (llama-cpp-python)
|
60 |
+
|
61 |
+
```python
|
62 |
+
from llama_cpp import Llama
|
63 |
+
|
64 |
+
# Load the model
|
65 |
+
llm = Llama(
|
66 |
+
model_path="./Gemma3-Code-Reasoning-4B.Q4_K_M.gguf",
|
67 |
+
n_ctx=4096,
|
68 |
+
n_threads=4
|
69 |
+
)
|
70 |
+
|
71 |
+
# Prepare the prompt
|
72 |
+
prompt = """You are an expert competitive programmer. Read the problem and produce a correct, efficient solution. Include reasoning if helpful.
|
73 |
+
|
74 |
+
Problem: [YOUR_PROGRAMMING_PROBLEM_HERE]
|
75 |
+
|
76 |
+
Solution:"""
|
77 |
+
|
78 |
+
# Generate response
|
79 |
+
output = llm(
|
80 |
+
prompt,
|
81 |
+
max_tokens=4096,
|
82 |
+
temperature=1.0,
|
83 |
+
top_p=0.95,
|
84 |
+
top_k=64,
|
85 |
+
repeat_penalty=1.1
|
86 |
+
)
|
87 |
+
|
88 |
+
print(output['choices'][0]['text'])
|
89 |
+
```
|
90 |
+
|
91 |
+
|
92 |
+
## ποΈ Recommended Settings
|
93 |
+
|
94 |
+
- **Temperature**: 1.0
|
95 |
+
- **Top-p**: 0.95
|
96 |
+
- **Top-k**: 64
|
97 |
+
- **Max New Tokens**: 4096 (adjust based on problem complexity)
|
98 |
+
- **Repeat Penalty**: 1.1
|
99 |
+
|
100 |
+
|
101 |
+
## π» Hardware Requirements
|
102 |
+
|
103 |
+
| Quantization | Minimum VRAM | Recommended VRAM | CPU RAM |
|
104 |
+
|--------------|--------------|------------------|---------|
|
105 |
+
| FP16 | 8 GB | 12 GB | 16 GB |
|
106 |
+
| Q8_0 | 5 GB | 8 GB | 12 GB |
|
107 |
+
| Q6_K | 4 GB | 6 GB | 10 GB |
|
108 |
+
| Q5_K_M | 3 GB | 5 GB | 8 GB |
|
109 |
+
| Q4_K_M | 3 GB | 4 GB | 6 GB |
|
110 |
+
| Q3_K_M | 2 GB | 3 GB | 4 GB |
|
111 |
+
| Q2_K | 2 GB | 2 GB | 3 GB |
|
112 |
+
| IQ4_XS | 3 GB | 4 GB | 6 GB |
|
113 |
+
|
114 |
+
## π Performance Expectations
|
115 |
+
|
116 |
+
This finetuned model is expected to show improved performance on:
|
117 |
+
|
118 |
+
- **Competitive Programming Problems**: Better understanding of problem constraints and requirements
|
119 |
+
- **Code Generation**: More accurate and efficient solutions
|
120 |
+
- **Reasoning Quality**: Enhanced step-by-step reasoning for complex problems
|
121 |
+
- **Solution Completeness**: More comprehensive solutions with proper edge case handling
|
122 |
+
|
123 |
+
## π Related Resources
|
124 |
+
|
125 |
+
- **Base Model**: [GetSoloTech/Gemma3-Code-Reasoning-4B](https://huggingface.co/GetSoloTech/Gemma3-Code-Reasoning-4B)
|
126 |
+
- **Training Dataset**: [GetSoloTech/Code-Reasoning](https://huggingface.co/datasets/GetSoloTech/Code-Reasoning)
|
127 |
+
- **Original Gemma Model**: [google/gemma-3-4b-it](https://huggingface.co/google/gemma-3-4b-it)
|
128 |
+
- **llama.cpp**: [GitHub Repository](https://github.com/ggerganov/llama.cpp)
|
129 |
+
- **llama-cpp-python**: [PyPI Package](https://pypi.org/project/llama-cpp-python/)
|
130 |
+
|
131 |
+
## π€ Contributing
|
132 |
+
|
133 |
+
This model was created using the Unsloth framework and the Code-Reasoning dataset. For questions about:
|
134 |
+
|
135 |
+
- The base model: [Gemma3 Huggingface](https://huggingface.co/google/gemma-3-4b-it)
|
136 |
+
- The training dataset: [Code-Reasoning Repository](https://huggingface.co/datasets/GetSoloTech/Code-Reasoning)
|
137 |
+
- The training framework: [Unsloth Documentation](https://github.com/unslothai/unsloth)
|
138 |
+
|
139 |
+
## π Acknowledgments
|
140 |
+
|
141 |
+
- **Gemma Team** for the excellent base model
|
142 |
+
- **Unsloth Team** for the efficient training framework
|
143 |
+
- **NVIDIA Research** for the original OpenCodeReasoning-2 dataset
|
144 |
+
- **llama.cpp community** for the GGUF format and tools
|
145 |
+
|
146 |
+
## π Contact
|
147 |
+
|
148 |
+
For questions about this GGUF converted model, please open an issue in the repository.
|
149 |
+
|
150 |
+
---
|
151 |
+
|
152 |
+
**Note**: This model is specifically optimized for competitive programming and code reasoning tasks. Choose the appropriate quantization level based on your hardware capabilities and quality requirements.
|