GandhiGPT Explore the model
AN EXPERIMENT IN LANGUAGE & LEARNING

Words shaped by
thought.

A small GPT-style language model, trained on cleaned text from writings associated with Mahatma Gandhi. Built to explore how machines learn the patterns of language.

An independent educational experiment · Not an official representation of Gandhi's views
THE THREAD OF THOUGHT01 / 03
✳“The future depends on what we do in the present.”
YOUR CREATIVE SPACE

Begin with a thought.

MODEL ONLINE
G
GandhiGPTText generation workspace
G
A NOTE FROM THE MODEL

Welcome. Give me a phrase to begin with. I’ll use patterns learned from the training text to attempt a continuation.

0/500
Press Enter to generate · Shift + Enter for a new line
ⓘ GandhiGPT is an experimental character-level language model. Its generated text is a continuation, not a verified factual answer.
BEHIND THE EXPERIMENT

Small model.
Big questions.

GandhiGPT is an educational experiment exploring how machines learn patterns in human language. It was trained from scratch using a decoder-only Transformer architecture and cleaned text from writings associated with Mahatma Gandhi.

~228K Model parameters
4 Transformer layers
5,000 Training iterations
FINAL TRAINING RESULTS
Training loss 1.5976
Validation loss 1.5955

Loss values are from the final reported training evaluation. Lower values indicate better next-character prediction on the evaluated data.

Explore the source code on GitHub ↗
HOW IT WORKS

Inside the architecture.

GandhiGPT learns to predict the next character based on the characters that came before it.

01

Input encoding

Text is broken into individual characters. Each character is converted into a numerical token.

02

Token embeddings

The model transforms character tokens into numerical vectors that it can process.

03

Self-attention

Attention allows the model to use earlier characters in the sequence when predicting the next one.

04

Text generation

The model predicts the next character repeatedly to produce a continuation of your prompt.

LEARNING FROM TEXT

The training journey.

The dataset

GandhiGPT was trained on a cleaned text dataset containing writings associated with Mahatma Gandhi.

The dataset contains approximately 79.4 million characters and 205 unique characters.

View dataset source ↗

Pretraining process

During training, the model learns to predict the next character in a sequence.

It uses a training and validation split to evaluate how well it learns patterns in the text.

Training iterations 5,000
Vocabulary size 205 characters
AN IMPORTANT NOTE

What GandhiGPT isn't.

GandhiGPT is a small experimental language model. It is not ChatGPT, a search engine, or a factual question-answering system.

Its output is generated from patterns learned during training. It may produce incomplete, inaccurate, repetitive, or nonsensical text. Generated content should not be treated as an authentic quotation or statement by Mahatma Gandhi.