--- base_model: unsloth/Qwen2.5-7B-Instruct-bnb-4bit library_name: peft tags: - lora - qwen2.5 - cyber-investigation - cyber-investigator - filipino - taglish language: - en - fil license: other --- # Cybercop AI A LoRA adapter that turns **Qwen2.5-7B-Instruct (4-bit)** into a focused **cyber-investigation assistant** — trained to produce structured, procedure-oriented responses for cybercrime / online-scam / digital-forensics triage and reporting, in **English and Taglish**. > **Intended use:** Exclusive internal use as an investigative-aid assistant. The adapter is a decision-support tool, not an authority — all outputs must be reviewed by a qualified human investigator before any action. ## Model details | Field | Value | |---|---| | Base model | `unsloth/Qwen2.5-7B-Instruct-bnb-4bit` | | Adapter type | LoRA (PEFT) | | LoRA rank `r` | 16 | | LoRA alpha | 32 | | LoRA dropout | 0.05 | | Target modules | `q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj` | | Precision | 4-bit base (bitsandbytes NF4) + bf16 training | | Training data | `jhenberthf/cyber-investigator` (Alpaca format, 99 rows) | | Epochs | 2 | | Max sequence length | 512 | | Trainable params | ~40.4M (0.53% of base) | ## Usage > **Prompt format (important):** the adapter was trained on Alpaca-format > (`### Instruction / ### Input / ### Response`) text. Wrap that text inside a > single Qwen chat-template user turn — do **not** feed raw Alpaca text, or the > base Instruct model will echo the instruction and drift off-topic. ```python import torch from peft import PeftModel from transformers import AutoModelForCausalLM, AutoTokenizer base = "unsloth/Qwen2.5-7B-Instruct-bnb-4bit" adapter = "jhenberthf/cybercop-ai" # local path or "jhenberthf/cybercop-ai" tokenizer = AutoTokenizer.from_pretrained(base) if tokenizer.pad_token is None: tokenizer.pad_token = tokenizer.eos_token model = AutoModelForCausalLM.from_pretrained( base, device_map={"": "cuda:0"}, torch_dtype=torch.bfloat16 ) model = PeftModel.from_pretrained(model, adapter) model.eval() instruction = ("You are a cyber-investigation assistant. Given a complaint, " "classify the likely cybercrime type, list immediate preservation " "steps, and outline the next investigative actions.") inp = ("Victim reports being tricked into sending PHP 50,000 via GCash to a " "suspect after a 'customer service' impostor promised a refund for a " "purchase that was never delivered. The suspect account is now inactive.") # Alpaca-format text wrapped as a single chat user turn alpaca = f"### Instruction:\n{instruction}\n\n### Input:\n{inp}\n\n### Response:\n" prompt = tokenizer.apply_chat_template( [{"role": "user", "content": alpaca}], tokenize=False, add_generation_prompt=True, ) inputs = tokenizer(prompt, return_tensors="pt").to(model.device) out = model.generate( **inputs, max_new_tokens=512, do_sample=False, temperature=1.0, repetition_penalty=1.05, ) text = tokenizer.decode(out[0], skip_special_tokens=True) # strip the prompt prefix, keep only the generated Response gen = text[len(tokenizer.decode(inputs["input_ids"][0], skip_special_tokens=False)):] resp = gen.split("### Response:")[-1].strip() if "### Response:" in gen else gen.strip() print(resp) ``` ## Training notes - Trained locally on a single consumer GPU (RTX 3050 6GB) via QLoRA. - The dataset is small (99 curated examples); the adapter specializes tone, structure, and procedure rather than broad world knowledge. - Validation was light (no held-out split). Treat outputs as draft material. ## Limitations & caveats - **Not legal/operative authority.** Outputs are suggestions; verify against current procedure before acting. - **Possible hallucination** on unfamiliar schemes, jurisdictions, or technical specifics — always corroborate. - Small training set → limited coverage; may underperform on domains absent from the source data. - LoRA only modifies a tiny fraction of weights; base-model limitations (bias, knowledge cutoff) still apply. - 4-bit base can reduce factual precision vs. a full-precision model. ## Responsible use - Keep a human in the loop for any investigative or evidentiary decision. - Do not present outputs as final findings without review. - Red-team for leakage of operational detail before deployment. ## License Adapter weights released under a restrictive/internal-use understanding. Base model terms from `unsloth/Qwen2.5-7B-Instruct-bnb-4bit` and Qwen2.5 apply to the underlying weights.