Story Generation Engine

Turn an idea
into a story.

Nano-Mind is a lightweight GPT-2-style language model running on a custom C++ inference engine. Give it a story idea and generate text directly in your browser.

βš™οΈ

CPU Inference

No GPU required

πŸ”§

C++17 Engine

Custom built

πŸ“–

Story Trained

GPT-2 story dataset

Nano-Mind Logo

NANO-MIND

C++ Inference Engine

Create a Story

Checking server…
Your Story
β€”
βš™οΈ

CPU Inference

No GPU required

πŸ”§

C++17

Modern standard

⚑

AVX2 + FMA

SIMD optimization

πŸ”„

OpenMP

Multi-threaded

From idea to story in four steps.

Your prompt travels through a complete inference pipeline built from scratch.

1

Enter a Story Idea

Write a creative prompt or pick a suggestion.

β†’
2

Tokenize

FastAPI + tiktoken encode the prompt using GPT-2 BPE.

β†’
3

Generate Tokens

C++17 transformer forward pass with KV-cache and Top-K sampling.

β†’
4

Decode & Display

Generated tokens are decoded back to text and displayed as your story.

The tools and technology that power Nano-Mind.

βš™οΈ C++17
🐍 Python
⚑ FastAPI
πŸ”€ tiktoken
πŸš€ AVX2/FMA
πŸ”„ OpenMP
🐳 Docker
πŸ€— Hugging Face Spaces

System Architecture

The complete inference pipeline from your browser to the generated story.

🌐

Browser

Frontend sends POST request with prompt and generation parameters.

↓
⚑

FastAPI REST API

Python backend receives the request and orchestrates the pipeline.

↓
πŸ”€

tiktoken GPT-2 BPE

Encodes the text prompt into token IDs for the transformer.

↓
βš™οΈ

C++17 Inference Engine

Custom transformer implementation with CPU-level optimization.

↓
🧠

Transformer Forward Pass

Processes tokens through the model layers to generate new tokens.

Multi-Head Self-Attention KV-Cache LayerNorm GELU Top-K Sampling
↓
πŸ“–

Generated Story

Tokens decoded back to text and returned to the browser.

Live Hugging Face Benchmark

Verified performance from 20 successful requests to the deployed backend.

49.7 t/s
Median End-to-End Throughput
Tokens generated per second
1,594 ms
Median End-to-End Latency
Total round-trip time
825 ms
Server-Side Inference Latency
C++ engine processing time
20/20
Successful Requests
100% success rate
Note: End-to-end throughput includes network latency, Hugging Face proxy, FastAPI processing, tokenization, C++ inference, decoding, and response handling. Server-side latency reflects only the C++ inference engine.

See the story generator
in action.

Watch Nano-Mind turn a prompt into generated text through its C++ inference engine.

Watch Demo

Built from the engine up.

Unlike applications that simply call a hosted LLM API, Nano-Mind includes a custom C++ transformer inference implementation with CPU-level optimization.

Transformer Forward Pass KV-Cache AVX2/FMA OpenMP Custom Binary Model Loading

Explore the full implementation on GitHub.

View Source Code
βœ“ Story copied to clipboard