File size: 5,299 Bytes
1f05683
ba8e702
 
1f05683
 
ba8e702
1f05683
40b5417
ba8e702
 
 
 
1f05683
 
ba8e702
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4bc4479
ba8e702
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40b5417
ba8e702
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40b5417
 
ba8e702
 
 
 
 
 
 
40b5417
ba8e702
 
 
40b5417
ba8e702
 
 
40b5417
ba8e702
40b5417
 
6afc887
40b5417
ba8e702
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40b5417
ba8e702
40b5417
ba8e702
 
40b5417
ba8e702
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40b5417
 
ba8e702
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40b5417
ba8e702
 
 
 
 
 
 
 
 
40b5417
 
ba8e702
40b5417
ba8e702
40b5417
ba8e702
40b5417
ba8e702
 
 
 
 
 
40b5417
ba8e702
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40b5417
 
 
ba8e702
 
 
40b5417
ba8e702
 
 
 
 
 
40b5417
ba8e702
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
---
license: apache-2.0
base_model: "Qwen/Qwen2.5-Coder-0.5B-Instruct"
library_name: peft
pipeline_tag: text-generation

tags:
  - lora
  - transformers
  - coding
  - code-generation
  - peft
---

# ConicAI Coding LLM

## Model Details

### Model Description

ConicAI LLM Model is a parameter-efficient fine-tuned coding assistant built using LoRA on top of Qwen2.5-Coder. It is designed to generate, debug, and explain code with structured outputs.

* **Developed by:** GIRISH KUMAR DEWANGAN
* **Model type:** Causal Language Model (Code LLM)
* **Language(s):** Python, general programming
* **used for:** Code generation, debugging, fixing error, getting evaluation score, check hallucination and relevancy score as well
* **License:** Apache 2.0
* **Finetuned from model:** Qwen/Qwen2.5-Coder-0.5B-Instruct

---

## Model Sources

* **Repository:** https://huggingface.co/girish00/ConicAI_LLM_model
* **Paper:** [View Paper](./ConicAI_paper.md)

---

## Uses

### Direct Use

* Code generation
* Debugging
* Code explanation
* Learning programming

---

### Downstream Use

* Coding assistants
* AI-based education tools
* Developer productivity tools

---

### Out-of-Scope Use

* Security-critical systems
* Autonomous production systems
* High-risk environments

---

## Bias, Risks, and Limitations

* May generate incorrect logic
* Confidence scores are heuristic
* Output depends on prompt quality
* Limited dataset generalization

---

## Recommendations

* Always validate generated code
* Use structured prompts
* Avoid ambiguous instructions

---
## Structured Output Framework
The model produces outputs in structured JSON format:

```
{
  "code": "...",
  "explanation": "...",
  "confidence": 0.84,
  "relevancy_score": 0.82,
  "hallucination": false
}

```
```text
This enables:

-Easy API integration
-Automated evaluation
-Better interpretability
```
---


## How to Get Started with the Model

```python
!pip -q install -U transformers peft accelerate huggingface_hub safetensors
!pip install --upgrade torchao

from google.colab import userdata
HF_TOKEN = userdata.get('HF_TOKEN')

model = "girish00/ConicAI_LLM_model"
prompt = input("Enter your prompt: ")

from huggingface_hub import login, snapshot_download
login(token=HF_TOKEN)

repo = snapshot_download(model, token=HF_TOKEN)

import sys, os
sys.path.append(repo)

from infer_local import build_instruction_prompt, build_structured_result
from peft import PeftConfig, PeftModel
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch, time, json

cfg = PeftConfig.from_pretrained(repo)
base = cfg.base_model_name_or_path

tokenizer = AutoTokenizer.from_pretrained(base)

base_model = AutoModelForCausalLM.from_pretrained(
    base,
    torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
    device_map="auto"
)

llm = PeftModel.from_pretrained(base_model, repo)
llm.eval()

inputs = tokenizer(build_instruction_prompt(prompt), return_tensors="pt").to(llm.device)

start = time.perf_counter()

with torch.no_grad():
    out = llm.generate(
        **inputs,
        max_new_tokens=320,
        output_scores=True,
        return_dict_in_generate=True,
        do_sample=False,
        pad_token_id=tokenizer.eos_token_id
    )

latency = int((time.perf_counter() - start) * 1000)

gen_ids = out.sequences[0][inputs["input_ids"].shape[1]:].tolist()
text = tokenizer.decode(gen_ids, skip_special_tokens=True)

conf = []
for tid, score in zip(gen_ids, out.scores):
    probs = torch.softmax(score[0], dim=-1)
    conf.append(float(probs[tid].item()))

print(json.dumps(
    build_structured_result(
        prompt,
        text,
        latency,
        tokenizer=tokenizer,
        generated_ids=gen_ids,
        token_confidences=conf
    ),
    indent=2
))
```

---

## 📊 Benchmark Results

![Benchmark](./benchmark.png)

---

## Training Details

### Dataset

* Size: ~5K samples
* Instruction-based coding dataset

### Training Procedure

* Method: LoRA fine-tuning
* Framework: Transformers + PEFT
* Precision: FP16 / Mixed

### Training Hyperparameters

| Parameter           | Value |
| ------------------- | ----- |
| Epochs              | 1–3   |
| Batch Size          | 2     |
| Learning Rate       | 2e-4  |
| Max Sequence Length | 512   |
| LoRA Rank (r)       | 8     |
| LoRA Alpha          | 16    |
| LoRA Dropout        | 0.05  |

---

## Inference Configuration

```text
max_new_tokens = 200
temperature = 0.2
top_p = 0.9
do_sample = True
```

---

## Evaluation

### Metrics

* Code correctness
* Syntax validity
* Relevancy score
* Hallucination rate
* Confidence score
* Latency

---

### Results Summary

* Higher correctness vs base model
* Lower hallucination rate
* Better structured outputs

---

## Technical Specifications

### Architecture

* Transformer-based causal LM
* LoRA adaptation

---

### Hardware

* GPU recommended (optional)
* CPU supported

---

### Software

* Transformers
* PEFT
* PyTorch

---

## Environmental Impact

* Low compute due to LoRA
* Efficient fine-tuning

---

## Citation

**BibTeX:**

```text
@misc{conicai_llm,
  author = {Girish},
  title = {ConicAI Coding LLM},
  year = {2026},
  publisher = {Hugging Face}
}
```

---

## Model Card Authors

GIRISH KUMAR DEWANGAN

---


### Framework versions

* PEFT 0.19.0