Nanosaur2-670M
well9472 · Kit
Makes illustrations from text prompts with a small 670M-parameter diffusion model, run through ComfyUI. Built as a low-budget research model for people who wan…
A small decoder-only language model, about 19 million parameters, written and trained from scratch on TinyStories, with a demo page. For learners studying how a small transformer works.
Modern LLM From Scratch is a kit in the Education category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page, a zip of its files. Nothing in it runs by itself.
pip install -U huggingface_hub hf download Kakarot2812/modern-llm-from-scratch --repo-type space --local-dir modern-llm-from-scratch cd modern-llm-from-scratch
This Space is a demo of a small language model that its author wrote and trained from scratch with PyTorch on the TinyStories dataset. The model is decoder-only and has about 19 million parameters. The demo lets you choose between a pretrained checkpoint and a fine-tuned one and then generate text.
The source calls it a small experimental model meant for learning and experimentation, not for production use.
It suits students and curious developers who want to read the code of a small modern transformer and try it.
| Industry | Who uses it | How they use it | Example |
|---|---|---|---|
| Education | Students | Read the model code to learn how a decoder-only transformer is built | A student follows model.py and layers.py side by side |
| Machine learning | ML practitioners | Study the comparison between a GPT-2 style setup and a modern one | A practitioner reads the ablation results for the tied variant |
| Teaching | Instructors | Show what KV caching does to generation speed | An instructor points to the two throughput numbers |
| Hobbyists | Tinkerers | Try sampling settings on a tiny model | A tinkerer raises the temperature and reads the change |
You can skip it if you need a model that follows general instructions or writes reliable text.
You use it in these places.
| Use case | Who | What they get back |
|---|---|---|
| Generate story text | Anyone | A continuation of your prompt from the pretrained checkpoint |
| Try the fine-tuned checkpoint | Learners | Text written from one fixed children's story instruction |
| Read the code | Developers | The model, layers and config files of a small transformer |
Online use needs only a browser. A local copy needs Python 3.12 and pip.
pip install -U huggingface_hub hf download Kakarot2812/modern-llm-from-scratch --repo-type space --local-dir modern-llm-from-scratch cd modern-llm-from-scratch pip install gradio==6.31.0 pip install -r requirements.txt python app.py
Start the app and open the page it serves. Pick a checkpoint, then adjust the sampling settings and generate text.
python app.py
| Tool | What it does |
|---|---|
| Pretrained checkpoint | Accepts a custom text prompt and continues it |
| SFT Fine-tuned checkpoint | Uses one fixed children's story writing instruction |
| Temperature, top-k and top-p | Change how varied the generated text is |
You pick the pretrained checkpoint, type the opening of a short story and keep the default sampling settings. The model continues the story in the style of children's tales. It can repeat itself or drift, as the source warns.
A language model predicts the next word piece again and again. This one is tiny and learned from simple children's stories, so its text is plain and sometimes wanders. Try the pretrained checkpoint first and compare a low and a high temperature.
Under the hood, the model has 6 layers, hidden size 256, 8 attention heads and a context of 512 tokens. It uses RoPE, RMSNorm, SwiGLU, tied embeddings and KV caching, with the GPT-2 vocabulary of 50,257 tokens. Pretraining ran for 6,000 steps and reached a validation loss of 1.8875. The fine-tuned checkpoint ran 600 more steps on one fixed instruction, so it is an experiment and not general instruction following.
The source reports its own numbers, and it says they depend on hardware and workload.
A small decoder-only language model, about 19 million parameters, written and trained from scratch on TinyStories, with a demo page. For learners studying how a small transformer works.
Made by Kakarot2812 on Hugging Face. These notes are Mindket's, written from its Space page and README; the app's own files and license are on Hugging Face.
What it is: This Space is a demo of a small language model that its author wrote and trained from scratch with PyTorch on the TinyStories dataset. The model is decoder-only and has about 19 million parameters. The demo lets you choose between a pretrained checkpoint and a fine-tuned one and then generate text.
The source calls it a small experimental model meant for learning and experimentation, not for production use.
Who it suits: It suits students and curious developers who want to read the code of a small modern transformer and try it.
Industry | Who uses it | How they use it | Example
Education | Students | Read the model code to learn how a decoder-only transformer is built | A student follows model.py and layers.py side by side
Machine learning | ML practitioners | Study the comparison between a GPT-2 style setup and a modern one | A practitioner reads the ablation results for the tied variant
Teaching | Instructors | Show what KV caching does to generation speed | An instructor points to the two throughput numbers
Hobbyists | Tinkerers | Try sampling settings on a tiny model | A tinkerer raises the temperature and reads the change
You can skip it if you need a model that follows general instructions or writes reliable text.
Where to use it: You use it in these places.
Use case | Who | What they get back
Generate story text | Anyone | A continuation of your prompt from the pretrained checkpoint
Try the fine-tuned checkpoint | Learners | Text written from one fixed children's story instruction
Read the code | Developers | The model, layers and config files of a small transformer
How to set it up: Online use needs only a browser. A local copy needs Python 3.12 and pip.
pip install -U huggingface_hub
hf download Kakarot2812/modern-llm-from-scratch --repo-type space --local-dir modern-llm-from-scratch
cd modern-llm-from-scratch
pip install gradio==6.31.0
pip install -r requirements.txt
python app.py
How to use it: Start the app and open the page it serves. Pick a checkpoint, then adjust the sampling settings and generate text.
python app.py
Tool | What it does
Pretrained checkpoint | Accepts a custom text prompt and continues it
SFT Fine-tuned checkpoint | Uses one fixed children's story writing instruction
Temperature, top-k and top-p | Change how varied the generated text is
Example: You pick the pretrained checkpoint, type the opening of a short story and keep the default sampling settings. The model continues the story in the style of children's tales. It can repeat itself or drift, as the source warns.
For newcomers and experts: A language model predicts the next word piece again and again. This one is tiny and learned from simple children's stories, so its text is plain and sometimes wanders. Try the pretrained checkpoint first and compare a low and a high temperature.
Under the hood, the model has 6 layers, hidden size 256, 8 attention heads and a context of 512 tokens. It uses RoPE, RMSNorm, SwiGLU, tied embeddings and KV caching, with the GPT-2 vocabulary of 50,257 tokens. Pretraining ran for 6,000 steps and reached a validation loss of 1.8875. The fine-tuned checkpoint ran 600 more steps on one fixed instruction, so it is an experiment and not general instruction following.
Pick a checkpoint and type a prompt
The text is split with the GPT-2 vocabulary
Six transformer layers predict the next token
Temperature, top-k and top-p choose the token
The generated text appears
Good to know: The source reports its own numbers, and it says they depend on hardware and workload.
Title: Generation speed with and without KV caching
Without KV cache: 143.69 tokens/sec
With KV cache: 292.49 tokens/sec
Title: Validation loss in the architecture comparison, lower is better
GPT-2 baseline: 3.0835 loss
Modern, untied: 2.7809 loss
Modern, tied: 2.8413 loss
Open the Space in your browser, or copy it to your own Hugging Face account from its page. Nothing in this kit runs by itself.
README.md 6 KB
Listed Hugging Face Spaces in the same category that share the most tags with this one.
| Product | Likes | Built with | License | Last change |
|---|---|---|---|---|
| Modern LLM From Scratch This page | 1 | gradio | mit | |
| Unit 1 Quiz - AI Agent FundementalsShares gradio | 360 | gradio | apache-2.0 | |
| Unit 2.1 smolagents Code QuizShares gradio | 63 | gradio | apache-2.0 | |
| Unit 1 Quiz - Model Context Protocol (MCP) FundementalsShares gradio | 58 | gradio | apache-2.0 | |
| Tamazight Text-to-SpeechShares gradio | 41 | gradio | cc-by-4.0 | |
| Embedding Draw ChallengeShares gradio | 30 | gradio | apache-2.0 |
well9472 · Kit
Makes illustrations from text prompts with a small 670M-parameter diffusion model, run through ComfyUI. Built as a low-budget research model for people who wan…
Waqf-AI · Kit
Reads handwritten Arabic text from images and returns it as text. A fine-tuned PaddleOCR-VL model for people digitizing Arabic handwriting.
Wan-AI · Kit
Makes video clips from a text prompt or an image plus text, at up to 720P and 24 frames per second, in the Diffusers format for a single consumer GPU.
prathoshap · Kit
Reads classical Sanskrit verses aloud in a chant style, using one trained voice and a reference clip that sets the rhythm. For people who study, recite or need…
paradigma-inc · Kit
Solves hard math problems with a 1B-parameter model trained from scratch for fast, high-volume reasoning. It suits developers who run math workloads on an NVID…
murai-labs · Kit
Chats in Tamil script, romanized Tamil and English, and translates between Tamil and English. A 2.5B model built from scratch by Murai Labs, for Tamil speakers…