Text Generation
PEFT
Safetensors
code
code-review
security
qwen2.5-coder
lora
bad-theory-labs
conversational
Instructions to use affableiq/btl-2-coder-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use affableiq/btl-2-coder-7B with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/qwen2.5-coder-7b-instruct-bnb-4bit") model = PeftModel.from_pretrained(base_model, "affableiq/btl-2-coder-7B") - Notebooks
- Google Colab
- Kaggle
Release btl-2-coder-7B api4k-template1k LoRA adapter
Browse filesFiles changed (9)
- .gitattributes+1
- README.mdAdded+98
- SHA256SUMSAdded+8
- adapter_config.jsonAdded+52
- adapter_model.safetensorsAdded+3
- chat_template.jinjaAdded+54
- tokenizer.jsonAdded+3
- tokenizer_config.jsonAdded+202
- training_args.binAdded+3
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -texttokenizer.json filter=lfs diff=lfs merge=lfs -text
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798---license: apache-2.0base_model: unsloth/Qwen2.5-Coder-7B-Instructlibrary_name: peftpipeline_tag: text-generationtags: - code - code-review - security - qwen2.5-coder - lora - bad-theory-labsmodel_name: btl-2-coder-7B---
# BTL-2 Coder 7B
BTL-2 Coder 7B is a LoRA adapter for `unsloth/Qwen2.5-Coder-7B-Instruct`, trained for structured code-review findings.
## Intended Use
Use this model for local-first code review:
- SQL injection- path traversal- authorization bypass- missing error handling- boundary/off-by-one logic- related security and correctness bugs
It is not yet a general autonomous coding agent and should not be marketed as a SWE-Bench repair model.
## Training
- Base: `unsloth/Qwen2.5-Coder-7B-Instruct`- Trainer: Unsloth LoRA SFT- Data: `4,000` API teacher traces + `1,000` template traces- Split: `4,500` train / `500` eval- Epochs: `2`- Max length: `4096`
Only redacted, opt-in traces should be used for future training.
## Prompt
Use strict schema prompting:
```textReturn only a JSON array. No markdown and no wrapper object.Each finding must include: severity, file, line, title, evidence, recommendation, confidence.severity must be exactly one of: critical, high, medium, low.Never put a category in severity.confidence must be a number from 0 to 1, never a string label.Every finding must include concrete evidence and a non-empty recommendation.```
Example output:
```json[ { "severity": "critical", "file": "src/users.ts", "line": 42, "title": "SQL injection through string-built query", "evidence": "The user id is concatenated directly into the SQL string.", "recommendation": "Use a parameterized query.", "confidence": 0.96 }]```
## Evaluation
| Eval | JSON parse | Schema valid | Numeric confidence | Category hit | File hit | Precision | Recall | Weighted severity recall || --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: || Heldout 100 strict | 1.000 | 0.952 | 1.000 | 0.783 | 0.840 | - | - | - || Heldout 30 strict v2 | 1.000 | 0.975 | 1.000 | 0.867 | 0.867 | - | - | - || Seeded 15 strict | 1.000 | 1.000 | 1.000 | 0.933 | 1.000 | 0.933 | 0.933 | 0.956 |
## Limitations
- Strict schema prompting is required for best results.- The model may miss subtle multi-file issues.- The model can produce plausible but incorrect findings; keep human review in the loop.- Do not use on private repositories unless you control the inference environment and data policy.
## Release Artifacts
This Hugging Face repo should include:
- `adapter_model.safetensors`- `adapter_config.json`- `tokenizer.json`- `tokenizer_config.json`- `chat_template.jinja`- `training_args.bin`- this `README.md`12345678a5d81b7fbba4f0a09ec88ca7206d2d25d9dbf141b6f236afe517b7647ea2aa5c README.md74cf19bc8a8e21d384d24026ae06fcba2b0168826ae847d46dff2107cecd0e20 SHA256SUMS755d5b561d039e97ad67b99c75dd1f8312d768f7f1879a120e2fcef33596e274 adapter_config.json8436e2f27afe3726af40373e26bfcb2c764513ff2737067e33d3002c07098ade adapter_model.safetensorscd8e9439f0570856fd70470bf8889ebd8b5d1107207f67a5efb46e342330527f chat_template.jinjaea43b288542655d72d632195ab9b58ca2cd9532c292bf6667827ce899ad196bc tokenizer.json7cd38d182a09f57796af5ef7dbe15c9fa8595fdaa94c5cba9a3065f6e987b1fd tokenizer_config.json5811e0147d545faafa9083e10f21552c17b4e3ae375a37b3c8acd79751833548 training_args.bin12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152{ "alora_invocation_tokens": null, "alpha_pattern": {}, "arrow_config": null, "auto_mapping": { "base_model_class": "Qwen2ForCausalLM", "parent_library": "transformers.models.qwen2.modeling_qwen2", "unsloth_fixed": true }, "base_model_name_or_path": "unsloth/qwen2.5-coder-7b-instruct-bnb-4bit", "bias": "none", "corda_config": null, "ensure_weight_tying": false, "eva_config": null, "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": true, "init_lora_weights": true, "layer_replication": null, "layers_pattern": null, "layers_to_transform": null, "loftq_config": {}, "lora_alpha": 128, "lora_bias": false, "lora_dropout": 0, "lora_ga_config": null, "megatron_config": null, "megatron_core": "megatron.core", "modules_to_save": null, "peft_type": "LORA", "peft_version": "0.19.1", "qalora_group_size": 16, "r": 64, "rank_pattern": {}, "revision": null, "target_modules": [ "up_proj", "q_proj", "o_proj", "down_proj", "gate_proj", "v_proj", "k_proj" ], "target_parameters": null, "task_type": "CAUSAL_LM", "trainable_token_indices": null, "use_bdlora": null, "use_dora": false, "use_qalora": false, "use_rslora": false}123version https://git-lfs.github.com/spec/v1oid sha256:8436e2f27afe3726af40373e26bfcb2c764513ff2737067e33d3002c07098adesize 645975704123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354{%- if tools %} {{- '<|im_start|>system\n' }} {%- if messages[0]['role'] == 'system' %} {{- messages[0]['content'] }} {%- else %} {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }} {%- endif %} {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }} {%- for tool in tools %} {{- "\n" }} {{- tool | tojson }} {%- endfor %} {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}{%- else %} {%- if messages[0]['role'] == 'system' %} {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }} {%- else %} {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }} {%- endif %}{%- endif %}{%- for message in messages %} {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %} {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }} {%- elif message.role == "assistant" %} {{- '<|im_start|>' + message.role }} {%- if message.content %} {{- '\n' + message.content }} {%- endif %} {%- for tool_call in message.tool_calls %} {%- if tool_call.function is defined %} {%- set tool_call = tool_call.function %} {%- endif %} {{- '\n<tool_call>\n{"name": "' }} {{- tool_call.name }} {{- '", "arguments": ' }} {{- tool_call.arguments | tojson }} {{- '}\n</tool_call>' }} {%- endfor %} {{- '<|im_end|>\n' }} {%- elif message.role == "tool" %} {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %} {{- '<|im_start|>user' }} {%- endif %} {{- '\n<tool_response>\n' }} {{- message.content }} {{- '\n</tool_response>' }} {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %} {{- '<|im_end|>\n' }} {%- endif %} {%- endif %}{%- endfor %}{%- if add_generation_prompt %} {{- '<|im_start|>assistant\n' }}{%- endif %}123version https://git-lfs.github.com/spec/v1oid sha256:ea43b288542655d72d632195ab9b58ca2cd9532c292bf6667827ce899ad196bcsize 11422082123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202{ "add_prefix_space": false, "backend": "tokenizers", "bos_token": null, "clean_up_tokenization_spaces": false, "eos_token": "<|im_end|>", "errors": "replace", "extra_special_tokens": [], "is_local": false, "model_max_length": 32768, "pad_token": "<|PAD_TOKEN|>", "padding_side": "right", "split_special_tokens": false, "tokenizer_class": "Qwen2Tokenizer", "unk_token": null, "added_tokens_decoder": { "151643": { "content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151644": { "content": "<|im_start|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151645": { "content": "<|im_end|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151646": { "content": "<|object_ref_start|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151647": { "content": "<|object_ref_end|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151648": { "content": "<|box_start|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151649": { "content": "<|box_end|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151650": { "content": "<|quad_start|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151651": { "content": "<|quad_end|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151652": { "content": "<|vision_start|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151653": { "content": "<|vision_end|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151654": { "content": "<|vision_pad|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151655": { "content": "<|image_pad|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151656": { "content": "<|video_pad|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "151657": { "content": "<tool_call>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "151658": { "content": "</tool_call>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "151659": { "content": "<|fim_prefix|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "151660": { "content": "<|fim_middle|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "151661": { "content": "<|fim_suffix|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "151662": { "content": "<|fim_pad|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "151663": { "content": "<|repo_name|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "151664": { "content": "<|file_sep|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "151665": { "content": "<|PAD_TOKEN|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true } }}123version https://git-lfs.github.com/spec/v1oid sha256:5811e0147d545faafa9083e10f21552c17b4e3ae375a37b3c8acd79751833548size 5265.gitattributes+1
README.mdAdded+98
SHA256SUMSAdded+8
adapter_config.jsonAdded+52
adapter_model.safetensorsAdded+3
chat_template.jinjaAdded+54
tokenizer.jsonAdded+3
tokenizer_config.jsonAdded+202
training_args.binAdded+3