Downloads · 30 days
15
17% of all-time downloads
rishitt/control-extraction-qwen-model
control-extraction-qwen-model is a text generation model from rishitt. Use it when you need the model to write or continue text. It is set up for peft.
A fine-tuned LoRA adapter for Qwen2.5-7B-Instruct specifically designed for accurate extraction of security controls from NIST framework documents. This model eliminates hallucination issues present in the base model,…
Downloads · 30 days
15
17% of all-time downloads
All-time downloads
86
Public
Repo size
17.6 GB
Likes
1
Public
Click a slice to open those files.
.safetensors13.2 GB · 99%
From the Hugging Face model README
A fine-tuned LoRA adapter for Qwen2.5-7B-Instruct specifically designed for accurate extraction of security controls from NIST framework documents. This model eliminates hallucination issues present in the base model, ensuring precise identification of controls without mistaking control enhancements or related text as valid controls.
<END> token for reliable parsingThis LoRA adapter enhances the Qwen2.5-7B-Instruct model for the specialized task of extracting security controls from compliance framework documents. The adapter was trained using a custom weighted loss function that penalizes false positives more heavily than false negatives, addressing the critical requirement in compliance auditing where incorrectly identifying a control is more problematic than missing one.
| Property | Value |
|---|---|
| Developed by | Rishit Sharma |
| Model Type | LoRA Adapter (PEFT) |
| Base Model | Qwen/Qwen2.5-7B-Instruct |
| Language | English |
| Domain | Compliance & Regulatory Frameworks |
| License | Proprietary - No use allowed without prior permission |
| Parameter | Value |
|---|---|
| Rank (r) | 16 |
| Alpha | 32 |
| Dropout | 0.05 |
| Target Modules | q_proj, k_proj, v_proj, o_proj |
| Bias | None |
| Task Type | CAUSAL_LM |
| Parameter | Value |
|---|---|
| Quantization | 4-bit (QLoRA) |
| Quant Type | NF4 |
| Double Quantization | Enabled |
| Compute Dtype | bfloat16 |
<END>: Custom stop token appended to outputs for reliable generation terminationBuilding autonomous compliance auditing agents that can:
pip install transformers peft torch accelerate bitsandbytes
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
import torch
# Quantization config (optional, for memory efficiency)
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-7B-Instruct",
quantization_config=bnb_config,
device_map="auto",
trust_remote_code=True
)
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("path/to/final_adapter")
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "path/to/final_adapter")
system_prompt = """You are a senior Compliance Auditor and Regulatory Analyst specialized in ISO, NIST, and statutory frameworks."""
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": f"Analyze this text:\n\n{page_text}"}
]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
outputs = model.generate(
input_ids,
max_new_tokens=512,
temperature=0.1,
do_sample=False
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
[
{
"control_id": "AC-1",
"control_title": "Access Control Policy and Procedures",
"control_desc": "Description of the control..."
}
]
<END>
| Parameter | Value |
|---|---|
| Hardware | NVIDIA RTX 5070 Ti |
| Training Time | ~1 hour |
| Epochs | 14 (with early stopping) |
| Batch Size | 1 (effective: 8 with gradient accumulation) |
| Learning Rate | 1e-5 |
| Optimizer | Paged AdamW 8-bit |
| LR Scheduler | Cosine |
| Warmup Ratio | 0.05 |
| Max Gradient Norm | 0.3 |
| Precision | FP16 |
A Weighted Loss Trainer was implemented to address the asymmetric cost of errors in compliance:
# Samples with controls are weighted 2x during loss computation
weights = torch.where(has_control, 2.0, 1.0)
weighted_loss = (sample_loss * weights).mean()
| Metric | Base Qwen2.5-7B | This Adapter |
|---|---|---|
| Processing Time (492 pages) | ~27 minutes | ~15 minutes |
| Hallucination Rate | High | Minimal |
| Control Enhancement Confusion | Frequent | Resolved |
Proprietary License - This model is not available for public use without explicit prior permission from the developer.
For licensing inquiries, please contact via the channels below.
| Channel | Link |
|---|---|
| rishitshar36@gmail.com | |
| GitHub | github.com/rishit836 |
| Project Repository | control-extraction-using-llm-finetuned |
If you use this model in your research or project, please cite:
@misc{sharma2026nist-control-extraction,
title={NIST Control Extraction LoRA Adapter for Qwen2.5-7B},
author={Sharma, Rishit},
year={2026},
publisher={GitHub},
howpublished={\url{https://github.com/rishit836/control-extraction-using-llm-finetuned}}
}