Files
Vijay Janapa Reddi 152b8630dc fix(ci): clear all 8 failing pre-commit hooks on dev (#1413)
* fix(content): clear two mitpress-above-below pre-commit failures

The "📚 Book ·  Validate (Dev)" workflow has been failing on dev for
8+ consecutive runs because the mitpress-above-below pre-commit hook
flags spatial references like "above"/"below" inside body prose and
figure captions (the MIT Press style guide wants @sec-/@fig- cross-refs
or "earlier"/"later" instead). Two pre-existing violations were tripping
the hook on every push:

  - book/quarto/contents/vol1/responsible_engr/responsible_engr.qmd:1604
    fig-cap for fig-data-governance-pillars said "obligations discussed
    below: privacy, security, compliance, and transparency" — but those
    four obligations are *immediately* listed in the same caption, so
    "discussed below" was redundant. Reworded to "obligations of
    privacy, security, compliance, and transparency …".

  - book/quarto/contents/vol2/network_fabrics/network_fabrics.qmd:1217
    fig-cap for fig-congestion-cascade said "the PFC backpressure
    cascades described below." Reworded to "described later in this
    section." which is what the hook wants.

After our 4 release-prep merges (PR-1/2/7/12) cleaned up the other
hook failures (spelling, bibtex tidy, pipe tables, contractions,
mitpress-vs-period, …), this was the last remaining failing hook.
Verified locally:

  pre-commit run mitpress-above-below --all-files
  MIT Press: No above/below spatial refs (use cross-refs).....Passed

These are pure copy-edits to figure captions; no semantic change to
the diagrams or surrounding text.

* fix(check-internal-links): suppress 4 categories of false positives

The Tier 1 link checker (shipped in PR #1404) was over-eager and
flagged author content as broken in four documented patterns:

1. TikZ source inside HTML comments. Link regex matched `\node[mycycle](B1)`
   as a Markdown link `[mycycle](B1)`. Fix: strip `<!-- ... -->` bodies
   before scanning, preserving line/column offsets so any *real* failure
   we report stays accurate.
2. Quarto cross-references like `[Foo](@sec-bar)`, `@fig-x`, `@tbl-y`.
   These resolve through the project xref index at render time, not the
   filesystem; book/binder owns that validation. Fix: skip targets whose
   first token is `@sec-/@fig-/@tbl-/@eq-/@lst-/@thm-/@cor-/@def-/@exr-/
   @exm-/@prp-`.
3. Uppercase URL schemes (`HTTPS://`, `HTTP://`) — common after mobile
   auto-capitalize or copied citations. Fix: case-insensitive prefix
   match for the EXTERNAL_SCHEMES tuple.
4. GitHub-style emoji-prefix slugs in `.md` READMEs (e.g.
   `## 🎯 20 Progressive Modules` produces anchor `#-20-progressive-modules`
   on github.com, but Pandoc would slugify to `progressive-modules`).
   Fix: register both Pandoc-style and GitHub-style slugs as valid
   anchors so neither rendering target trips the checker.

Drops repo-wide broken-link count from 150 → 84 (false positives only;
no real link rot is masked). Real rot is fixed in a separate commit so
the checker improvement can be reviewed independently.

* fix(content): repair internal-link rot across 10 files

Concrete link rot the new checker (PR #1404) surfaced once its false
positives were cleared. None of these are stylistic; each link points
at a path or anchor that does not exist.

- README/README_{zh,ja,ko}.md (24 links): translation files live in
  README/ so paths to repo-root targets need a `../` prefix
  (`book/README.md` -> `../book/README.md`, etc.).
- mlsysim/docs/contributing.qmd (21 links): `../slides/...` pointed
  inside `mlsysim/`; the slides root is two levels up
  (`../../slides/...`).
- mlsysim/docs/cli-reference.qmd: `getting-started.qmd#bring-your-own-yaml-byoy`
  removed; retarget to `#defining-custom-models` (closest surviving
  section about user-supplied model specs).
- mlsysim/docs/for-engineers.qmd, for-instructors.qmd:
  `solver-guide.qmd#extending-mlsysim` no longer exists; retarget to
  `#writing-a-custom-solver` (the surviving custom-solver guide).
- book/tools/scripts/README.md: `../docs/BINDER.md` resolved to
  `book/tools/docs/BINDER.md` (nonexistent); the file actually lives
  at `book/docs/BINDER.md`, which is `../../docs/BINDER.md` from here.
- book/quarto/contents/frontmatter/index.qmd:
  `about.qmd#about-the-book-unnumbered` anchor was removed when the
  About heading was simplified; drop the anchor so the link lands at
  the top of the page (which IS the About section).
- tinytorch/datasets/tinytalks/README.md: `scripts/README.md` was
  never created; point at the directory listing instead.

* chore(pre-commit): exclude 3 forward-looking files from internal-link checker

Three files reference content that does not (yet) exist on the
filesystem; the references are intentional rather than rot, so they
should not block CI:

- labs/index.qmd: lists the 33 planned labs (vol1/lab_00..lab_16,
  vol2/lab_01..lab_16) as a roadmap. Links go live as each lab ships.
  De-linking now would lose the visual roadmap. When a lab lands the
  exclusion narrows naturally on its own.
- labs/PROTOCOL.md, labs/TEMPLATE.md: internal authoring docs that
  reference `../.claude/docs/labs/{PROTOCOL,TEMPLATE}.md`. The
  `.claude/` tree is per-worktree and not always present at the same
  relative path; these are author-tooling refs, not user-facing.

Net effect: the link checker is now green on a clean checkout. The
exclude block uses comments per existing convention so the rationale
is discoverable from the config alone.

* fix(content): clear codespell, contractions, and vs. pre-commit failures

Three pre-existing pre-commit hooks were failing on the dev branch
prior to the release-prep merges. Each is a small content normalization:

- codespell (2): re-declares -> redeclares (book/quarto/config/shared/README.md);
  unparseable -> unparsable (handled in the check-internal-links rewrite).
- contractions (2):
  * socratiq/socratiq.qmd callout: "If you're" -> "If you are".
  * nn_architectures fig-alt for the attention-visualization figure:
    "didn't" -> "did not". Alt-text is descriptive prose for screen
    readers, not a verbatim transcription of pixels, so expanding the
    contraction matches MIT Press style without changing the figure
    itself.
- mitpress-vs-period (6): bare `vs` -> `vs.` per MIT Press 2026 §10.5
  in benchmarking.qmd, distributed_training.qmd (x3 across two Python
  docstrings rendered in code listings), fault_tolerance.qmd, and
  inference.qmd. Code-listing strings are visible prose in the rendered
  PDF, so the rule applies there as well.

* chore: bibtex-tidy auto-format outputs

Outputs of the bibtex-tidy pre-commit hook (which auto-fixes its own
input). Picked up here so that running pre-commit on a clean checkout
no longer reports a "files were modified" failure for the same files
on every invocation. Pure formatting; no entry semantics changed.
2026-04-20 12:58:28 -04:00

10 KiB

TinyTalks: A Conversational Q&A Dataset for Educational Transformers

A carefully curated question-answering dataset designed for learning transformer architectures

License: CC BY 4.0 Size: ~50KB Version: 1.0.0


📖 Overview

TinyTalks is a lightweight, pedagogically-designed conversational dataset for training transformer models in educational settings. Unlike large-scale datasets that require hours of training, TinyTalks enables students to see their first transformer learn meaningful patterns in under 5 minutes.

Why TinyTalks?

Fast Training - Trains in 3-5 minutes on a laptop Verifiable Learning - Clear success metrics (correct vs. incorrect answers) Progressive Difficulty - 5 levels from greetings to reasoning Educational Focus - Designed for "aha!" moments, not benchmarks Zero Dependencies - Ships with TinyTorch, no downloads needed Reproducible - Deterministic generation, versioned releases


📊 Dataset Statistics

Property Value
Total Q&A Pairs 350
File Size ~40 KB
Vocabulary Size ~1,500 unique tokens (character-level)
Avg Question Length 8 words
Avg Answer Length 10 words
Training Split 245 pairs (70%)
Validation Split 53 pairs (15%)
Test Split 52 pairs (15%)

🎯 Content Structure

TinyTalks is organized into 5 progressive difficulty levels:

Level 1: Greetings & Identity (50 pairs)

Basic conversational patterns and self-identification.

Q: Hello!
A: Hi there! How can I help you today?

Q: What is your name?
A: I am TinyBot, a simple AI assistant.

Learning Goal: Model learns conversation structure and identity.


Level 2: Simple Facts (100 pairs)

Factual knowledge about the world (colors, animals, objects).

Q: What color is the sky?
A: The sky is blue during the day.

Q: How many legs does a dog have?
A: A dog has four legs.

Learning Goal: Model learns to retrieve and state facts.


Level 3: Basic Math (50 pairs)

Simple arithmetic operations (single-digit addition, subtraction).

Q: What is 2 plus 3?
A: 2 plus 3 equals 5.

Q: What is 7 minus 4?
A: 7 minus 4 equals 3.

Learning Goal: Model learns basic numerical reasoning.


Level 4: Common Sense Reasoning (100 pairs)

Purpose, usage, and logical relationships.

Q: What do you use an umbrella for?
A: You use an umbrella to stay dry in the rain.

Q: Where do fish live?
A: Fish live in water.

Learning Goal: Model learns causal and functional relationships.


Level 5: Multi-turn Context (50 pairs)

Simple context tracking across exchanges.

Q: I like pizza.
A: Pizza is delicious! What toppings do you like?

Q: I like pepperoni.
A: Pepperoni is a popular choice!

Learning Goal: Model begins to track conversational context.


🚀 Quick Start

Loading the Dataset

# Load full dataset
with open('datasets/tinytalks/tinytalks_v1.txt', 'r') as f:
    text = f.read()

# Or use pre-split versions
with open('datasets/tinytalks/splits/train.txt', 'r') as f:
    train_text = f.read()

Training a Transformer

# See milestones/05_2017_transformer/tinybot_demo.py for full example
from tinytorch.models.transformer import GPT
from tinytorch.text.tokenization import CharTokenizer

# Initialize model
tokenizer = CharTokenizer()
tokenizer.fit(train_text)

model = GPT(
    vocab_size=len(tokenizer),
    embed_dim=128,
    num_layers=4,
    num_heads=4,
    max_seq_len=64
)

# Train for 5 minutes → See meaningful results!

Expected Performance

After training for 10-20 epochs (~3-5 minutes):

  • Correctly answers Level 1-2 questions (~80% accuracy)
  • Maintains grammatical structure
  • Generates coherent (if not always correct) responses
  • ⚠️ Level 3-5 show partial understanding

This demonstrates the transformer has learned patterns, not just memorized.


📐 Dataset Format

Simple, human-readable text format:

Q: [Question text]
A: [Answer text]

Q: [Next question]
A: [Next answer]

Rationale:

  • Character-level tokenization (no special tokenizers needed)
  • Easy to inspect and validate
  • Works with any text processing pipeline
  • Human-readable for debugging

Delimiter: Empty line separates Q&A pairs.


🔬 Dataset Creation Methodology

Generation Process

  1. Manual Curation - All Q&A pairs hand-written by TinyTorch maintainers
  2. Diversity Sampling - Systematic coverage of topics within each level
  3. Quality Control - Each pair reviewed for grammar, factual accuracy, appropriateness
  4. Balance Verification - Ensured even distribution across levels
  5. Reproducibility - Generation script (scripts/generate_tinytalks.py) produces identical output

Quality Assurance

  • Grammar check (automated + manual review)
  • Factual accuracy verification
  • No offensive or biased content
  • No personally identifiable information
  • Balanced topic distribution
  • Appropriate for all ages

Validation Script

python datasets/tinytalks/scripts/validate_dataset.py

Checks:

  • Format consistency
  • No duplicate pairs
  • Balanced splits
  • Character encoding (UTF-8)
  • Line endings (Unix)

📊 Dataset Statistics

Run scripts/stats.py to generate:

python datasets/tinytalks/scripts/stats.py

Output:

  • Total pairs per level
  • Vocabulary statistics
  • Length distributions
  • Split sizes
  • Character frequency

🎓 Educational Use Cases

Primary Use: Module 13 (Transformers)

TinyTalks is designed as the canonical dataset for TinyTorch's Transformer milestone:

  • milestones/05_2017_transformer/tinybot_demo.py - Main training demo
  • Students see their first transformer learn in < 5 minutes
  • Clear success metric: Can it answer questions?
  • "Wow, I built this!" moment

Secondary Uses

  1. Tokenization (Module 10) - Character vs. BPE comparison
  2. Embeddings (Module 11) - Visualize learned embeddings
  3. Attention (Module 12) - Inspect attention patterns on Q&A
  4. Debugging - Small enough to trace gradients manually
  5. Experimentation - Test architecture changes quickly

⚖️ License

Creative Commons Attribution 4.0 International (CC BY 4.0)

You are free to:

  • Share — copy and redistribute in any format
  • Adapt — remix, transform, and build upon the material
  • Commercial use allowed

Under these terms:

  • Attribution — Cite TinyTalks (see below)
  • No additional restrictions

See LICENSE for full text.


📚 Citation

If you use TinyTalks in your work, please cite:

@dataset{tinytalks2025,
  title={TinyTalks: A Conversational Q\&A Dataset for Educational Transformers},
  author={TinyTorch Contributors},
  year={2025},
  publisher={GitHub},
  url={https://github.com/harvard-edge/cs249r_book/tree/main/tinytorch/datasets/tinytalks},
  version={1.0.0}
}

Text citation: TinyTorch Contributors. (2025). TinyTalks: A Conversational Q&A Dataset for Educational Transformers (Version 1.0.0). https://github.com/harvard-edge/cs249r_book/tree/main/tinytorch/datasets/tinytalks


🔄 Versioning

Version 1.0.0 (Current)

  • Initial release: 350 Q&A pairs across 5 levels
  • Character-level format
  • 70/15/15 train/val/test split

Planned:

  • v1.1 - Add 100 more Level 4-5 pairs for better reasoning
  • v2.0 - Multi-language support (Spanish, French)
  • v3.0 - Expanded to 1,000 pairs with more complex reasoning

See CHANGELOG.md for detailed history.


🤝 Contributing

We welcome contributions! Ways to help:

  1. Report Issues - Found a factual error or typo? Open an issue.
  2. Suggest Q&A Pairs - Submit ideas for new questions via PR.
  3. Translations - Help translate TinyTalks to other languages.
  4. Validation - Test on different models and report results.

Guidelines:

  • Follow existing format and style
  • Ensure factual accuracy
  • Keep language simple and clear
  • No offensive or biased content
  • Appropriate for all ages (G-rated)

See CONTRIBUTING.md for details.


📞 Contact & Support


🙏 Acknowledgments

Inspired by:

  • bAbI Dataset (Facebook AI Research) - Reasoning tasks
  • SQuAD - Question answering format
  • TinyStories - Simplicity philosophy
  • TinyTorch Community - Feedback and testing

Created for:

  • Students learning transformer architectures
  • Educators teaching NLP
  • Researchers prototyping small models
  • Developers testing implementations

📖 Additional Documentation


🌟 Why "TinyTalks"?

The name embodies our philosophy:

  • Tiny - Small enough to train in minutes, not hours
  • Talks - Conversational, accessible, human-like
  • Educational - Designed for learning, not leaderboards

Just like TinyTorch makes deep learning accessible, TinyTalks makes conversational AI immediate and tangible.


Built with ❤️ by the TinyTorch community

"The best way to understand transformers is to see them learn."