Views
No views yet
| Field | Value |
|---|---|
| Developed by | nvikou (Nel Nelson) |
| Model type | LoRA adapters (PEFT) |
| Base model | unsloth/llama-3-8b-Instruct-bnb-4bit (LLaMA 3 8B Instruct, 4-bit) |
| Language | English |
| License | LLaMA 3 community license (inherits from base model) |
| Framework | PEFT / Transformers / Unsloth |
| Intended task | Document-grounded QA on a PhD abstract |
| Hyperparameter | Value |
|---|---|
| Method | QLoRA + SFT |
Rank r | 16 |
lora_alpha | 16 |
lora_dropout | 0.05 |
| Target modules | q_proj, v_proj |
| Trainable params | ≈ 0.08% of base model |
| Epochs | 10 |
| Effective batch size | 16 (2 × 8 grad accumulation) |
| Learning rate | 2e-4 |
| Max sequence length | 8192 |
| Max new tokens (eval) | 256 |
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5base_id = "unsloth/llama-3-8b-Instruct-bnb-4bit"
6adapter_id = "nvikou/llama3-phd-abstract-qa-en"
7
8tokenizer = AutoTokenizer.from_pretrained(base_id)
9base_model = AutoModelForCausalLM.from_pretrained(
10 base_id,
11 device_map="auto",
12 torch_dtype=torch.float16,
13)
14model = PeftModel.from_pretrained(base_model, adapter_id)
15model.eval()
16
17system_prompt = (
18 "You are a professional consultant for a dissertation / abstract text. "
19 "Answer strictly based on the document content, clearly and to the point. "
20 "Answer in English!"
21)
22
23question = "What is the practical significance of the research results?"
24
25messages = [
26 {"role": "system", "content": system_prompt},
27 {"role": "user", "content": question},
28]
29
30prompt = tokenizer.apply_chat_template(
31 messages,
32 tokenize=False,
33 add_generation_prompt=True,
34)
35inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
36
37with torch.no_grad():
38 outputs = model.generate(
39 **inputs,
40 max_new_tokens=256,
41 do_sample=False,
42 )
43
44answer = tokenizer.decode(
45 outputs[0][inputs["input_ids"].shape[-1]:],
46 skip_special_tokens=True,
47)
48print(answer)1@misc{nvikou2026llama3phdabstractqaen,
2 author = {Nelson, Nel},
3 title = {LLaMA 3 LoRA for PhD Abstract QA (English)},
4 year = {2026},
5 publisher = {Hugging Face},
6 howpublished = {\url{https://huggingface.co/nvikou/llama3-phd-abstract-qa-en}}
7}