Classic computing fanatic Dr. Scott M. Baker has had a little bit assist together with his newest mission, writing a Forth-based model of Mary Had a Little Lamb for a Texas Devices TM990 microcomputer: Anthropic’s Claude massive language mannequin (LLM).
“I have been engaged on a brand new mission for a TM990 pc, and I constructed an AY-3-8910 sound generator board for it,” Baker explains. “My TM990 has a FIG-Forth that can run on it, so I figured I’d write a music participant in Forth. However this time, moderately than write it myself, I’ll enlist my trusty AI [Artificial Intelligence] assistant, Claude-3.5-sonnet on a web site referred to as Poe that allows you to simply check out AI algorithms. I began with a easy immediate: ‘write a forth program to play Mary Had a Little Lamb on a AY-3-8910 sound chip’. Inside just a few seconds, Claude responded.”
As anybody who has experimented with massive language fashions (LLMs) will count on, Claude’s response was undoubtedly answer-shaped — impressively so, given the seemingly paucity of Forth-based software program sources within the coaching knowledge ingested by Anthropic to create the mannequin. “Claude made some assumptions about my {hardware} that didn’t match actuality,” Baker discovered, which required a little bit of back-and-forth to resolve the problems — beginning with making a alternative for an assumed-present however lacking “ms” phrase for the delay between notes.
What adopted was a collection of refinements, by which the Claude chatbot “apologised” every time a correction or revision was required — even when the revision was not a part of the unique immediate, reminiscent of ensuring this system was suitable with FIG-Forth. At every step, a cautious knowledgeable eye was required to identify areas the place this system was subtly incorrect — reminiscent of utilizing the fallacious register numbers or calculating the timing incorrectly in such a method as to gradual the tune all the way down to one-twentieth its unique velocity, the repair for which then delivered pitches one-third the frequency anticipated.
Whereas Baker and Claude acquired there in the long run, the programming course of was a particular back-and-(FIG-)forth. (📷: Dr. Scott M. Baker)
These errors started to extend, Baker discovered. “Suffice it to say we’re getting much less proper than extra proper,” he famous after a “repair” which required a calculation that exceeded the 16-bit capabilities of the Texas Devices TMS9900 CPU on the coronary heart of the TM990. Finally, although, Baker succeeded in prodding Claude to the proper output: a working program, written in FIG-Forth, which makes the TM990 play Mary Had a Little Lamb by a soundcard add-on.
Baker’s full write-up, together with the supply code for the completed program, is out there on his web site.