DungeonGPT — Tiny SFT GPT (Experiment 02)
Full Supervised Fine-Tuning (with prompt-token loss masking, ignore_index=-100) of the 4.27M-parameter pretrained purplejedi/dungeongpt-tiny-pretrain model on three-constraint fantasy RPG scene prompts, exported to native Hugging Face GPT2LMHeadModel safetensors format.
Provenance
- Source Repository:
sriramrathinavelu/DungeonGPT - Git Commit SHA:
c8b4386c6360139b6825d25f8e49be9640735eda - Notebook:
notebooks/02_sft.ipynb - Base Model:
purplejedi/dungeongpt-tiny-pretrain(pretrained_epoch_13) - SFT Splits:
train=4500,val=250,test=250(train.jsonlSHA-256732a7f4bf44b882e966ecec109926b24c0583e45ebe4e7581b81bdc19e85ebed,val.jsonlSHA-25629d6bf91629a57f5fa0871d6c3fb6c98f7b21d27e5c2da9eef5711274705454c) - Weights & Biases Run: https://wandb.ai/chillyskywalker/dungeongpt/runs/gsslyk3k
- Hardware:
Tesla T4
Evaluation Metrics (50 Held-Out Validation Prompts, seed=42, temperature=0.3)
| Metric | Pretrained Base (Exp 01) | Tiny SFT (Exp 02) |
|---|---|---|
| Best SFT Epoch / Val Loss (PPL) | — | Epoch 2 / 0.3514 (1.42) |
| Individual Constraint Accuracy | 2.7% | 89.3% |
| All Three Constraints Satisfied | 0.0% | 76.0% |
Scene Completion Rate (<|scene_end|>) | 4.0% | 100.0% |
Known Limitations
- Trained on synthetic phrasing from
CJJones/RPG_Scenes_LLM_Synthetic(~4.27M parameters); generalizes strongly to in-distribution constraints but collapses toward memorized templates on out-of-distribution concepts.
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "purplejedi/dungeongpt-tiny-sft"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
instruction = "Imagine a scene with Underdark Caverns, A cleric on a divine quest, and a small box that hums in moonlight. Describe it."
prompt = f"### Instruction:
{instruction}
### Scene:
<|scene_start|>"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=150,
do_sample=True,
temperature=0.3,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.pad_token_id,
)
print(tokenizer.decode(output_ids[0], skip_special_tokens=False))