Qwen2.5-14B-LoRA-NYCU-DL-HW2
Model Description
This model is a Supervised Task Finetuned (SFT) version of Qwen2.5-14B-Instruct, specifically trained with reasoning information (Chain-of-Thought) to tackle complex multiple-choice questions.
It was developed as part of the Deep Learning HW2 coursework at National Yang Ming Chiao Tung University (NYCU).
- Developed by: 謝宗穎(Zong-Ying Shieh) 314706019
- Base Model:
unsloth/Qwen2.5-14B-Instruct-bnb-4bit
- Task: Multiple-Choice Question Answering & Logical Reasoning
- Language(s): Traditional Chinese (zh-TW), English
- License: Apache 2.0
Performance
- Kaggle Public Leaderboard Score:
0.72340
- Evaluation Method: The reported score is achieved by coupling this SFT model with a highly optimized Test-Time Compute inference strategy: 3-Pass Self-Consistency (SC) combined with Softmax Logits Soft-Voting.
How to Use (Inference)
To achieve the maximum performance, it is highly recommended to use the Logits Extraction method rather than standard text generation. Below is a basic snippet to load the model using unsloth:
1from unsloth import FastLanguageModel
2import torch
3
4model, tokenizer = FastLanguageModel.from_pretrained(
5 model_name = "tony-shieh/Qwen2.5-14B-LoRA-NYCU-DL-HW2",
6 max_seq_length = 4096,
7 dtype = None,
8 load_in_4bit = True
9)
10FastLanguageModel.for_inference(model)
System Prompt used during training
SYSTEM_PROMPT = "你是一個專業且中立的選擇題解題專家。請針對題目進行嚴密的邏輯推理,客觀分析每個選項,最後明確給出你的答案。"
Training Details
Hardware & Environment
- Hardware: 1x NVIDIA GeForce RTX 5090 (32GB VRAM)
- raining Framework: unsloth, trl, transformers
- Memory Optimization: Overcame Out-of-Memory (OOM) constraints on a single 32GB GPU by utilizing PyTorch's expandable_segments:True, drastically reducing the per_device_train_batch_size to 1, and compensating with gradient_accumulation_steps=16 to maintain a stable effective batch size.
Hyperparameters
LoRA Rank (r): 32
LoRA Alpha: 64
Target Modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
Epochs: 2 (To prevent catastrophic forgetting and overfitting on the public LB)
Learning Rate: 1e-4
Optimizer: adamw_8bit
Inference Strategy
The true potential of this model is unlocked during the inference phase. Instead of relying on vulnerable Regex text parsing, the final submission utilizes:
-
Dynamic Chain-of-Thought (do_sample=True, temp=0.6): Forcing the model to explore 3 distinct reasoning paths for the same question.
-
Logits Soft-Voting: Extracting the raw neural network logits for tokens A, B, C, and D at the final layer, normalizing them via Softmax into confidence probabilities, and accumulating these scores across the 3 iterations. This effectively mitigates the 14B model's "hallucination" and locks in the most logically sound answer.