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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# DevOps Qwen — Fine-Tuned Qwen2.5-3B-Instruct

A Qwen2.5-3B-Instruct model fine-tuned with **LoRA (Low-Rank Adaptation)** on a DevOps-focused dataset.

The model is designed for practical DevOps, Cloud, Linux, Docker, Kubernetes, Terraform, CI/CD, networking, monitoring, and troubleshooting questions.

## Model Details

| Property            | Value                          |
| ------------------- | ------------------------------ |
| Base Model          | Qwen/Qwen2.5-3B-Instruct       |
| Model Type          | Causal Language Model          |
| Fine-Tuning         | LoRA                           |
| LoRA Rank           | 8                              |
| LoRA Alpha          | 16                             |
| LoRA Dropout        | 0.05                           |
| Target Modules      | q_proj, k_proj, v_proj, o_proj |
| Training Epochs     | 1                              |
| Max Sequence Length | 512                            |
| Quantization        | Q4_K_M                         |
| Format              | GGUF                           |
| Approx. Model Size  | 1.9 GB                         |
| Runtime             | Ollama / llama.cpp             |
| Primary Use         | DevOps AI Assistant            |

## What is this model?

This model is a specialized version of Qwen2.5-3B-Instruct trained on DevOps-oriented examples.

The goal of the fine-tuning is to improve the model's ability to provide practical responses for:

* Linux administration
* AWS
* GCP
* Docker
* Kubernetes
* Terraform
* Git
* Jenkins
* CI/CD
* Networking
* HTTP troubleshooting
* Monitoring
* Production troubleshooting
* Cloud infrastructure

The model is intended to provide answers with:

1. Root cause or explanation
2. Exact commands where appropriate
3. Short explanation of commands
4. Production-safe troubleshooting steps

## Fine-Tuning Approach

The model was fine-tuned using **LoRA — Low-Rank Adaptation**.

Instead of updating the entire base model, LoRA trains a small set of additional parameters while keeping most of the original model frozen.

```text
Qwen2.5-3B-Instruct
        |
        v
   LoRA Training
        |
        v
   LoRA Adapter
        |
        v
Merge Adapter + Base Model
        |
        v
   Merged Model
```

This approach reduces training memory and computational requirements compared with full fine-tuning.

## Training Configuration

```text
Base Model:
Qwen/Qwen2.5-3B-Instruct

LoRA:
r = 8
alpha = 16
dropout = 0.05

Target modules:
q_proj
k_proj
v_proj
o_proj

Epochs:
1

Batch size:
1

Gradient accumulation:
4

Learning rate:
2e-4

Maximum sequence length:
512
```

## Model Conversion

After LoRA training, the adapter was merged with the base model.

The merged Hugging Face model was then converted to GGUF using llama.cpp.

```text
LoRA Adapter
     |
     v
Merged Hugging Face Model
     |
     v
GGUF F16
     |
     v
Q4_K_M Quantization
     |
     v
qwen-devops-q4_k_m.gguf
```

### GGUF

**GGUF (GPT-Generated Unified Format)** is an efficient model format commonly used for local LLM inference with llama.cpp and compatible runtimes.

### Q4_K_M

Q4_K_M is a 4-bit quantization format.

It reduces model storage and memory requirements while maintaining a useful level of model quality for local inference.

Approximate sizes:

```text
Merged Hugging Face Model  ≈ 12 GB
GGUF F16                   ≈ 5.8 GB
Q4_K_M GGUF                ≈ 1.9 GB
```

## Hardware Used

The model was developed and tested in a CPU-only environment.

```text
CPU:
AMD EPYC 7543

CPU cores available:
12

RAM:
~57 GB

GPU:
None

CUDA:
False

Python:
3.10.14
```

## Usage with Ollama

Download the GGUF model from this repository.

Create a `Modelfile`:

```text
FROM ./qwen-devops-q4_k_m.gguf

PARAMETER temperature 0.2
PARAMETER top_k 20
PARAMETER top_p 0.9
PARAMETER repeat_penalty 1.1
PARAMETER num_ctx 4096

SYSTEM """
You are a senior DevOps and Cloud engineer.

Give practical and accurate technical answers.

For Linux, AWS, Docker, Kubernetes, Terraform, Git,
Jenkins, CI/CD, monitoring, networking and troubleshooting:

- Explain the root cause.
- Give exact commands when appropriate.
- Explain commands briefly.
- Do not invent information.
- If you don't know something, clearly say so.
- Prefer safe production-ready solutions.
"""
```

Create the Ollama model:

```bash
ollama create devops-qwen -f Modelfile
```

Run:

```bash
ollama run devops-qwen
```

## Example

Question:

