AdvRahul commited on
Commit
0a6f7c5
·
verified ·
1 Parent(s): 44e35d2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +106 -46
README.md CHANGED
@@ -1,52 +1,112 @@
1
  ---
2
- library_name: transformers
3
- license: apache-2.0
4
- license_link: https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507/blob/main/LICENSE
5
- pipeline_tag: text-generation
6
  base_model: Qwen/Qwen3-4B-Instruct-2507
7
  tags:
8
- - llama-cpp
 
 
 
 
 
9
  ---
10
 
11
  # AdvRahul/Axion-4B
12
- This model is finetuned from Qwen/Qwen3-4B-Instruct-2507, making it safer through red team testing with advanced protocols.
13
-
14
- ## Use with llama.cpp
15
- Install llama.cpp through brew (works on Mac and Linux)
16
-
17
- ```bash
18
- brew install llama.cpp
19
-
20
- ```
21
- Invoke the llama.cpp server or the CLI.
22
-
23
- ### CLI:
24
- ```bash
25
- llama-cli --hf-repo AdvRahul/Axion-4B-Q4_K_M-GGUF --hf-file Axion-4B-Q4_K_M.gguf -p "The meaning to life and the universe is"
26
- ```
27
-
28
- ### Server:
29
- ```bash
30
- llama-server --hf-repo AdvRahul/Axion-4B-Q4_K_M-GGUF --hf-file Axion-4B-Q4_K_M.gguf -c 2048
31
- ```
32
-
33
- Note: You can also use this checkpoint directly through the [usage steps](https://github.com/ggerganov/llama.cpp?tab=readme-ov-file#usage) listed in the Llama.cpp repo as well.
34
-
35
- Step 1: Clone llama.cpp from GitHub.
36
- ```
37
- git clone https://github.com/ggerganov/llama.cpp
38
- ```
39
-
40
- Step 2: Move into the llama.cpp folder and build it with `LLAMA_CURL=1` flag along with other hardware-specific flags (for ex: LLAMA_CUDA=1 for Nvidia GPUs on Linux).
41
- ```
42
- cd llama.cpp && LLAMA_CURL=1 make
43
- ```
44
-
45
- Step 3: Run inference through the main binary.
46
- ```
47
- ./llama-cli --hf-repo AdvRahul/Axion-4B-Q4_K_M-GGUF --hf-file Axion-4B-Q4_K_M.gguf -p "The meaning to life and the universe is"
48
- ```
49
- or
50
- ```
51
- ./llama-server --hf-repo AdvRahul/Axion-4B-Q4_K_M-GGUF --hf-file Axion-4B-Q4_K_M.gguf -c 2048
52
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: other
 
 
 
3
  base_model: Qwen/Qwen3-4B-Instruct-2507
4
  tags:
5
+ - qwen
6
+ - qwen3
7
+ - fine-tuned
8
+ - safety
9
+ - instruct
10
+ - axion
11
  ---
12
 
13
  # AdvRahul/Axion-4B
14
+
15
+ **A safety-enhanced version of Qwen3-4B-Instruct, optimized for reliable and responsible AI applications. 🛡️**
16
+
17
+ `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.
18
+
19
+ ## 🚀 Model Details
20
+
21
+ * **Model Creator:** AdvRahul
22
+ * **Base Model:** [Qwen/Qwen3-4B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507)
23
+ * **Fine-tuning Focus:** Enhanced Safety & Harmlessness via Red-Teaming
24
+ * **Architecture:** Qwen3
25
+ * **Context Length:** 262,144 tokens
26
+ * **License:** Based on the Tongyi Qianwen LICENSE of the original model.
27
+
28
+ ---
29
+
30
+ ## 📝 Model Description
31
+
32
+ ### Enhanced for Safety
33
+
34
+ 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.
35
+
36
+ ### Powerful Core Capabilities
37
+
38
+ While adding a crucial safety layer, `Axion-4B` retains the exceptional capabilities of its base model, including:
39
+ * **Strong Logical Reasoning:** Excels at complex problems in math, science, and logic.
40
+ * **Advanced Instruction Following:** Reliably adheres to user commands and constraints.
41
+ * **Multi-lingual Knowledge:** Covers a wide range of languages and cultural contexts.
42
+ * **Massive 256K Context Window:** Capable of understanding and processing very long documents.
43
+ * **Excellent Coding & Tool Use:** Proficient in code generation and agentic tasks.
44
+
45
+ ---
46
+
47
+ ## 💻 Quickstart
48
+
49
+ You can use this model directly with the `transformers` library (version 4.51.0 or newer is recommended).
50
+
51
+ ```python
52
+ from transformers import AutoModelForCausalLM, AutoTokenizer
53
+ import torch
54
+
55
+ # IMPORTANT: Use the model name for this repository
56
+ model_name = "AdvRahul/Axion-4B"
57
+
58
+ # Load the tokenizer and the model
59
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
60
+ model = AutoModelForCausalLM.from_pretrained(
61
+ model_name,
62
+ torch_dtype="auto",
63
+ device_map="auto"
64
+ )
65
+
66
+ # Prepare the model input
67
+ prompt = "Give me a short introduction to large language models and their safety considerations."
68
+ messages = [
69
+ {"role": "user", "content": prompt}
70
+ ]
71
+ text = tokenizer.apply_chat_template(
72
+ messages,
73
+ tokenize=False,
74
+ add_generation_prompt=True,
75
+ )
76
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
77
+
78
+ # Generate text
79
+ generated_ids = model.generate(
80
+ **model_inputs,
81
+ max_new_tokens=512 # Limiting for a concise example
82
+ )
83
+ output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
84
+
85
+ content = tokenizer.decode(output_ids, skip_special_tokens=True)
86
+ print("Response:", content)
87
+
88
+ Optimized Deployment
89
+ For high-throughput, production-ready deployment, you can use frameworks like vLLM or SGLang to serve the model via an OpenAI-compatible API.
90
+
91
+ vLLM:
92
+
93
+ Bash
94
+
95
+ vllm serve AdvRahul/Axion-4B --max-model-len 262144
96
+ SGLang:
97
+
98
+ Bash
99
+
100
+ python -m sglang.launch_server --model-path AdvRahul/Axion-4B --context-length 262144
101
+ Note: If you encounter out-of-memory (OOM) issues, consider reducing the max context length (e.g., --max-model-len 32768).
102
+
103
+ ⚠️ Ethical Considerations and Limitations
104
+ 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.
105
+
106
+ No Guarantees: While the safety alignment is significantly improved, it does not guarantee perfectly harmless outputs in all scenarios.
107
+
108
+ Inherited Biases: The model may still reflect biases present in the vast amount of data used to train its base model.
109
+
110
+ Factual Accuracy: Always fact-check critical information, as the model can generate plausible but incorrect statements.
111
+
112
+ 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.