Get all your news in one place.
100’s of premium titles.
One app.
Start reading
Tom’s Hardware
Tom’s Hardware
Technology
Les Pounder

Developer creates 'conversational AI' that can run in 64kb of RAM on 1976 Zilog Z80 CPU-powered system — features a tiny chatbot and a 20-question guessing game

A Z80 CPU.

The venerable Zilog Z80 CPU has been around since 1976, and it has powered everything from calculators and home computers to arcade cabinets. But the 8-bit microprocessor isn't exactly a powerful CPU compared to what we use today. That said, developer HarryR has created Z80-μLM, a working "AI" for the well-respected microprocessor. HarryR confirms that it won't pass the Turing test, but it is a bit of fun. And no, the price of Z80s will not be impacted by AI.

According to the readme file, "Z80-μLM is 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." HarryR's goal is to see how small an AI project can go, while still having a "personality". Can the AI be trained and fine-tuned? It seems that HarryR has done it in just 40KB, including inference, weights, and chat style user interface.

HarryR has kindly detailed the features of this Z80 AI project.

  • Trigram hash encoding: Input text is hashed into 128 buckets - typo-tolerant, word-order invariant
  • 2-bit weight quantization: Each weight is {-2, -1, 0, +1}, packed 4 per byte
  • 16-bit integer inference: All math uses Z80-native 16-bit signed arithmetic
  • ~40KB .COM file: Fits in CP/M's Transient Program Area (TPA)
  • Autoregressive generation: Outputs text character-by-character
  • No floating point: Everything is integer math with fixed-point scaling
  • Interactive chat mode: Just run CHAT with no arguments
(Image credit: Tom's Hardware)

The project comes with two examples. Tinychat is a conversational chatbot that responds to greetings and questions about itself with very short replies. The other is Guess, a 20-question game where the model knows a secret and we must try to guess.

Both of these examples are made available as binaries for use with CP/M systems and the Sinclair ZX Spectrum. The CP/M files are typical .COM files that anyone can easily run. For the ZX Spectrum, there are two .TAP files, cassette tape images that can be loaded into an emulator, or on real hardware.

The chatbot's AI is limited but nuanced.

  • 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 responses are short on purpose, sometimes vague, but there is a personality inferred in the response. Or could this just be a human brain trying to anthropomorphize an AI into a real person?

Will AI Create The Z80-pocalypse?

The short answer is no, there is nothing to fear! But the Z80 has seen its life threatened during its 50-year lifespan.

In 2024, the Z80 finally reached end of life/last time buy status according to a Product Change Notification (PCN) that we saw via Mouser. Dated April 15, 2024, Zilog advised customers that its "Wafer Foundry Manufacturer will be discontinuing support for the Z80 product..." But fear not, as back in May 2024, one developer was working on a drop-in replacement. Looking at Rejunity's Z80-Open-Silicon repository, we can see that did in fact happen via the Tiny Tapeout project.

Follow Tom's Hardware on Google News, or add us as a preferred source, to get our latest news, analysis, & reviews in your feeds.

Sign up to read this article
Read news from 100’s of titles, curated specifically for you.
Already a member? Sign in here
Related Stories
Top stories on inkl right now
One subscription that gives you access to news from hundreds of sites
Already a member? Sign in here
Our Picks
Fourteen days free
Download the app
One app. One membership.
100+ trusted global sources.