File size: 4,270 Bytes
bad2a38
0a6f7c5
bad2a38
 
0a6f7c5
 
 
 
 
 
bad2a38
 
c5c1ce7
0a6f7c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
license: other
base_model: Qwen/Qwen3-4B-Instruct-2507
tags:
- qwen
- qwen3
- fine-tuned
- safety
- instruct
- axion
---

# AdvRahul/Axion-4B

**A safety-enhanced version of Qwen3-4B-Instruct, optimized for reliable and responsible AI applications. ๐Ÿ›ก๏ธ**

`Axion-4B` is a fine-tuned version of the powerful `Qwen/Qwen3-4B-Instruct-2507` model. The primary enhancement in this version is its **robust safety alignment**, making it a more dependable choice for production environments and user-facing applications.

## ๐Ÿš€ Model Details

* **Model Creator:** AdvRahul
* **Base Model:** [Qwen/Qwen3-4B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507)
* **Fine-tuning Focus:** Enhanced Safety & Harmlessness via Red-Teaming
* **Architecture:** Qwen3
* **Context Length:** 262,144 tokens
* **License:** Based on the Tongyi Qianwen LICENSE of the original model.

---

## ๐Ÿ“ Model Description

### Enhanced for Safety

The core purpose of `Axion-4B` is to provide a safer alternative for developers. The base model underwent extensive **red-team testing using advanced protocols** to significantly minimize the generation of harmful, biased, or inappropriate content.

### Powerful Core Capabilities

While adding a crucial safety layer, `Axion-4B` retains the exceptional capabilities of its base model, including:
* **Strong Logical Reasoning:** Excels at complex problems in math, science, and logic.
* **Advanced Instruction Following:** Reliably adheres to user commands and constraints.
* **Multi-lingual Knowledge:** Covers a wide range of languages and cultural contexts.
* **Massive 256K Context Window:** Capable of understanding and processing very long documents.
* **Excellent Coding & Tool Use:** Proficient in code generation and agentic tasks.

---

## ๐Ÿ’ป Quickstart

You can use this model directly with the `transformers` library (version 4.51.0 or newer is recommended).

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

# IMPORTANT: Use the model name for this repository
model_name = "AdvRahul/Axion-4B"

# Load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto"
)

# Prepare the model input
prompt = "Give me a short introduction to large language models and their safety considerations."
messages = [
    {"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

# Generate text
generated_ids = model.generate(
    **model_inputs,
    max_new_tokens=512 # Limiting for a concise example
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()

content = tokenizer.decode(output_ids, skip_special_tokens=True)
print("Response:", content)

Optimized Deployment
For high-throughput, production-ready deployment, you can use frameworks like vLLM or SGLang to serve the model via an OpenAI-compatible API.

vLLM:

Bash

vllm serve AdvRahul/Axion-4B --max-model-len 262144
SGLang:

Bash

python -m sglang.launch_server --model-path AdvRahul/Axion-4B --context-length 262144
Note: If you encounter out-of-memory (OOM) issues, consider reducing the max context length (e.g., --max-model-len 32768).

โš ๏ธ Ethical Considerations and Limitations
This model was fine-tuned with the explicit goal of improving safety and reducing harmful outputs. However, no AI model is completely immune to risks.

No Guarantees: While the safety alignment is significantly improved, it does not guarantee perfectly harmless outputs in all scenarios.

Inherited Biases: The model may still reflect biases present in the vast amount of data used to train its base model.

Factual Accuracy: Always fact-check critical information, as the model can generate plausible but incorrect statements.

Best Practice: It is strongly recommended that developers implement their own content moderation filters and safety guardrails as part of a comprehensive, defense-in-depth strategy. Thoroughly evaluate the model's performance and safety for your specific use case before deploying it to a live audience.