Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: peft
|
| 3 |
+
base_model: Qwen/Qwen3.5-2B
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
tags:
|
| 6 |
+
- qlora
|
| 7 |
+
- 4bit
|
| 8 |
+
- low-resource
|
| 9 |
+
- arc-challenge
|
| 10 |
+
- gsm8k
|
| 11 |
+
- science
|
| 12 |
+
- math
|
| 13 |
+
- reasoning
|
| 14 |
+
datasets:
|
| 15 |
+
- custom
|
| 16 |
+
language:
|
| 17 |
+
- en
|
| 18 |
+
pipeline_tag: text-generation
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# AVA v2
|
| 22 |
+
|
| 23 |
+
AVA v2 is a QLoRA fine-tune of [Qwen/Qwen3.5-2B](https://huggingface.co/Qwen/Qwen3.5-2B) that achieves **79% on ARC-Challenge** and **48% on GSM8K** while training and running inference in under 2 GB of VRAM.
|
| 24 |
+
|
| 25 |
+
Trained entirely on a single NVIDIA RTX A2000 Laptop GPU (4 GB VRAM). The adapter is 42 MB.
|
| 26 |
+
|
| 27 |
+
## Results
|
| 28 |
+
|
| 29 |
+
| Benchmark | Qwen3.5-2B Base | AVA v2 | Improvement |
|
| 30 |
+
|---|---|---|---|
|
| 31 |
+
| ARC-Challenge (100) | 66.0% | **79.0%** | +13.0pp |
|
| 32 |
+
| GSM8K (50) | 28.0% | **48.0%** | +20.0pp |
|
| 33 |
+
|
| 34 |
+
### Comparison to Other Small Models
|
| 35 |
+
|
| 36 |
+
| Model | Params | ARC-C | GSM8K |
|
| 37 |
+
|---|---|---|---|
|
| 38 |
+
| Gemma 2 2B | 2.0B | 55.7% | 24.3% |
|
| 39 |
+
| SmolLM2-1.7B-Instruct | 1.7B | ~52% | 48.2% |
|
| 40 |
+
| Llama 3.2 1B-Instruct | 1.0B | 59.4% | 44.4% |
|
| 41 |
+
| Llama 3.2 3B-Instruct | 3.0B | 78.6% | 77.7% |
|
| 42 |
+
| **AVA v2** | **2.0B** | **79.0%** | **48.0%** |
|
| 43 |
+
|
| 44 |
+
AVA v2's ARC-Challenge score at 2B parameters exceeds Llama 3.2 3B-Instruct (78.6% at 3B).
|
| 45 |
+
|
| 46 |
+
## Usage
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
| 50 |
+
from peft import PeftModel
|
| 51 |
+
import torch
|
| 52 |
+
|
| 53 |
+
bnb_config = BitsAndBytesConfig(
|
| 54 |
+
load_in_4bit=True,
|
| 55 |
+
bnb_4bit_quant_type="nf4",
|
| 56 |
+
bnb_4bit_compute_dtype=torch.bfloat16,
|
| 57 |
+
bnb_4bit_use_double_quant=True,
|
| 58 |
+
)
|
| 59 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 60 |
+
"Qwen/Qwen3.5-2B",
|
| 61 |
+
quantization_config=bnb_config,
|
| 62 |
+
device_map="auto",
|
| 63 |
+
dtype=torch.bfloat16,
|
| 64 |
+
attn_implementation="sdpa",
|
| 65 |
+
)
|
| 66 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3.5-2B")
|
| 67 |
+
|
| 68 |
+
model = PeftModel.from_pretrained(model, "NAME0x0/AVA-v2")
|
| 69 |
+
model = model.merge_and_unload()
|
| 70 |
+
|
| 71 |
+
messages = [{"role": "user", "content": "Explain why ice floats on water."}]
|
| 72 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
|
| 73 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 74 |
+
output = model.generate(**inputs, max_new_tokens=512, temperature=0.7, do_sample=True)
|
| 75 |
+
print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
## Training Details
|
| 79 |
+
|
| 80 |
+
- **Method**: QLoRA (4-bit NF4 + LoRA rank 16)
|
| 81 |
+
- **Base model**: Qwen3.5-2B
|
| 82 |
+
- **Training data**: 20,741 prompt-response pairs (math, science, reasoning, instruction following)
|
| 83 |
+
- **Hardware**: NVIDIA RTX A2000 Laptop (4 GB VRAM)
|
| 84 |
+
- **Training time**: 100.5 minutes
|
| 85 |
+
- **Final loss**: 0.4145
|
| 86 |
+
- **Peak VRAM**: 1.81 GB
|
| 87 |
+
- **Trainable params**: 10,911,744 / 1,892,736,832 (0.58%)
|
| 88 |
+
- **Optimizer**: paged_adamw_8bit
|
| 89 |
+
- **LR schedule**: cosine, peak 1.5e-4
|
| 90 |
+
- **Batch size**: 1 (gradient accumulation 8, effective batch 8)
|
| 91 |
+
- **Max sequence length**: 384 tokens
|
| 92 |
+
- **Epochs**: 1
|
| 93 |
+
|
| 94 |
+
## Limitations
|
| 95 |
+
|
| 96 |
+
- Evaluation was run on 100 ARC-Challenge and 50 GSM8K items (not full test sets)
|
| 97 |
+
- Evaluation protocols (shot count, prompting) differ across model comparison sources
|
| 98 |
+
- The model inherits Qwen3.5-2B's base capabilities and limitations
|
| 99 |
+
- Max training sequence length was 384 tokens due to VRAM constraints
|
| 100 |
+
|
| 101 |
+
## Citation
|
| 102 |
+
|
| 103 |
+
```
|
| 104 |
+
@misc{ava-v2-2026,
|
| 105 |
+
title={AVA v2: QLoRA Fine-tuning Under Extreme VRAM Constraints},
|
| 106 |
+
author={Afsah},
|
| 107 |
+
year={2026},
|
| 108 |
+
url={https://github.com/NAME0x0/AVA}
|
| 109 |
+
}
|
| 110 |
+
```
|