InukaLM-LLM-Tutor

An educational LLM fine-tuning project focused on explaining large language models and AI engineering concepts.

InukaLM-LLM-Tutor is an experimental, parameter-efficient fine-tuning project based on Qwen2.5-3B-Instruct. It was developed to demonstrate how an existing large language model can be adapted to a specialized educational task without training an entire model from scratch.

The project explores supervised fine-tuning using Low-Rank Adaptation (LoRA), with a small curated dataset of question-and-answer examples covering foundational LLM concepts.

Model Details

  • Model name: InukaLM-LLM-Tutor
  • Base model: Qwen/Qwen2.5-3B-Instruct
  • Model type: Causal language model with a LoRA adapter
  • Fine-tuning method: Parameter-Efficient Fine-Tuning (PEFT) using LoRA
  • Training approach: Supervised fine-tuning on formatted conversational examples
  • Training environment: Google Colab
  • GPU: NVIDIA Tesla T4
  • Dataset size: 22 curated training examples
  • Training duration: 3 epochs
  • Reported final training loss: Approximately 3.17

The reported loss is a training metric, not a measure of factual accuracy or proof that the model outperforms its base model.

Intended Use

InukaLM-LLM-Tutor is intended for:

  • Demonstrating how LLM fine-tuning works.
  • Exploring tokens, tokenization, and embeddings.
  • Learning about transformers and self-attention.
  • Understanding queries, keys, and values in attention mechanisms.
  • Introducing pretraining, supervised fine-tuning, LoRA, and QLoRA.
  • Discussing prompt engineering, retrieval-augmented generation (RAG), evaluation, and hallucinations.
  • Supporting educational demonstrations and AI engineering presentations.

Training Procedure

The model was adapted using the following workflow:

  1. Load the pretrained Qwen2.5-3B-Instruct model and tokenizer.
  2. Load the base model in 4-bit precision to reduce memory requirements.
  3. Prepare the model for parameter-efficient fine-tuning.
  4. Configure LoRA adapters on selected attention and feed-forward projection modules.
  5. Format 22 curated question-and-answer examples using the model's conversational template.
  6. Tokenize the dataset and train for three epochs.
  7. Save the trained adapter and tokenizer files.
  8. Upload the adapter to Hugging Face.

Training Configuration

Parameter Value
LoRA rank (r) 16
LoRA alpha 32
LoRA dropout 0.05
Learning rate 0.0002
Epochs 3
Batch size per device 1
Gradient accumulation steps 8
Maximum sequence length 512 tokens
Training precision FP16 training with a 4-bit quantized base model

The training dataset is small and was designed for a learning demonstration rather than broad domain coverage.

How to Use the Adapter

Install the required libraries:

pip install -U transformers peft accelerate bitsandbytes torch

Load the base model and adapter:

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel

base_model_id = "Qwen/Qwen2.5-3B-Instruct"
adapter_id = "ai-with-ramadhan/InukaLM-LLM-Tutor"

quant_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.float16,
    bnb_4bit_use_double_quant=True,
)

tokenizer = AutoTokenizer.from_pretrained(adapter_id)

base_model = AutoModelForCausalLM.from_pretrained(
    base_model_id,
    quantization_config=quant_config,
    device_map="auto",
)

model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()

messages = [
    {
        "role": "system",
        "content": "You are an AI engineering tutor. Explain concepts clearly and accurately."
    },
    {
        "role": "user",
        "content": "Explain self-attention in a transformer to a beginner."
    }
]

inputs = tokenizer.apply_chat_template(
    messages,
    tokenize=True,
    add_generation_prompt=True,
    return_tensors="pt",
    return_dict=True,
).to(model.device)

with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=200,
        do_sample=False,
    )

new_tokens = outputs[0][inputs["input_ids"].shape[-1]:]
print(tokenizer.decode(new_tokens, skip_special_tokens=True))

Replace YOUR_HUGGINGFACE_USERNAME with the account that owns this repository. A compatible GPU environment is recommended for practical inference with this base model. Exact memory requirements depend on the runtime and configuration.

Evaluation

The model completed its initial fine-tuning run with a reported training loss of approximately 3.17.

This is an initial development result, not a comprehensive evaluation. No independent benchmark or controlled comparison has yet been established in this model card.

Future evaluation should compare the fine-tuned adapter with the original base model on held-out questions, checking factual correctness, clarity, relevance, consistency, and hallucination rates.

Limitations and Risks

  • The training dataset contains only 22 examples and covers a narrow range of concepts.
  • The model may produce incorrect, incomplete, outdated, or misleading answers.
  • Fine-tuning does not guarantee improved performance over the base model.
  • The model has not been comprehensively benchmarked or independently evaluated.
  • Training examples may not represent the full range of learner needs or backgrounds.
  • Generated answers should be reviewed before being used as authoritative educational material.
  • This project is experimental and is not intended for high-stakes decisions.

License and Attribution

This repository contains a LoRA adapter based on Qwen2.5-3B-Instruct. Refer to the base model repository for its model card, license, and usage conditions.

The repository's license metadata should accurately reflect the applicable terms for the adapter, training materials, and any redistributed files.

Acknowledgements

Thanks to the Qwen team for releasing the base model and to the open-source communities behind Transformers, PEFT, Accelerate, and bitsandbytes.

Project goal: To make the mechanics of LLM fine-tuning easier to understand through a practical, reproducible learning experiment.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ai-with-ramadhan/InukaLM-LLM-Tutor

Base model

Qwen/Qwen2.5-3B
Adapter
(1434)
this model