Built with datascienceportfol.io

Bayesian GPT

Project photo

Project links

Skills

About this project

Transformer-based models such as GPT-2 represent the state-of-the-art in text generation but are limited

by their fixed-parameter, softmax-based inference processes, which often result in overconfident and

repetitive outputs. This project investigates whether Bayesian-inspired techniques - specifically Monte

Carlo (MC) Dropout - can offer better uncertainty quantification and enhance creativity in generated text.

By enabling dropout during inference, we approximate sampling from a posterior over model weights,

introducing structured stochasticity into the generation process. This natural variability enables us to

assess the epistemic uncertainty of the model while encouraging more diverse outputs. We fine-tune GPT-

2 on a toy dataset (TinyStories) and evaluate both the standard and MC Dropout-enhanced versions

on metrics related to fluency, diversity, uncertainty, and human-perceived creativity. Our findings show

that while MC Dropout introduces a moderate computational cost, it significantly increases output

diversity and uncertainty awareness - supporting its potential for open-ended generation tasks where

interpretability and creative variety are valued.