Text Generation
Transformers
Safetensors
English
code
fluxnat
cybersecurity
vulnerability-detection
sast
security-audit
code-security
cwe
owasp
unsloth
code-analysis
penetration-testing
secure-coding
conversational
custom_code
Instructions to use k4ran909/Fluxnat-Coder-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use k4ran909/Fluxnat-Coder-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="k4ran909/Fluxnat-Coder-3B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("k4ran909/Fluxnat-Coder-3B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use k4ran909/Fluxnat-Coder-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "k4ran909/Fluxnat-Coder-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "k4ran909/Fluxnat-Coder-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/k4ran909/Fluxnat-Coder-3B
- SGLang
How to use k4ran909/Fluxnat-Coder-3B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "k4ran909/Fluxnat-Coder-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "k4ran909/Fluxnat-Coder-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "k4ran909/Fluxnat-Coder-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "k4ran909/Fluxnat-Coder-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use k4ran909/Fluxnat-Coder-3B with Docker Model Runner:
docker model run hf.co/k4ran909/Fluxnat-Coder-3B
Update professional Fluxnat Coder 3B model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
- code
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
tags:
|
| 7 |
+
- cybersecurity
|
| 8 |
+
- vulnerability-detection
|
| 9 |
+
- sast
|
| 10 |
+
- security-audit
|
| 11 |
+
- code-security
|
| 12 |
+
- cwe
|
| 13 |
+
- owasp
|
| 14 |
+
- qwen2
|
| 15 |
+
- unsloth
|
| 16 |
+
- code-analysis
|
| 17 |
+
- penetration-testing
|
| 18 |
+
- secure-coding
|
| 19 |
+
base_model: Qwen/Qwen2.5-Coder-3B-Instruct
|
| 20 |
+
pipeline_tag: text-generation
|
| 21 |
+
library_name: transformers
|
| 22 |
+
widget:
|
| 23 |
+
- text: |
|
| 24 |
+
<|im_start|>system
|
| 25 |
+
You are Fluxnat Coder 3B, an elite AI cybersecurity and secure coding intelligence model created by Fluxnat. Your mission is to perform rigorous source code vulnerability auditing, identify CWE and OWASP Top 10 security flaws, explain attack surfaces and root causes using detailed step-by-step reasoning, and provide production-ready secure remediations.<|im_end|>
|
| 26 |
+
<|im_start|>user
|
| 27 |
+
Audit this Python code for vulnerabilities:
|
| 28 |
+
@app.route('/lookup')
|
| 29 |
+
def lookup():
|
| 30 |
+
user = request.args.get('user')
|
| 31 |
+
query = f"SELECT * FROM users WHERE name = '{user}'"
|
| 32 |
+
return db.execute(query).fetchall()<|im_end|>
|
| 33 |
+
<|im_start|>assistant
|
| 34 |
+
example_title: SQL Injection Audit
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
<div align="center">
|
| 38 |
+
|
| 39 |
+
# π‘οΈ Fluxnat Coder 3B
|
| 40 |
+
|
| 41 |
+
### *Autonomous Cybersecurity Intelligence & Source Code Vulnerability Auditor*
|
| 42 |
+
|
| 43 |
+
[](https://opensource.org/licenses/Apache-2.0)
|
| 44 |
+
[](https://huggingface.co/k4ran909/Fluxnat-Coder-3B)
|
| 45 |
+
[](https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct)
|
| 46 |
+
[](https://github.com/unslothai/unsloth)
|
| 47 |
+
[](https://huggingface.co/k4ran909/Fluxnat-Coder-3B)
|
| 48 |
+
|
| 49 |
+
</div>
|
| 50 |
+
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
## π Overview
|
| 54 |
+
|
| 55 |
+
**Fluxnat Coder 3B** is a specialized, high-precision cybersecurity and code security intelligence model developed by **Fluxnat**.
|
| 56 |
+
Built on top of `Qwen2.5-Coder-3B-Instruct` and fine-tuned using **Unsloth (QLoRA)** on curated vulnerability datasets, threat intelligence corpora, and structured Chain-of-Thought (CoT) security audit trajectories, **Fluxnat Coder 3B** acts as an autonomous Static Application Security Testing (SAST) analyst and secure code reviewer.
|
| 57 |
+
|
| 58 |
+
Unlike generic code models that frequently trigger false safety refusals when auditing real-world security vulnerabilities, **Fluxnat Coder 3B** is completely refusal-free for authorized defensive security analysis, penetration testing verification, and automated vulnerability triage.
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
## π Key Capabilities
|
| 63 |
+
|
| 64 |
+
- **π Taint Flow & Root Cause Analysis:** Tracks untrusted input from **Source $\rightarrow$ Sanitizer $\rightarrow$ Sink** with explicit causality.
|
| 65 |
+
- **π·οΈ Deterministic CWE & OWASP Mapping:** Maps discovered flaws directly to MITRE CWE identifiers (CWE-89, CWE-78, CWE-22, CWE-79, CWE-502, CWE-918, etc.) and OWASP Top 10 categories.
|
| 66 |
+
- **π Objective CVSS Scoring:** Computes vulnerability severity ratings (Critical, High, Medium, Low) and estimated CVSS base metrics.
|
| 67 |
+
- **π‘οΈ Production-Ready Secure Fixes:** Generates drop-in replacements with parameterized queries, safe execution APIs, and canonicalized path operations.
|
| 68 |
+
- **β‘ Ultra-Low Latency & Minimal Footprint:** At 3 billion parameters, it fits comfortably into consumer GPUs (4 GB VRAM in 4-bit) and edge environments.
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
## π Supported Programming Languages & Stacks
|
| 73 |
+
|
| 74 |
+
| Ecosystem | Vulnerabilities Covered |
|
| 75 |
+
| :--- | :--- |
|
| 76 |
+
| **Python** | SQLi, Command Injection, Path Traversal, Insecure Deserialization (`pickle`/`yaml`), SSRF, Hardcoded Secrets |
|
| 77 |
+
| **JavaScript / TypeScript / Node.js** | DOM XSS, `child_process.exec`, Prototype Pollution, Unsafe Regex (ReDoS), JWT misconfigurations |
|
| 78 |
+
| **Go** | Unchecked errors, SSRF (`http.Get`), Unsafe Pointer arithmetic, Command execution, Race conditions |
|
| 79 |
+
| **C / C++** | Buffer overflows, Use-After-Free, Format string vulnerabilities, Memory leaks, Integer overflows |
|
| 80 |
+
| **Java** | JNDI injection, XML External Entity (XXE), SQLi via Hibernate/JDBC, Deserialization |
|
| 81 |
+
| **PHP** | File inclusion (`LFI`/`RFI`), SQLi, `eval` injection, Object injection |
|
| 82 |
+
| **Infrastructure / DevOps** | Dockerfile root user, exposed ports, unpinned images, `.env` secret leaks |
|
| 83 |
+
|
| 84 |
+
---
|
| 85 |
+
|
| 86 |
+
## π» Quickstart Inference
|
| 87 |
+
|
| 88 |
+
### 1. Using Hugging Face `transformers`
|
| 89 |
+
|
| 90 |
+
```python
|
| 91 |
+
import torch
|
| 92 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 93 |
+
|
| 94 |
+
MODEL_ID = "k4ran909/Fluxnat-Coder-3B"
|
| 95 |
+
|
| 96 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
|
| 97 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 98 |
+
MODEL_ID,
|
| 99 |
+
torch_dtype=torch.float16,
|
| 100 |
+
device_map="auto",
|
| 101 |
+
trust_remote_code=True
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
messages = [
|
| 105 |
+
{
|
| 106 |
+
"role": "system",
|
| 107 |
+
"content": (
|
| 108 |
+
"You are Fluxnat Coder 3B, an elite AI cybersecurity and secure coding intelligence model created by Fluxnat. "
|
| 109 |
+
"Your mission is to perform rigorous source code vulnerability auditing, identify CWE and OWASP Top 10 security flaws, "
|
| 110 |
+
"explain attack surfaces and root causes using detailed step-by-step reasoning, and provide production-ready secure remediations."
|
| 111 |
+
)
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"role": "user",
|
| 115 |
+
"content": """Audit this Node.js endpoint for vulnerabilities:
|
| 116 |
+
|
| 117 |
+
app.get('/ping', (req, res) => {
|
| 118 |
+
const host = req.query.host;
|
| 119 |
+
exec(`ping -c 3 ${host}`, (err, stdout) => {
|
| 120 |
+
res.send(stdout);
|
| 121 |
+
});
|
| 122 |
+
});"""
|
| 123 |
+
}
|
| 124 |
+
]
|
| 125 |
+
|
| 126 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 127 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 128 |
+
|
| 129 |
+
outputs = model.generate(
|
| 130 |
+
**inputs,
|
| 131 |
+
max_new_tokens=512,
|
| 132 |
+
temperature=0.2,
|
| 133 |
+
top_p=0.95
|
| 134 |
+
)
|
| 135 |
+
|
| 136 |
+
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
|
| 137 |
+
print(response)
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
---
|
| 141 |
+
|
| 142 |
+
### 2. Output Example
|
| 143 |
+
|
| 144 |
+
```markdown
|
| 145 |
+
### Security Assessment by Fluxnat Coder 3B
|
| 146 |
+
|
| 147 |
+
**Severity:** Critical (CVSS 9.8)
|
| 148 |
+
**Vulnerability:** OS Command Injection
|
| 149 |
+
**CWE:** CWE-78 (Improper Neutralization of Special Elements used in an OS Command)
|
| 150 |
+
**OWASP:** A03:2021 - Injection
|
| 151 |
+
|
| 152 |
+
#### Root Cause & Reasoning:
|
| 153 |
+
1. `req.query.host` is extracted directly from user HTTP input without validation.
|
| 154 |
+
2. `child_process.exec()` invokes a system shell (`/bin/sh` or `cmd.exe`), which interprets command separators (`;`, `&`, `|`, `` ` ``).
|
| 155 |
+
3. An attacker can append arbitrary system commands (e.g. `host=127.0.0.1; cat /etc/passwd`).
|
| 156 |
+
|
| 157 |
+
#### Secure Remediation:
|
| 158 |
+
Use `execFile` without shell invocation and strictly validate the input:
|
| 159 |
+
|
| 160 |
+
```javascript
|
| 161 |
+
const { execFile } = require('child_process');
|
| 162 |
+
const net = require('net');
|
| 163 |
+
|
| 164 |
+
app.get('/ping', (req, res) => {
|
| 165 |
+
const host = req.query.host;
|
| 166 |
+
if (!host || (!net.isIP(host) && !/^[a-zA-Z0-9.-]+$/.test(host))) {
|
| 167 |
+
return res.status(400).send('Invalid host format');
|
| 168 |
+
}
|
| 169 |
+
execFile('ping', ['-c', '3', host], { timeout: 5000 }, (err, stdout) => {
|
| 170 |
+
if (err) return res.status(500).send('Ping failed');
|
| 171 |
+
res.type('text/plain').send(stdout);
|
| 172 |
+
});
|
| 173 |
+
});
|
| 174 |
+
```
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
+
---
|
| 178 |
+
|
| 179 |
+
## π οΈ Serving with vLLM (Production & API)
|
| 180 |
+
|
| 181 |
+
Run an OpenAI-compatible high-throughput inference server:
|
| 182 |
+
|
| 183 |
+
```bash
|
| 184 |
+
python -m vllm.entrypoints.openai.api_server \
|
| 185 |
+
--model k4ran909/Fluxnat-Coder-3B \
|
| 186 |
+
--dtype float16 \
|
| 187 |
+
--max-model-len 4096 \
|
| 188 |
+
--port 8000
|
| 189 |
+
```
|
| 190 |
+
|
| 191 |
+
---
|
| 192 |
+
|
| 193 |
+
## βοΈ Training Details
|
| 194 |
+
|
| 195 |
+
| Hyperparameter | Value |
|
| 196 |
+
| :--- | :--- |
|
| 197 |
+
| **Base Architecture** | Qwen 2.5 Coder 3B (Dense Transformer) |
|
| 198 |
+
| **Fine-Tuning Framework** | **Unsloth** + TRL `SFTTrainer` |
|
| 199 |
+
| **Method** | QLoRA (4-bit Base Model with 16-bit LoRA Adapters) |
|
| 200 |
+
| **LoRA Rank ($r$)** | `64` |
|
| 201 |
+
| **LoRA Alpha ($\alpha$)** | `128` |
|
| 202 |
+
| **Target Modules** | `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj` |
|
| 203 |
+
| **Learning Rate** | `2e-4` (Cosine Scheduler) |
|
| 204 |
+
| **Effective Batch Size** | `16` (Batch size 2 $\times$ Gradient Accumulation 4 $\times$ 2) |
|
| 205 |
+
| **Sequence Length** | `4,096` tokens |
|
| 206 |
+
| **Hardware** | 1x NVIDIA Tesla T4 GPU (Google Colab Free Tier) |
|
| 207 |
+
| **Optimizer** | `adamw_8bit` |
|
| 208 |
+
|
| 209 |
+
---
|
| 210 |
+
|
| 211 |
+
## βοΈ Responsible Use & Ethical Policy
|
| 212 |
+
|
| 213 |
+
**Fluxnat Coder 3B** is designed and released exclusively for:
|
| 214 |
+
- β
Defensive software security auditing and continuous integration code reviews
|
| 215 |
+
- β
Assisting development teams in finding and patching security flaws before deployment
|
| 216 |
+
- β
Educational and academic cybersecurity research
|
| 217 |
+
- β Unauthorized penetration testing or attacking systems without explicit written consent is strictly prohibited.
|
| 218 |
+
|
| 219 |
+
---
|
| 220 |
+
|
| 221 |
+
<div align="center">
|
| 222 |
+
|
| 223 |
+
**Developed with β€οΈ by Fluxnat**
|
| 224 |
+
*Next-Generation AI for Cyber Defense*
|
| 225 |
+
|
| 226 |
+
</div>
|