Views
No views yet
Release Status:RELEASED(PRODUCTION AUTHORIZED)
Hardware: NVIDIA Tesla T4 | Base Model:Qwen/Qwen3-4B-Base
Evaluation Verdict:ADAPTER BETTER(+20.10% Formatting, +67.01% Keyword Alignment, -94.12% Degenerate Repetition)
Qwen/Qwen3-4B-Base, fine-tuned across 13 core technical domains and validated on the 500-case frozen benchmark-v1.0 suite.qwen3-4b-qlora-v1.0Qwen3ForCausalLM + LoRA ($r=16, \alpha=32$, 7 linear projection targets)checkpoint-15 (Validation loss: 0.2859, Perplexity: 1.33)dataset-v1.0 (FROZEN, 39 training records, 0 cross-split leakage)benchmark-v1.0 (FROZEN, 500 independent cases)| Metric | Base Model (Qwen3-4B-Base) | Fine-Tuned Adapter (qwen3-4b-qlora-v1.0) | Delta |
|---|---|---|---|
| Validity Rate | 98.60% | 99.80% | +1.20% |
| Formatting Score | 0.7842 | 0.9418 | +20.10% |
| Keyword Overlap | 0.4128 | 0.6894 | +67.01% |
| Repetition Ratio | 0.0412 | 0.0128 | -68.93% |
| Repeated Lines Rate | 3.40% | 0.20% | -94.12% |
| Mean Inference Latency | 2.1420s | 2.1950s | +2.47% overhead |
| Peak GPU VRAM | 6.12 GB | 6.48 GB | 8.08 GB T4 Headroom |
| Case Distribution | — | 393 Improved / 99 Unchanged / 8 Regressed | 78.6% Net Gain |
benchmark-v1.0. Exactly 8 cases (1.6%) exhibited minor regressions (primarily brevity in formal mathematical step derivations and concise logic proofs).1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
3from peft import PeftModel
4
5base_model_id = "Qwen/Qwen3-4B-Base"
6adapter_dir = "releases/qwen3-4b-qlora-v1.0/adapter"
7
8# 1. Configure 4-bit NF4 Quantization
9bnb_config = BitsAndBytesConfig(
10 load_in_4bit=True,
11 bnb_4bit_quant_type="nf4",
12 bnb_4bit_use_double_quant=True,
13 bnb_4bit_compute_dtype=torch.float16,
14)
15
16# 2. Load Base Model and Tokenizer
17tokenizer = AutoTokenizer.from_pretrained(base_model_id, trust_remote_code=True)
18base_model = AutoModelForCausalLM.from_pretrained(
19 base_model_id,
20 quantization_config=bnb_config,
21 device_map="auto",
22 trust_remote_code=True,
23)
24
25# 3. Mount LoRA Adapter
26model = PeftModel.from_pretrained(base_model, adapter_dir)
27model.eval()
28
29# 4. Generate Response using ChatML Template
30messages = [
31 {"role": "system", "content": "You are a helpful, precision-driven technical assistant."},
32 {"role": "user", "content": "Write a Python context manager for atomic file writing."},
33]
34prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
35inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
36
37with torch.no_grad():
38 outputs = model.generate(
39 **inputs,
40 max_new_tokens=512,
41 temperature=0.0,
42 do_sample=False,
43 )
44response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
45print(response)python scripts/validate_final_release.py --release releases/qwen3-4b-qlora-v1.0