There’s No AI In A Markov Chain, But They’re Fun To Play With

Amid all the hype about AI it sometimes seems as though the world has lost sight of the fact that software such as ChatGPT contains no intelligence. Instead it’s an extremely sophisticated system for extracting plausible machine generated content from the corpus on which it is trained. There’s a long history behind machine generated text, and perhaps the simplest example comes in the form of a Markov chain. [Ben Hoyt] takes us through how these work, and provides some Python code so that you can roll your own.

If you’re uncertain what a Markov chain is, consider the predictive text on your phone. It works by offering the statistically most likely next word in your sentence, and should you accept all of its choices it will deliver sentences which are superficially readable but otherwise complete nonsense. He demonstrates with very simple short source texts how a collocate probability map is generated for two-word phrases, and how from that a likely next word can be extracted. It’s not AI, but it can be a lot of fun to play with and it opens the door to the entire field of computational linguistics. We haven’t set one loose on Hackaday’s archive yet but we suspect it would talk a lot about the Arduino.

We’re talking about Markov chains here with respect to language, but it’s also worth remembering that they work for music too.

Header: Bad AI image with Dall-E prompt, “Ten thousand monkeys with typewriters”.

Stochastic Markov Beats

[Attoparsec] has been building intriguing musical projects on his YouTube channel for a while and his latest is no exception. Dubbed simply as “Node Module”, it is a rack-mounted hardware-based Markov chain beat sequencer. Traditionally Markov chains are software state machines that transition between states with given probabilities, often learned from a training corpus. That same principle has been applied to hardware beat sequencing.

Each Node Module has a trigger input, four outputs each with a potentiometer, and a trigger out. [Attoparsec] has a wonderful explanation of all the different parts and theories that make up the module at the start of his video, but the basic operation is that a trigger input comes in and the potentiometers are read to determine the probabilities of each output. One is randomly selected and fired. As you can imagine, there are loops and even dead-end nodes and for some musical pieces there is a certain number of beats expected, so a clever reset signal can be sent to pull the chain back to the initial starting state at a regular interval. The results are interesting to listen to and even better to imagine all the possibilities.

The module itself is an Arduino-based custom PCB that is laid out quite cleanly. The BOM, code, and KiCad files are available on GitHub if you want to make one yourself. This isn’t the first instrument we’ve seen [Attoparsec] make, and we’re confident it won’t be the last.

Continue reading “Stochastic Markov Beats”

Creating A Decadent, Insane, And Depressed Robot From Internet Ramblings

Have you ever wondered what a Tumblr written by a psychotic robot would look like? Wonder no more, because [Lars] has that all figured out.

A few years ago, [Lars] stumbled across lowbrow.com (now defunct, but mirrored here), an online confessional and bathroom wall meant to host people’s most private thoughts and actions anonymously. [Lars] wrote a script to pull a random lowbrow post down every minute and threw every unique result into a database.

With about 50 pages of the most depraved and depressing posts of questionable veracity, [Lars] trained a Markov chain algorithm to produce paragraphs that imitated the style of lowbrow contributors. This gave [Lars]  pages of computer-generated text describing the most decadent, depressing, insane, inane, but overwhelmingly human experiences possible. A few choice quotes from the output are:

The llama: nature’s random number generator.

Over 7000 watts of Ol’ Barry whining his ass cheeks to soften the blows.

All through school I was being pulled behind the local St. Benedictine  Monastary where I was afraid I don’t know what I thought was the founder pulls back from a discussion about homestarrunner.com

While [Lars]’ script wouldn’t pass a Turing test, we’ve met people who couldn’t do the same. As far as creating a real-life version of Hedonism Bot, HAL, and Marvin from Hitchhiker’s Guide, we’re thinking [Lars] hit the mark.

After the break you can check out a gallery of pics [Lars] put together of from his computer-generated text. You can also grab the full lowbrow corpus and the ruby script to build your robotic [Kerouac].

Continue reading “Creating A Decadent, Insane, And Depressed Robot From Internet Ramblings”