Views
No views yet

⚠️ Portfolio project. Built as a learning exercise to demonstrate a full CPT + LoRA fine-tuning pipeline. Not intended for production use.
ibm-granite/granite-4.0-micro to use FLINT.| Parameter | Value |
|---|---|
| Base model | ibm-granite/granite-4.0-micro |
| Method | Continued Pre-Training (CPT) + LoRA |
| Corpus | Wikipedia (survival domain) |
| LoRA rank (r) | 8 |
| LoRA alpha | 16 |
| Target modules (attention) | q_proj, k_proj, v_proj, o_proj |
| Target modules (MLP) | input_linear, output_linear |
| Max sequence length | 768 |
| Steps | 250–300 |
| Batch size | 1 (grad accum 8) |
| Learning rate | 2e-5 |
| Precision | fp16 |
PeftModelForCausalLM
└── LoraModel
└── GraniteMoeHybridForCausalLM
├── Attention layers
│ └── q_proj: lora.Linear (r=8)
│ └── k_proj: lora.Linear (r=8)
│ └── v_proj: lora.Linear (r=8)
│ └── o_proj: lora.Linear (r=8)
└── MLP layers
└── input_linear: lora.Linear (r=8)
└── output_linear: lora.Linear (r=8)1from transformers import AutoTokenizer, AutoModelForCausalLM
2from peft import PeftModel
3
4# Load base model
5tokenizer = AutoTokenizer.from_pretrained("ibm-granite/granite-4.0-micro")
6model = AutoModelForCausalLM.from_pretrained(
7 "ibm-granite/granite-4.0-micro",
8 device_map = "cpu", # change to "cuda" if GPU available
9)
10
11# Load FLINT adapter on top
12model = PeftModel.from_pretrained(model, "rakhasetiawan/flint-granite-survival")
13model.eval()
14
15# Prompt it like a Wikipedia article opening
16prompt = "Wilderness survival techniques include"
17inputs = tokenizer(prompt, return_tensors="pt")
18
19outputs = model.generate(
20 **inputs,
21 max_new_tokens = 200,
22 temperature = 0.7,
23 do_sample = True,
24)
25print(tokenizer.decode(outputs[0], skip_special_tokens=True))
1"what do i do to prepare for a natural disaster? give me a checklist of items
2to prepare and steps to take"| Item | Specification |
|---|---|
| Water | At least 1 gallon per person per day (drinking + sanitation) |
| Food | 3-day supply of non-perishable items |
| Radio | Battery-powered or hand crank — for news updates |
| Flashlight | With extra batteries |
| First Aid Kit | Including any prescription medications |
| Whistle | To signal for help |
| Dust Mask | To filter contaminated air |
| Plastic Sheeting + Duct Tape | For shelter-in-place scenarios |
| Moist Tissues + Waste Bags | For sanitation |
| Local Maps | In case GPS and navigation systems are down |
| Cell Phone + Chargers | Including a portable backup charger |
| Metric | Result |
|---|---|
| Quantified specifics | ✅ FEMA-accurate (1 gal/day, 72hr window, 3-day supply) |
| Hallucinated terminology | ✅ None detected |
| Format | ✅ Guide/manual style — appropriate for domain |
| Actionability | ✅ High — checklist is directly usable |
| Practitioner depth | ⚠️ Moderate — disaster-specific variations not yet covered |
| Version baseline | First clean hallucination-free output across all eval prompts |
Note: Quantified figures (1 gallon/day, 72-hour window) align with FEMA
standard preparedness guidelines — not hallucinated values.
Practitioner-level depth (disaster-specific kits, document preservation,
post-disaster protocols) is the target for v0.4 with field manual corpus.