| --- |
| license: apache-2.0 |
| base_model: google/gemma-4-E2B-it-qat-q4_0-unquantized |
| tags: |
| - dgmc |
| - winogrande |
| - gemma |
| - commonsense-reasoning |
| - pytorch |
| datasets: |
| - allenai/winogrande |
| metrics: |
| - accuracy |
| - f1 |
| --- |
| |
| # Gemma + DGMC (Dual-Gated Memory Consolidation) — fine-tuned on WinoGrande |
|
|
| Adapter DGMC (Dual-Gated Memory Consolidation) huấn luyện trên bộ dữ liệu |
| [WinoGrande](https://huggingface.co/datasets/allenai/winogrande) (config |
| `winogrande_debiased`), gắn thêm vào mô hình nền tảng **đóng băng hoàn toàn** |
| `google/gemma-4-E2B-it-qat-q4_0-unquantized`. Chỉ các tham số của module DGMC được huấn luyện |
| (28.3M tham số). |
|
|
| WinoGrande (Sakaguchi et al., 2019) là bộ dữ liệu commonsense reasoning kiểu |
| Winograd Schema Challenge, được khử bias bằng thuật toán AFLITE. |
|
|
| ## Kết quả |
|
|
| Đánh giá trên validation split (test split không có nhãn công khai), bằng phương |
| pháp so sánh logit(' A') vs logit(' B') — xem notebook để biết chi tiết khác biệt |
| so với cách chấm điểm log-likelihood gốc của WinoGrande. |
|
|
| | Model | Method | Trainable Params | Accuracy | F1 Macro | |
| |---|---|---|---|---| |
| | Gemma (Zero-Shot) | Next-token logit scoring | 0 | 56.83% | 0.5468 | |
| | Gemma + DGMC | DGMC fine-tuned (LM) | 28.3M | 57.70% | 0.5763 | |
|
|
| Cải thiện: **+0.87 điểm phần trăm** so với zero-shot. |
|
|
| ## Cấu hình DGMC |
|
|
| - `block_size`: 64 |
| - `memory_dim`: 1536 |
| - `decay_alpha`: 0.1 |
|
|
| ## Cách sử dụng |
|
|
| Tải file `dgmc_winogrande_weights.pt` rồi load lại vào module DGMC tương ứng với |
| kiến trúc trong notebook huấn luyện gốc: |
|
|
| ```python |
| import torch |
| ckpt = torch.load("dgmc_winogrande_weights.pt", map_location="cpu") |
| dgmc.load_state_dict(ckpt["dgmc_state_dict"]) |
| ``` |
|
|
| Model nền tảng `google/gemma-4-E2B-it-qat-q4_0-unquantized` cần được tải riêng và giữ đóng băng (frozen); |
| adapter DGMC này chỉ bổ sung một module memory consolidation nhẹ, không thay |
| thế attention gốc của model. |
|
|
| ## Huấn luyện |
|
|
| - Dataset: WinoGrande (winogrande_debiased) |
| - Epochs: 10 |
| - Learning rate: 0.0002 |
| - Gradient accumulation steps: 16 |
| - Max sequence length: 256 |
| |