athospy's picture
Model card: show a wrong-link example
c408c99 verified
|
Raw History Blame Contribute Delete
4.39 kB
---
license: mit
base_model: microsoft/DialoGPT-small
language:
- en
library_name: transformers
pipeline_tag: text-generation
tags:
- gpt2
- dialogpt
- question-answering
- fine-tuned
---
# DialoGPT-small fine-tuned on Pittsburg State University program Q&A
[microsoft/DialoGPT-small](https://huggingface.co/microsoft/DialoGPT-small) (124M parameters) fine-tuned on
100 question/answer pairs about Pittsburg State University (PSU) academic programs and general topics. A
learning project, built to compare a small fine-tuned generator with retrieval on the same questions.
- **Code, data and eval:** https://github.com/athospy/transformer_chatbot
- **Live demo:** https://chatbot.santiagomorel.dev/. The demo answers by retrieval over sentence embeddings and
shows this model's answer on demand next to it, because of the invented links described below.
## Use
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "athospy/dialogpt-small-psu-programs"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo)
prompt = tokenizer("Tell me about the Art program at Pittsburg State University." + tokenizer.eos_token,
return_tensors="pt")
output = model.generate(**prompt, max_new_tokens=72, num_beams=3, early_stopping=True,
no_repeat_ngram_size=3, repetition_penalty=1.2,
pad_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(output[0, prompt["input_ids"].shape[1]:], skip_special_tokens=True))
```
The input format is `question<eos>`. The model writes the answer and ends it with `<eos>`. The settings above
are the ones the demo and the eval use.
**Check every link it writes.** Even on a question from its own training data it can mix up the URL path:
> **Q:** Tell me about the Ceramics program at Pittsburg State University.
> **A:** The Ceramic program offers various emphases. More details can be found here:
> https://www.pittstate.edu/science/programs/ceramics/index.html
>
> The real page is under `/art/programs/ceramics/`.
## Training
- **Data:** 172 Q&A pairs written in 2024 from PSU's public program pages (100 after removing exact repeats):
56 programs (only A to C, Accelerated Pre-Med through Construction Technology), each answer ending with the
program's official link, plus 26 general questions. Each question was also added with "PSU" and
"Pitt State" in place of the full name.
- **Format:** one sequence per example, `question<eos>answer<eos>`, with the loss on the answer tokens only
(the question positions get the label -100).
- **Setup:** plain PyTorch loop, AdamW (lr 5e-5, weight decay 0.01), batch size 8, linear warmup over the first
10% of steps, gradient clipping 1.0, seed 42. 10% of the distinct pairs held out for validation.
- **Result:** 268 training and 10 validation examples. Early stopping kept epoch 4 of 7, with validation loss
0.6259. 97 minutes on an Apple Silicon GPU (MPS). `training_summary.json` has the loss for each epoch.
## Evaluation
117 questions that aren't in the training data (paraphrases, typos, reworded general questions, programs the
data doesn't cover, off-topic questions), split into 41 dev and 76 test. On the test split:
| Model | Exact official link* | Names the program* | Token F1 vs. reference | Invented links | Says "I don't know" |
|---|---|---|---|---|---|
| **This model (2026)** | 45.5% | 47.7% | 0.674 | 56.6% | 0% |
| Earlier 2024 version (training-format bug) | 0% | 18.2% | 0.074 | 0% | 0% |
\* On program questions.
For comparison, retrieval over all-MiniLM-L6-v2 embeddings answered 82% of the same test questions right,
with no invented links. The repo's `eval/RESULTS.md` has every number.
## Limitations
- **It invents links and programs.** Asked about a program the data doesn't cover (law, dentistry), it writes a
confident answer with a plausible but nonexistent `pittstate.edu` link. Of the questions about programs
outside the data, 8 of 9 got an invented link. It never says "I don't know".
- The data covers only 56 programs (A to C) and was written in 2024, so details may be out of date. Check
pittstate.edu.
- Not for real advising or admissions decisions.
## License
MIT, like the code. The base model, microsoft/DialoGPT-small, is MIT licensed. The Q&A text was written from
pittstate.edu's public program pages.