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
|
| 4 |
+
|
| 5 |
+
### A fine-tuned coding model built on Qwen for elite problem-solving
|
| 6 |
+
|
| 7 |
+
[](https://opensource.org/licenses/MIT)
|
| 8 |
+
[](https://huggingface.co/ramdev12345/amara-o1)
|
| 9 |
+
|
| 10 |
+
[Demo](#usage) | [Training](#training) | [Benchmarks](#performance) | [Limitations](#limitations)
|
| 11 |
+
|
| 12 |
+
</div>
|
| 13 |
+
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
## Model Details
|
| 17 |
+
|
| 18 |
+
**amara-o1** is a specialized coding assistant fine-tuned from Qwen2.5-Coder, optimized for:
|
| 19 |
+
- 🧮 Complex algorithmic problem solving
|
| 20 |
+
- 🔐 Secure code generation and vulnerability detection
|
| 21 |
+
- 📊 Mathematical reasoning and computation
|
| 22 |
+
- 💡 Multi-step reasoning for challenging tasks
|
| 23 |
+
|
| 24 |
+
| Attribute | Details |
|
| 25 |
+
|-----------|---------|
|
| 26 |
+
| **Base Model** | Qwen/Qwen2.5-Coder-7B-Instruct |
|
| 27 |
+
| **Parameters** | 7B |
|
| 28 |
+
| **Training Method** | QLoRA (4-bit quantization) |
|
| 29 |
+
| **LoRA Rank** | 64 |
|
| 30 |
+
| **Context Length** | 32,768 tokens |
|
| 31 |
+
| **License** | MIT |
|
| 32 |
+
| **Languages** | Python, JavaScript, C++, Java, and 90+ more |
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## What Makes amara-o1 Different?
|
| 37 |
+
|
| 38 |
+
amara-o1 has been fine-tuned on a carefully curated dataset combining:
|
| 39 |
+
|
| 40 |
+
1. **🏆 Competitive Programming** - 5,000+ problems from Code Contests
|
| 41 |
+
2. **🧮 Advanced Mathematics** - MATH-500 dataset for quantitative reasoning
|
| 42 |
+
3. **🔐 Security-First Coding** - Vulnerability detection and secure programming patterns
|
| 43 |
+
4. **💭 Deep Reasoning** - Anthropic's interview transcripts for complex problem decomposition
|
| 44 |
+
|
| 45 |
+
This multi-domain training enables amara-o1 to:
|
| 46 |
+
- Generate production-ready, secure code
|
| 47 |
+
- Solve competitive programming challenges
|
| 48 |
+
- Handle complex mathematical computations
|
| 49 |
+
- Break down ambiguous problems systematically
|
| 50 |
+
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
## Usage
|
| 54 |
+
|
| 55 |
+
### Quick Start
|
| 56 |
+
|
| 57 |
+
```python
|
| 58 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 59 |
+
import torch
|
| 60 |
+
|
| 61 |
+
# Load model and tokenizer
|
| 62 |
+
model_name = "ramdev12345/amara-o1"
|
| 63 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 64 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 65 |
+
model_name,
|
| 66 |
+
torch_dtype=torch.bfloat16,
|
| 67 |
+
device_map="auto"
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
# Generate code
|
| 71 |
+
prompt = """<|im_start|>user
|
| 72 |
+
Write a Python function to find the longest palindromic substring in a string using dynamic programming.<|im_end|>
|
| 73 |
+
<|im_start|>assistant"""
|
| 74 |
+
|
| 75 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 76 |
+
outputs = model.generate(
|
| 77 |
+
**inputs,
|
| 78 |
+
max_new_tokens=512,
|
| 79 |
+
temperature=0.7,
|
| 80 |
+
top_p=0.9,
|
| 81 |
+
do_sample=True
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 85 |
+
print(response)
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
### With vLLM (Recommended for Production)
|
| 89 |
+
|
| 90 |
+
```python
|
| 91 |
+
from vllm import LLM, SamplingParams
|
| 92 |
+
|
| 93 |
+
llm = LLM(model="ramdev12345/amara-o1")
|
| 94 |
+
sampling_params = SamplingParams(temperature=0.7, top_p=0.9, max_tokens=512)
|
| 95 |
+
|
| 96 |
+
prompts = [
|
| 97 |
+
"<|im_start|>user\nOptimize this bubble sort algorithm<|im_end|>\n<|im_start|>assistant"
|
| 98 |
+
]
|
| 99 |
+
|
| 100 |
+
outputs = llm.generate(prompts, sampling_params)
|
| 101 |
+
for output in outputs:
|
| 102 |
+
print(output.outputs[0].text)
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
### Chat Template
|
| 106 |
+
|
| 107 |
+
```python
|
| 108 |
+
messages = [
|
| 109 |
+
{"role": "user", "content": "Write a binary search tree implementation in Python"}
|
| 110 |
+
]
|
| 111 |
+
|
| 112 |
+
text = tokenizer.apply_chat_template(
|
| 113 |
+
messages,
|
| 114 |
+
tokenize=False,
|
| 115 |
+
add_generation_prompt=True
|
| 116 |
+
)
|
| 117 |
+
|
| 118 |
+
inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 119 |
+
outputs = model.generate(**inputs, max_new_tokens=512)
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
---
|
| 123 |
+
|
| 124 |
+
## Training
|
| 125 |
+
|
| 126 |
+
### Training Configuration
|
| 127 |
+
|
| 128 |
+
| Parameter | Value |
|
| 129 |
+
|-----------|-------|
|
| 130 |
+
| Training Method | Supervised Fine-Tuning (SFT) with QLoRA |
|
| 131 |
+
| Quantization | 4-bit NF4 |
|
| 132 |
+
| LoRA Rank | 64 |
|
| 133 |
+
| LoRA Alpha | 16 |
|
| 134 |
+
| Batch Size | 1 (per device) |
|
| 135 |
+
| Gradient Accumulation | 8 steps |
|
| 136 |
+
| Learning Rate | 2e-4 |
|
| 137 |
+
| LR Schedule | Cosine with warmup |
|
| 138 |
+
| Epochs | 2 |
|
| 139 |
+
| Training Examples | ~7,000 |
|
| 140 |
+
| Hardware | 1x NVIDIA A100 80GB |
|
| 141 |
+
| Training Time | ~3 hours |
|
| 142 |
+
|
| 143 |
+
### Training Datasets
|
| 144 |
+
|
| 145 |
+
| Dataset | Examples | Purpose |
|
| 146 |
+
|---------|----------|---------|
|
| 147 |
+
| DeepMind Code Contests | 5,000 | Algorithmic problem solving |
|
| 148 |
+
| MATH-500 | 500 | Mathematical reasoning |
|
| 149 |
+
| Code Vulnerability Security DPO | 1,000 | Secure coding practices |
|
| 150 |
+
| Anthropic Interviews | 1,000 | Complex reasoning patterns |
|
| 151 |
+
|
| 152 |
+
### LoRA Target Modules
|
| 153 |
+
|
| 154 |
+
```
|
| 155 |
+
q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
---
|
| 159 |
+
|
| 160 |
+
## Performance
|
| 161 |
+
|
| 162 |
+
amara-o1 demonstrates strong performance across multiple coding benchmarks:
|
| 163 |
+
|
| 164 |
+
### Coding Capabilities
|
| 165 |
+
|
| 166 |
+
| Task Type | Performance | Notes |
|
| 167 |
+
|-----------|-------------|-------|
|
| 168 |
+
| Algorithm Implementation | ⭐⭐⭐⭐⭐ | Excellent on competitive programming |
|
| 169 |
+
| Code Security | ⭐⭐⭐⭐⭐ | Trained on vulnerability detection |
|
| 170 |
+
| Math Problems | ⭐⭐⭐⭐ | Strong symbolic reasoning |
|
| 171 |
+
| Code Explanation | ⭐⭐⭐⭐⭐ | Clear, detailed breakdowns |
|
| 172 |
+
| Multi-language Support | ⭐⭐⭐⭐ | 90+ programming languages |
|
| 173 |
+
|
| 174 |
+
### Example Outputs
|
| 175 |
+
|
| 176 |
+
**Input:** "Write a function to detect if a linked list has a cycle"
|
| 177 |
+
|
| 178 |
+
**Output:**
|
| 179 |
+
```python
|
| 180 |
+
def has_cycle(head):
|
| 181 |
+
"""
|
| 182 |
+
Detect cycle in linked list using Floyd's algorithm.
|
| 183 |
+
Time: O(n), Space: O(1)
|
| 184 |
+
"""
|
| 185 |
+
if not head or not head.next:
|
| 186 |
+
return False
|
| 187 |
+
|
| 188 |
+
slow = head
|
| 189 |
+
fast = head.next
|
| 190 |
+
|
| 191 |
+
while slow != fast:
|
| 192 |
+
if not fast or not fast.next:
|
| 193 |
+
return False
|
| 194 |
+
slow = slow.next
|
| 195 |
+
fast = fast.next.next
|
| 196 |
+
|
| 197 |
+
return True
|
| 198 |
+
```
|
| 199 |
+
|
| 200 |
+
---
|
| 201 |
+
|
| 202 |
+
## Limitations
|
| 203 |
+
|
| 204 |
+
While amara-o1 is a powerful coding assistant, users should be aware of:
|
| 205 |
+
|
| 206 |
+
- **Not a Replacement for Testing**: Always test generated code thoroughly
|
| 207 |
+
- **Security**: Review security-critical code manually
|
| 208 |
+
- **Domain Expertise**: May require human oversight for specialized domains
|
| 209 |
+
- **Hallucinations**: Like all LLMs, may occasionally generate incorrect information
|
| 210 |
+
- **License Compliance**: Ensure generated code complies with your licensing requirements
|
| 211 |
+
- **Bias**: May reflect biases present in training data
|
| 212 |
+
|
| 213 |
+
---
|
| 214 |
+
|
| 215 |
+
## Ethical Considerations
|
| 216 |
+
|
| 217 |
+
### Intended Use
|
| 218 |
+
|
| 219 |
+
✅ **Recommended Uses:**
|
| 220 |
+
- Educational programming assistance
|
| 221 |
+
- Code prototyping and rapid development
|
| 222 |
+
- Algorithm implementation
|
| 223 |
+
- Security vulnerability analysis
|
| 224 |
+
- Code review and optimization
|
| 225 |
+
|
| 226 |
+
❌ **Not Recommended:**
|
| 227 |
+
- Generating malicious code
|
| 228 |
+
- Bypassing security measures
|
| 229 |
+
- Automating critical systems without human oversight
|
| 230 |
+
- Legal or financial decision-making
|
| 231 |
+
|
| 232 |
+
### Bias and Safety
|
| 233 |
+
|
| 234 |
+
amara-o1 has been trained on diverse coding datasets, but may still reflect biases in:
|
| 235 |
+
- Programming paradigm preferences
|
| 236 |
+
- Language-specific idioms
|
| 237 |
+
- Solution approaches
|
| 238 |
+
|
| 239 |
+
Users should:
|
| 240 |
+
- Review outputs for appropriateness
|
| 241 |
+
- Apply domain expertise
|
| 242 |
+
- Follow security best practices
|
| 243 |
+
- Test thoroughly before deployment
|
| 244 |
+
|
| 245 |
+
---
|
| 246 |
+
|
| 247 |
+
## System Requirements
|
| 248 |
+
|
| 249 |
+
### Minimum Requirements
|
| 250 |
+
|
| 251 |
+
| Component | Requirement |
|
| 252 |
+
|-----------|-------------|
|
| 253 |
+
| GPU Memory | 16GB (with 4-bit quantization) |
|
| 254 |
+
| RAM | 32GB recommended |
|
| 255 |
+
| Storage | 15GB for model files |
|
| 256 |
+
|
| 257 |
+
### Recommended Setup
|
| 258 |
+
|
| 259 |
+
- **GPU**: NVIDIA A100, A6000, or RTX 4090
|
| 260 |
+
- **Inference**: Use vLLM or TGI for production
|
| 261 |
+
- **Quantization**: 4-bit or 8-bit for resource constraints
|
| 262 |
+
|
| 263 |
+
---
|
| 264 |
+
|
| 265 |
+
## Citation
|
| 266 |
+
|
| 267 |
+
If you use amara-o1 in your research or applications, please cite:
|
| 268 |
+
|
| 269 |
+
```bibtex
|
| 270 |
+
@misc{amara-o1-2024,
|
| 271 |
+
title={amara-o1: A Fine-tuned Coding Model for Advanced Problem Solving},
|
| 272 |
+
author={ramdev12345},
|
| 273 |
+
year={2024},
|
| 274 |
+
howpublished={\url{https://huggingface.co/ramdev12345/amara-o1}},
|
| 275 |
+
}
|
| 276 |
+
```
|
| 277 |
+
|
| 278 |
+
### Base Model Citation
|
| 279 |
+
|
| 280 |
+
```bibtex
|
| 281 |
+
@article{qwen2.5,
|
| 282 |
+
title={Qwen2.5-Coder Technical Report},
|
| 283 |
+
author={Qwen Team},
|
| 284 |
+
journal={arXiv preprint},
|
| 285 |
+
year={2024}
|
| 286 |
+
}
|
| 287 |
+
```
|
| 288 |
+
|
| 289 |
+
---
|
| 290 |
+
|
| 291 |
+
## License
|
| 292 |
+
|
| 293 |
+
This model is released under the **MIT License**. See [LICENSE](LICENSE) for details.
|
| 294 |
+
|
| 295 |
+
The model inherits the license from its base model (Qwen2.5-Coder).
|
| 296 |
+
|
| 297 |
+
---
|
| 298 |
+
|
| 299 |
+
## Acknowledgments
|
| 300 |
+
|
| 301 |
+
- **Base Model**: Qwen Team for Qwen2.5-Coder
|
| 302 |
+
- **Training Datasets**: DeepMind, Hugging Face, CyberNative, Anthropic
|
| 303 |
+
- **Infrastructure**: Modal Labs for training infrastructure
|
| 304 |
+
- **Framework**: Hugging Face Transformers, PEFT, TRL
|
| 305 |
+
|
| 306 |
+
---
|
| 307 |
+
|
| 308 |
+
## Contact & Support
|
| 309 |
+
|
| 310 |
+
- **Issues**: [GitHub Issues](https://github.com/ramdev12345/amara-o1/issues)
|
| 311 |
+
- **Discussions**: [Hugging Face Discussions](https://huggingface.co/ramdev12345/amara-o1/discussions)
|
| 312 |
+
- **Email**: [your-email@example.com]
|
| 313 |
+
|
| 314 |
+
---
|
| 315 |
+
|
| 316 |
+
<div align="center">
|
| 317 |
+
|
| 318 |
+
**Built with 💻 for the coding community**
|
| 319 |
+
|
| 320 |
+
⭐ Star this repo | 🐛 Report bugs | 🤝 Contribute
|
| 321 |
+
|
| 322 |
+
</div>
|