Developer Creates 'Conversational AI' That Runs on 1976 Zilog Z80 CPU with 64KB RAM
#Regulation

Developer Creates 'Conversational AI' That Runs on 1976 Zilog Z80 CPU with 64KB RAM

Chips Reporter
3 min read

A developer has created a working conversational AI that runs on the vintage Zilog Z80 processor from 1976, featuring a chatbot and 20-question guessing game that operates within the constraints of 64KB RAM and 8-bit integer arithmetic.

A developer has successfully created a working conversational AI that runs on the vintage Zilog Z80 processor from 1976, demonstrating that artificial intelligence can operate within the severe constraints of 8-bit computing. HarryR's project, dubbed Z80-μLM, brings AI capabilities to a processor that has powered everything from calculators and home computers to arcade cabinets over its 50-year lifespan.

Technical Feats in 64KB of RAM

The Z80-μLM project achieves what many would consider impossible for such an old architecture. According to the project's readme file, it's described as "a 'conversational AI' that generates short character-by-character sequences, with quantization-aware training (QAT) to run on a Z80 processor with 64kb of RAM."

The AI implementation is remarkably compact, fitting entirely within 40KB including inference, weights, and the chat-style user interface. This represents a significant achievement in optimization, as the entire system must operate within CP/M's Transient Program Area (TPA).

How It Works: 8-Bit Integer Math

The technical implementation relies on several clever optimizations to make AI feasible on 8-bit hardware:

  • Trigram hash encoding: Input text is hashed into 128 buckets, providing typo tolerance and word-order invariance
  • 2-bit weight quantization: Each weight is restricted to {-2, -1, 0, +1}, packed 4 per byte to save space
  • 16-bit integer inference: All mathematical operations use Z80-native 16-bit signed arithmetic
  • No floating point: Everything operates using integer math with fixed-point scaling

The project comes with two demonstration applications. "Tinychat" is a conversational chatbot that responds to greetings and questions about itself with very short replies. "Guess" is a 20-question game where the model knows a secret and users must try to guess it.

The AI's Personality: Brief and Enigmatic

The chatbot's responses are intentionally terse, creating what HarryR describes as "a different mode of interaction." The AI employs a limited but nuanced response set:

  • OK - acknowledged, neutral
  • WHY? - questioning your premise
  • R U? - casting existential doubt
  • MAYBE - genuine uncertainty
  • AM I? - reflecting the question back

According to HarryR, "...it's a different mode of interaction. The terse responses force you to infer meaning from context or ask probing direct yes/no questions to see if it understands or not."

The brevity is deliberate, sometimes vague, but there's an inferred personality in the responses. Whether this represents genuine AI behavior or simply human tendency to anthropomorphize remains an open question.

Running the AI on Vintage Hardware

For those interested in experiencing this piece of computing history, the project provides binaries for both CP/M systems and the Sinclair ZX Spectrum. The CP/M files are standard .COM files that can be easily executed. For ZX Spectrum users, there are two .TAP files - cassette tape images that can be loaded into emulators or even run on actual hardware.

The Z80's Enduring Legacy

The Z80 processor, introduced in 1976, has enjoyed an extraordinary lifespan. However, 2024 marked a significant milestone for the venerable chip. A Product Change Notification (PCN) dated April 15, 2024, indicated that Zilog's "Wafer Foundry Manufacturer will be discontinuing support for the Z80 product..."

Despite this end-of-life announcement, the Z80 community remains active. In May 2024, developer Rejunity worked on a drop-in replacement through the Tiny Tapeout project, ensuring the architecture's continued viability.

HarryR's AI project demonstrates that even with the Z80 reaching end-of-life status, the processor continues to inspire innovation and push the boundaries of what's possible with constrained computing resources. The project serves as both a technical achievement and a testament to the enduring appeal of retro computing.

While this AI won't pass the Turing test and won't impact Z80 pricing, it represents an fascinating intersection of vintage computing and modern AI techniques - proving that with enough optimization, even a 1976 processor can engage in rudimentary conversation and play guessing games.

Z80 AI A Z80 CPU

Image credit: Tom's Hardware

Comments

Loading comments...