z80ai  by HarryR

Tiny AI for 8-bit processors

Created 1 month ago
959 stars

Top 38.4% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

Z80-μLM is a novel micro language model designed for extreme resource constraints, enabling conversational AI on 8-bit Z80 processors with only 64KB of RAM. It targets retrocomputing enthusiasts and researchers interested in the minimal requirements for AI personality. The project delivers a functional chatbot and game playable on vintage hardware, demonstrating that even minimal systems can exhibit engaging, albeit simple, AI interactions.

How It Works

The core innovation lies in aggressive quantization and a unique input encoding. Models use 2-bit weights ({-2, -1, 0, +1}), packed four per byte, with all inference using Z80-native 16-bit integer arithmetic, eschewing floating-point. Input text is transformed into an abstract "tag cloud" via trigram hashing into 128 buckets, providing tolerance for typos and word order variations. This enables a ~40KB .COM binary to run inference character-by-character on a 4MHz Z80.

Quick Start & Requirements

Training is conducted in Python, with models exported as CP/M .COM binaries. The primary interaction method involves running the compiled binary directly on a CP/M system. Prerequisites include a Z80 CPU, 64KB RAM, and a CP/M environment. Tools for generating training data using Ollama or Claude API are available. Further insights into training are detailed in TRAINING.md.

Highlighted Details

  • Extremely compact ~40KB .COM executable size, fitting within CP/M's Transient Program Area (TPA).
  • 2-bit weight quantization ({-2, -1, 0, +1}) packed 4-per-byte, enabling minimal memory footprint.
  • 16-bit integer inference engine optimized for Z80 architecture, avoiding floating-point math.
  • Trigram hash encoding for input processing, offering typo tolerance and word-order invariance.
  • Includes pre-built examples: tinychat conversational bot and guess 20 Questions game.

Maintenance & Community

No specific details on maintainers, community channels (like Discord/Slack), or project roadmap were found in the provided README text.

Licensing & Compatibility

The project is offered under either the MIT or Apache-2.0 license, allowing for flexible use and integration. It is specifically designed for compatibility with CP/M operating systems and vintage Z80-based hardware.

Limitations & Caveats

Input processing relies on abstract hashing, not semantic understanding, limiting grammar grasp, deep multi-turn context tracking, or novel sentence generation. It is not an AI approaching general intelligence but a system for personality and interaction on highly constrained hardware.

Health Check
Last Commit

5 days ago

Responsiveness

Inactive

Pull Requests (30d)
9
Issues (30d)
6
Star History
972 stars in the last 30 days

Explore Similar Projects

Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Lei Zhang Lei Zhang(Director Engineering AI at AMD), and
23 more.

gpt-fast by meta-pytorch

0.1%
6k
PyTorch text generation for efficient transformer inference
Created 2 years ago
Updated 5 months ago
Starred by Nat Friedman Nat Friedman(Former CEO of GitHub), Alex Yu Alex Yu(Research Scientist at OpenAI; Cofounder of Luma AI), and
7 more.

ChatRWKV by BlinkDL

0.0%
10k
Open-source chatbot powered by the RWKV RNN language model
Created 3 years ago
Updated 3 days ago
Feedback? Help us improve.