```text
How do I troubleshoot a 502 Bad Gateway error from an AWS ALB?
```

The model is intended to provide a structured troubleshooting approach such as:

```text
1. Check ALB target health
2. Verify application is listening on the expected port
3. Check security groups
4. Check target response
5. Review ALB access logs
6. Review application logs
7. Test the target directly
8. Check health-check configuration
```

Example commands may include:

```bash
ss -lntp
curl -v http://127.0.0.1:8080/
curl -v http://TARGET_PRIVATE_IP:8080/
```

## Ollama API

Non-streaming request:

```bash
curl http://localhost:11434/api/generate \
  -d '{
    "model": "devops-qwen",
    "prompt": "How do I check disk usage in Linux?",
    "stream": false
  }'
```

Streaming request:

```bash
curl http://localhost:11434/api/generate \
  -d '{
    "model": "devops-qwen",
    "prompt": "How do I troubleshoot Kubernetes CrashLoopBackOff?",
    "stream": true
  }'
```

## llama.cpp

The GGUF model can also be used with llama.cpp:

```bash
./llama-cli \
  -m qwen-devops-q4_k_m.gguf
```

## Recommended Generation Parameters

For technical and DevOps questions:

```text
temperature     = 0.2
top_k           = 20
top_p           = 0.9
repeat_penalty  = 1.1
context         = 4096
```

Lower temperature is used to encourage more deterministic and consistent technical responses.

## Fine-Tuning vs RAG

This model should not be considered a replacement for RAG.

Fine-tuning is useful for:

* Response style
* Domain behavior
* Task patterns
* DevOps troubleshooting patterns
* Command-oriented responses

RAG is useful for:

* Company documentation
* Current infrastructure information
* Internal runbooks
* AWS architecture documentation
* Frequently changing configuration
* Private knowledge bases

Recommended architecture:

```text
User
 |
 v
Chat UI
 |
 v
n8n / FastAPI
 |
 v
RAG Retriever
 |
 v
Vector Database
 |
 v
Relevant DevOps Documents
 |
 v
Context
 |
 v
devops-qwen
 |
 v
Final Answer
```

## Intended Use

This model is intended for:

* DevOps assistants
* Cloud troubleshooting assistants
* Linux support
* Infrastructure automation
* CI/CD assistance
* Kubernetes troubleshooting
* Terraform assistance
* Internal technical assistants
* RAG-based DevOps assistants

## Limitations

The model is relatively small at approximately 3B parameters.

It may:

* Make incorrect technical assumptions
* Produce outdated information
* Generate commands that require environment-specific changes
* Fail on complex infrastructure architecture
* Require RAG or external tools for current infrastructure information

Always verify commands before running them in production.

For production environments, use appropriate:

* Backups
* Change management
* Testing
* Access controls
* Approval processes

## Security

Do not provide the model with:

* AWS access keys
* Private SSH keys
* Passwords
* API tokens
* Database credentials
* TLS private keys
* Other secrets

When integrating this model with automation, use least-privilege credentials and approval controls for destructive operations.

## Project Pipeline

```text
DevOps Dataset
      |
      v
JSONL Validation
      |
      v
Train / Validation Split
      |
      v
Qwen2.5-3B-Instruct
      |
      v
LoRA Fine-Tuning
      |
      v
LoRA Adapter
      |
      v
Merge
      |
      v
Merged Model
      |
      v
GGUF F16
      |
      v
Q4_K_M
      |
      v
Ollama
      |
      v
devops-qwen
      |
      v
API / n8n / RAG
```

## Benchmark

The project includes an automated benchmark comparing:

```text
qwen2.5:3b
       VS
devops-qwen
```

The benchmark contains 10 DevOps questions covering:

* Linux
* AWS ALB
* Docker
* CPU/RAM
* Disk usage
* Terraform
* Kubernetes
* HTTP
* Production troubleshooting

Benchmark output:

```text
benchmark_results.json
```

## Model Card Summary

```text
Model:
DevOps Qwen

Base:
Qwen2.5-3B-Instruct

Fine-Tuning:
LoRA

Format:
GGUF

Quantization:
Q4_K_M

Size:
~1.9 GB

Runtime:
Ollama / llama.cpp

Domain:
DevOps / Cloud / Infrastructure

Recommended:
CPU local inference + RAG
```

## License

This model is derived from Qwen2.5-3B-Instruct.

Users should review and comply with the applicable Qwen model license and its terms before using or redistributing this model, particularly for commercial use.

The fine-tuning dataset and any additional project components may have their own applicable terms.

## Disclaimer

This model is an experimental DevOps-focused AI assistant. It is not a substitute for production change-control procedures or expert review.

Always validate generated commands and infrastructure changes before applying them to production systems.