Tuesday, April 7, 2026

Ralph for beginners

What's Ralph and why do you care?

Ralph is all about automating the code generating process. You can use it to build small applications while you eat your lunch and build bigger applications while you sleep. Apart from the initial setup, the skills required are mostly those of a product manager; specifically, the ability to write a detailed requirements document.

Why do we need another Ralph blog post?

I found it hard to get going with Ralph because the existing content was either too theoretical or not practical enough. I figured it out in the end, but I thought I could write something to help other people get going faster, so that's what you're reading.

The what and why of Ralph

LLMs have a limited context window, which means they can only do a limited amount of reasoning. In turn, this means LLMs have problems generating code for large or complex projects. In my experience, once the prompt gets beyond a page or two, the quality falls off and code gen starts to miss things. The net result is, you need to have a human in the loop to code or to prompt; the human spots places where code gen has failed and prompts the LLM to fix the issues.

Ralph solves the problem by slicing the whole project into "bite-size requirements" with acceptance criteria after each requirement. If code gen for a requirement doesn't meet its acceptance criteria, Ralph tries again. In this way. it constructs the project step-by-step until it's built all the requirements and so delivers the complete project. The entire process is automated and there's no human involvement.

(Gemini's view of the Ralph loop. A nice AI generated image about AI.)

The Ralph loop gets its name from The Simpson's character Ralph Wiggum. If you've never watched The Simpson's, here's what you need to know: Ralph is well-meaning, but intellectually slow. Imagine you're instructing Ralph on how to build something. You'd break down the project into chunks and have Ralph run tests to make sure each chunk was correct before moving onto the next chunk. Ralph would build the project piece-by-piece until the whole thing was finished. This way might be slow, but you'd get it done right.

Ralph Wiggum, Fair use, Link

AIs and CLI

To get Ralph to work, you'll need to install a code gen CLI on you local machine. The most common tutorials I've seen on the web use the Claude CLI, so install this if you don't have an existing code gen solution. I got Ralph working with Cursor via the Cursor CLI, so I know that works too. Whatever AI you choose, you'll need an active subscription; you're not going to do this for free.

Skills

Next up, you'll need to install a skills file for your LLM. If this were a normal blog post, I'd tell you exactly where to go to get the skills file, but I'm not going to do that. The Ralph world is changing so quickly, any links I give you will be out of date by the time you read this. You'll need to search to get the latest version of the Ralph skills file you need.

(Skills enable code generation tools to do specific tasks. If you don't know what a skills file is in the context of a code-generating LLM, take some time to find out before moving ahead.)

Git for the LLM to use

As I'll explain later, Ralph uses git, so you'll need a git account and you'll need to create a repo for this project. I used my GitHub account, so I know GitHub works fine for this.

The Product Requirements Document (PRD)

This is where the fun starts. You need to write a Products Requirements Document using Markdown. The PRD lists all the requirements, each requirement being a "bite-sized chunk". Here's an excerpt from a PRD.md file on my system.

MBTA-002: How the app appears to users

Description

    • The app will consist of three pages: "trains & alerts", "map & facilities", and "about".
    • It will be possible for the user to easily navigate between pages (e.g. using a tab control or buttons).

Acceptance criteria

    • There are three pages on the app: "trains & alerts", "map & facilities", and "about".
    • On each page, the user can navigate to the other pages using a control, e.g. a tab control or buttons.

Here's what's going on

  • The PRD consists of multiple sections like this one. Each section is a "bite-sized chunk" of functionality the LLM can generate code for. Think of the sections as individual requirements.
  • The section (or requirement) title includes an ID (MBTA-002) and a descriptive title.
  • The Description sub-section contains bullet points that describe the functionality you want. Remember, the point of the Ralph loop is to keep things simple, so keep the sub-section short.
  • The Acceptance criteria sub-section states the criteria the generated code must pass. If the code passes, the LLM moves onto the next requirement. If it doesn't pass, it repeats the code generation process (there's more to this I'll discuss later).

Anyone with good Product Management skills should be able to quickly build a PRD like this.

(In practice, the Acceptance criteria sub-section looks a lot like the Description sub-section. What I do is write up the Description sub-section, then ask my LLM to add acceptance criteria based on my Description. I then add in any new acceptance criteria I can think of.)

PRD.md to JSON

The Ralph loop processes a JSON file, so the next step is the production of a JSON file from the PRD.md file. This is done using the skill you installed earlier. It's a simple call to a bash script; on my Cursor installation, the script is called convert.sh.

The output is a long JSON file consisting of multiple records. Each record is a requirement taken from the PRD.md file. Here's the JSON record for the requirement in the previous section. 

{

"id": "2.1",

"category": "ui",

"story": "Build base template with BosWay branding and navigation between three pages.",

"steps": [

"Header shows BosWay and page context e.g. BosWay - about (MBTA-001).",

"Add tabs or buttons to switch trains & alerts, map & facilities, about (MBTA-002)."

],

"acceptance": "Three routes work; every page can reach the other two; titles consistent with PRD.",

"priority": 3,

"passes": false,

"notes": ""

},

This JSON record is so important, I'm going to ask you to take a closer look at it. You can see the Description and the Acceptance criteria here, albeit worded differently. The other three sections to look at are priority, passes, and notes.

  • priority tells the Ralph loop what to work on next (start with the highest priority and working down).
  • passes. This starts as false. If the LLM successfully implements the requirement, it sets this value to true.
  • notes. This contains notes for the LLM on the next pass through the loop. Let's say the loop fails the Acceptance criteria, the notes field will contain details on the failure. On the next pass of the loop, the LLM uses these notes to try and do better. What generates these notes? The LLM.
The fields in the JSON records are read and updated by the Ralph loop. There's no human in the loop. In practice, you probably won't even view the JSON file.

Once you've generated the JSON file, you're ready to run the Ralph loop.

The Ralph loop

The Ralph loop takes the JSON file as input and processes the requirements one-by-one, starting with the most important. The bash file to do it is called start.sh on my system and it's a little complex. I'll talk through how it works at a high level, leaving out some advanced bits.

Before starting the loop, the code performs various checks, e.g. the JSON file exists, the git settings are correct and so on.

The script then moves onto the Ralph loop. Because the Ralph loop does a lot, I'm going break it down piece-by-piece.

  • On each trip round the loop, the code starts with some checks. It checks if the process is rate-limited on the AI API or if there are other reasons why it can't continue.
  • From the JSON file, it reads the requirement with the highest priority where passes is false.
  • It passes this requirement to the AI API along with the current git code version.
  • The AI generates code, or changes the existing code, to meet the requirement.
  • The AI generates tests based on the acceptance criteria.
    • If the tests pass, the AI updates the JSON passes field to true.
    • If the tests fail, the AI may update the notes field to provide a hint how to do better next time round. (Remember, the passes field is false by default so it doesn't change the value if the loop fails.)
  • The loop saves the generated code to a local git branch.

In the loop, there are some more advanced bits and pieces I'm going to briefly mention here that might be important to you:

  • There are API call timeouts.
  • You can set a maximum number of iterations to prevent the loop getting stuck and burning through your tokens.
  • There's a circuit breaker that can stop the loop if zero files are changed or if the same error is detected on multiple loops.
  • You can set a rate limit to prevent the LLM provider from banning you.
There main Ralph file (start.sh) calls several bash scripts to run checks etc.

When the Ralph loop finishes, you should have the code for your project. In practice, you'll need to tweak what you get back, but in my experience, you'll be very close.

How long the loop takes depends on the thoroughness of your PRD and the size of your project. As a general rule of thumb, a smallish project (e.g. building an interactive web app based on a simple data source) might take an hour.

Cost!

Ralph burns through API calls. Most LLM providers will give you a limited number of API calls per month which is separate from your token allocation. Even one Ralph project can burn through your entire API allocation. The bottom line is, Ralph can be an expensive thing to play with (low hundreds of USD to properly experiment). I suggest you think carefully about your projects and test Ralph in a considered way.

The reality

I've made it sound like the Ralph process is quite smooth. Right now, it isn't, there are bumps along the way, for example, the setup process is a little complicated, the Ralph loop reporting needs a bit of user-friendly tweaking, the online descriptions aren't as helpful as they should be, and so on.

BUT.

It works and it works well.

My experience

It took me some effort to get Ralph up and running, but once I figured it out, it blew me away. It built an entire project without human intervention and it got it nearly right. Importantly, I realized the bits it missed were gaps in the PRD. In other words, I needed a better spec.

The Ralph loop changes the balance of skills in favor of a more detailed up-front spec that anyone with product management skills can write.

That's quite a profound change.

My recommendations

I do recommend you try a Ralph loop for yourself and I have some suggestions for making your experimentation easier.

  1. Allocate enough setup time to install skills etc. This can be frustrating, so be prepared.
  2. Choose a project you've done before. This means you know what the end result should be.
  3. Write a very detailed PRD as described above. Use an LLM to add acceptance criteria and add some of your own. Thoroughness here is key.
  4. Run the Ralph loop.
  5. Compare the Ralph results to your prior results.

Good luck!

Tuesday, March 10, 2026

Arthur C. Clarke and AI

The history of AI

I was looking over the history of AI and I was struck by how far ahead of the curve Arthur C. Clarke was. It's not just technical issues either, he was way ahead on the cultural impacts as we'll see. Of course, Clarke was too optimistic about when AI would arrive, but I think we can forgive him that.

(ITU Pictures, CC BY 2.0, via Wikimedia Commons)

Clarke and AI in his fiction

Clarke wrote quite a lot about AI and computing. The most famous example is the psychopathic AGI HAL 9000 in the 1968 movie "2001: A Space Odyssey", but he had been writing about computing for some time. In 1953, he published "The Nine Billion Names of God" which has a computer as a central element, and there followed several novels and stories through the 1950s and 1960s. In 1979's, "The Fountains of Paradise", one of the characters has a medical implant that can synthesize speech to call for help if the wearer has a medical emergency. 

Clarke's AI futurism

Although he's mostly known today as a science fiction writer, Clarke also popped up on TV as a futurist, giving his thoughts on how technology might develop. This included speaking about AI and its implications. Listening to these recordings now is eye-opening as we'll see.

The first clip is from 1964. Some of his futurism is (way) off, but a surprising amount is accurate. I was going to just give you a link to the AI piece, but the whole clip is worth listening to.

Here's a Nova episode from 1978 about the new "thinking machines". Clarke's segments are worth viewing. He speaks at the start, and at 34:44, 36:27, and most importantly at 41:35. If you want a bit of a chill, go to 52:48.

If you didn't know these clips were from 1978 and had the transcript alone, when would you think they had been recorded?

Ahead of his time: society vs technology

I was at a conference in 2025 where experts were speaking on AI, shockingly, they focused exclusively on technology without giving a moment's thought to the impact on employment and society. It's apparent to me that Arthur C. Clarke in 1978 had more foresight than some of the experts in 2025.

Given his foresight, it's slightly surprising Clarke didn't explore the themes of super-intelligent AIs displacing people in his fiction. It would have been interesting to read a Clarke novel with societal AI change as a backdrop. 

Monday, March 9, 2026

Rendezvous with Rama

I saw some news about a possible movie adaptation of “Rendezvous with Rama” and it set me thinking again about the book and what I thought about it. There’s quite a lot here, so I thought it would be worth sharing in a blog post. Let’s start with some history.

Arthur C. Clarke

Clarke (born 1917) was the pre-eminent British science fiction writer in the mid part of the 20th century with a prodigious output of novels and short stories. Globally, he was considered one of the “big three” of science fiction and he sold well in the English-speaking world and beyond. 

With Stanley Kubrick, Clarke wrote the screenplay for “2001: A Space Odyssey”, which was based on his 1948 short story, "The Sentinel".  The movie's psychotic HAL 9000 computer was an example of his fascination with new field of AI, though he would have been aware of the real-world “AI Winter” that came in the early 1970s.

I think it’s fair to say that much of Clarke’s fiction was driven by story rather than serious character development; many, but not all, of his characters seem a little one-dimensional and the dialog is sometimes flat.  Unfortunately, parts of the misogynistic and class-based attitudes of the time leak into some of his writing (notoriously, this includes Rendezvous with Rama). To a degree, this is surprising because Clarke himself was gay, but perhaps none of us can fully escape the attitudes of our times.

Clarke emigrated to Sri Lanka in 1956, where he lived until his death in 2008.

The story of Rendezvous with Rama

In the year 2131, Spaceguard detects a large object entering the solar system which it later names “Rama”. A probe detects that it’s a 20 x 50km cylinder, obviously constructed by aliens. Because of its trajectory, the only crewed space vessel that can intercept it is the space freighter Endeavour. Endeavour’s crew aren’t explorers, they’re just a well-trained freighter crew who happen to be in the right place at the right time. The crew intercept Rama and board it.


(Rama as imagined by Nano Banana)

Inside Rama, they find several city-sized clusters of objects and a central cylindrical sea, but no life and no controlling AI. As Rama gets closer to the sun, it warms up and comes to life, meaning strange robotic lifeforms start appearing and doing things the crew don't understand. One of the crew explores deeper into the interior (in a very contrived way!) and has to be rescued, which brings some elements of danger into the novel (which up to this point has been a “space procedural”). The rescue is against the clock as the crew know their time on Rama is limited because of its flight path.


(The inside of Rama, as imagined by Nano Banana.)

Unfortunately, Rama is seen by a threat by some human groups, and the whole object is in danger, requiring the crew on the Endeavour to carefully defend Rama.

After the crew save Rama, and themselves, they leave Rama as it gets closer to the Sun. Rama then heads off towards the Magellan cloud, leaving a lot of unanswered questions.

The book was published in 1973.

Let’s turn to some of the themes in the book.

The crew

In movies like Alien, ships' crews are portrayed as space “truckers”: rude, crude, and rebellious. They have some level of training, but they’re not experts by any means. They have problems following orders and working as a team, which adds some tension and drama to the movie, but mean the crew are in trouble when things go wrong. 

The crew of the Endeavour are very different; they’re highly trained, they work as a team, and they can follow orders. There’s a pointed discussion early on about avoiding heroics and working together; the ethic of quiet competence permeates the book. I’ve heard the book described as competency porn, and I agree. This isn’t a crew of space truckers, it’s like the crew of a supertanker or some other ocean-going vessel. These types of ships' crews have to work as a team and be self-reliant, making repairs underway if necessary. To the extent that a spacecraft is more like an ocean going vessel than a truck, Clarke's set-up feels more realistic.

A big part of the crew are the chimpanzees engineered to have a higher IQ that enables them to do some jobs that would otherwise be done by humans. Notably, these simps stay on the Endeavour and I think they're an underused part of the story. I also get the sense that the simps are a replacement for the AIs and robots that would otherwise run things.


(Nano Banana.)

AI?

Clarke talked a lot about AI, but in this novel, AI is conspicuous by its absence. There are no self-aware AIs in Endeavour or in Rama. I’m speculating, but I think Clarke would have seen AI go “off the boil” in the early 1970s. Perhaps he felt that after HAL in 2001, there was nowhere new to go with AI stories. Of course, by not having an AI in Rama, Clarke can keep the mystery – there’s no sentient AI that tells the humans everything they want to know.

Rama is alien

This was my second big take-away from the novel. Rama feels very alien, from the cylinder to the biots, to the way it works. Rama makes no attempt to explain itself to the crew of the Endeavour and there are no clues explaining “why”. I very much get the sense that something non-human built and operated this thing for its own purposes. The crew leave Rama with many more questions than answers.

Wonder

When I first read this as a teenager, I came away with a huge sense of wonder. What is this thing? Who sent it? Why did they send it? When I re-read it many years later as an adult, I didn’t quite get that same sense of wonder, but maybe that’s because I’m more jaded now. 

Wonder seems to have fallen out of favor with sci-fi writers. I can't remember reading a recent book that gave me a sense of awe or grandeur.  On the other hand, characterization and dialog are very much in favor (which is a good thing), I've read a lot of recently published books with vivid characters and dialog.

With the death of wonder, I can't help feel we've lost part of what made the genre a bit different.

Subsequent books

There are some sequel novels written by Gentry Lee. My advice: don’t read them.

Movie version

Rama isn’t an action-adventure book, but it does have some adventure themes and it does ask some thought provoking questions. It would plainly have to be a big-budget sci-fi movie.


(Nano Banana)

Morgan Freeman has spent decades trying to bring the book to the screen without success. However, as of 2021, the film is in “development” with Denis Villeneuve (“Arrival”, “Dune”) writing the script and set to direct it. Sadly, Villeneuve will work on the new James Bond movie and other projects first, so a Rama movie is still a few years in the future at best.

Overall thoughts

It’s true that you can never go back. On re-reading the book as an adult, I saw all the flaws I didn’t see as a child (including a notorious passage), and I saw little of the wonder and excitement I felt back then. The characterization is a bit flat, as is the dialog. Some of the scenarios the crew find themselves in on Rama feel a bit contrived. The politics feel off.

But….

The book offers a more intelligent view of what a first contact might be. Nothing is trying to eat you or conquer you, and nothing is trying to be your friend or show you the galaxy. The aliens just don’t care and do their alien things. 

The humans in the book aren’t super men and women, but neither are they cynical individualists. They’re just competent people working together as a team.

These ideas of alien aliens and competent humans make the book different and noteworthy. 

Is the book flawed? Yes. Is it worth reading? Yes. Will I be in line to see the movie? Hell yes.

Wednesday, February 11, 2026

Data is the new Lego

In 2018, I wrote a company blog post. As with most corporate content of this type, it was eventually deleted. But I liked what I wrote and I want to keep it, so I found it on the Wayback Machine and I'm reposting it here.

Reposting it serves another purpose. My post was plagiarized by someone who claimed it as their own. I want to own my work and not have other people claim it as theirs. Plagiarist have an easier time cheating if the original is hidden away on the Wayback Machine.

You can find the piece on the Wayback Machine here: https://web.archive.org/web/20190820192824/https://www.truefit.com/en/Blog/August-2018/Data-is-the-New-Lego 

It was written for the company True Fit: https://truefit.com/

(Gemini)

Here's the post.

-----------

When I was a child, I used to love playing with Lego, or “Legos” as my American friends often say; my brothers and I built spaceships and trucks and houses and animals. As time went on, our creations became more ambitious, functional, and lifelike. We could each have insisted our Lego was our own, but by pooling resources, we collectively went further. Family and friends gave us Lego including unusual and hard to find bricks, which enabled us to make more accurate models. We were growing up too, and as our play became more sophisticated, we learned how to build better models.

I’m not young anymore and my bones creak on cold mornings, but I still remember playing with Lego as I go to work each morning and play with data to build models. Using data to solve real world problems, like style, fit, and size recommendations, is surprisingly like my childhood Lego memories. To build something useful you need lots of data, data diversity, and the knowledge to build the right models in the right way.

If you don’t have enough Lego bricks, the things you build aren’t realistic; the model is crude, the colors don’t match, and there are gaps. It’s the same with machine learning and computer models; if you don’t have enough data, your models are crude, and you have quantitative and qualitative errors. The history of computer modeling is rife with examples of people making bad decisions using models made with incomplete data. In dealing with style, fit, and size recommendations, not enough data means giving bad advice because your models are too crude to accurately model people and garments. This is where pooling data wins; by pooling our Lego, my brothers and I could build what we wanted; in fashion, by pooling data from many retailers, you can build better models because you have a more complete picture of consumers’ behavior and the unique style characteristics, size, and shape of garments.

To build a good quality Lego model you need a diversity of pieces – models built with just the standard 2x4 bricks are crude and inaccurate. This is where getting Lego from friends and family was so useful – we got more diverse bricks that let us build more accurate models. In fashion, you need a diversity of data on people and garments too. Simply extrapolating from the average size to plus sizes is like using 2x4 bricks for everything; one size does not fit all and you end up with something that isn’t accurate for users who aren’t ‘average’.

Simply assuming US consumers and apparel are the same as German consumers and apparel is like using the same few Lego bricks for different models; different markets need different data. Simply believing a $20,000 dress fits the same as a $100 dress is like building Lego models when the special pieces you need are missing; it’s the kind of thing you do when you don’t have the data you need. In fact, having data on $100 and $20,000 dresses lets you build richer models that make better recommendations for all dresses. The key to good modeling is having data on a diverse set of consumers and garments. 

Young children make crude Lego models, the colors don’t match and the shapes are wrong; older children build working models with careful color schemes. A similar thing happens with data and algorithms. As you get to know and manipulate your data, your algorithms, and their interactions, you come to understand their limitations and you strive to build something better. As time goes by, increasing volumes of data point out the flaws in your work and you fix them– your models become better and better. In other words, the learning curve applies to building Lego and computer modeling.

It might be a brutal childhood truth, but the children with the most Lego, the best pieces, and the time to play produce the best models. The same brutal truth applies for any AI based machine learning or computer modeling project. The projects with the biggest data volumes, the most diverse data, and the best teams to use that data will produce the most accurate models. That’s why it’s fun to play with the massive data set from True Fit’s fashion Genome: it includes data from the largest number of retailers and brands; there’s a diversity of country, people sizes, and garments; and my colleagues know what they’re doing. There’s the added benefit of doing something novel and helping people find clothes they’ll love, that suit their personal style preferences, and will fit and flatter them – Lego models only make a few people happy but style, fit, and size recommendations can make millions of people happier by helping them connect more easily with the clothes and shoes that better express who they are and how they feel. Coming to work each day, it’s like playing with the world’s largest Lego set and it makes me happy.

Sometimes late at night, when it’s quiet and there’s no-one around to judge, I quietly put together Lego models. It’s a consoling and comforting reminder of my childhood, like eating ice cream, playing chase, and England losing in the World Cup. Lego has taught me a lot about data and models and collaboration. But there’s one big difference between building Lego models with my brothers and building computer models with my colleagues: I don’t fight with my colleagues quite so often.

True Fit is determined to improve the customer shopping experience by using its rich data collection from thousands of brands to provide accurate size recommendations. A larger collection of Lego increases the size of scope of projects that can be built just as a vast data collection increases the scope of customers who are provided with accurate style, fit, and size recommendations. To learn more about True Fit's data collection, called the Genome, visit here.

The perceptron

Why study the perceptron?

Perceptrons were one of the first learning systems and an important early stepping-stone to most recent AI innovations. That alone would be motivation enough to study them, however the reaction of the press, and the consequences of the hype, are a cautionary tale for us in 2026.

I'm going to share with you the why and the how of the perceptron, with some of the consequences of the hype.

Why do we care about systems that learn?

Go back to the 1950s, why would you care about a system that can learn? There’s the obvious coolness of it, but there are important real-world applications.

Photo analysts study reconnaissance photos looking for hidden bunkers or other items of military significance. The work is tiring and boring at times, but it’s hard to automate because it relies on human interpretation rather than a hard and fast set of rules. The “enemy” constantly changes how they disguise their installations, so whoever or whatever is analyzing photos must continually learn.

A similar problem occurs in post offices. If a post office wants to automate letter sorting, it has to automate reading handwritten addresses. Each person’s handwriting is different, which means creating definitive rules about letter or number formation is hard.

A learning system can adapt itself to new information and so stay productive when things change. In practice, this means it can be taught to recognize a new way a country is disguising a bunker or a new way someone is writing the number 5. It doesn’t require its creators to continually tweak settings. Of course, these automated systems can process letters or images etc. much faster (and cheaper) than human beings, which makes them very attractive.

Given the demand existed, how can you create a system that learns?

How do biological systems learn?

The obvious learning systems are biological. By the 1950s, we’d made some progress understanding how brains work, in particular, we had a basic understanding of how neurons worked, which are the lowest level of processing in the brain. 

Neurons take sensory input signals from dendrites into the soma, where the input is “processed”. If the input signal crosses some threshold, the soma fires an output signal (an action potential) through an axon. Neurons learn by changing the way they “weight” different dendrite signals, so changing the conditions under which they fire. 

The output of one neuron could be the input to another neuron and real brains have layers of processing. 

The picture below shows the arrangement for a single neuron.

(Gemini)

My explanation of how neurons work is very simplistic and in reality, it’s much more complicated. In real brains, neurons learn together and there are other biological processes going on involving dendrites. If you want to read more about biological neurons, here are some good references:

The perceptron 

In 1957, at the Cornell Aeronautical Laboratory in Buffalo, New York, the psychologist Frank Rosenblatt was studying human learning (specifically, the neuron) and trying to replicate it in software and hardware. His team built a prototype system, called the perceptron, that could “learn” in a very limited sense. The learning task was simple image classification.

(Rosenblatt and the perceptron. National Museum of the U.S. Navy, Public domain, via Wikimedia Commons)

The Mark I Perceptron input was a 20x20 photocell array; a photocell is very limited form of digital camera. These 400 inputs were fed to “association units” that weighted the inputs. The weights were set by potentiometers that were adjusted by electric motors. Importantly, the initial weights were random to avoid bias. The system summed the weights and used a simple threshold algorithm (response units) to decide the image classification, if the sum of the weighted signals was above the threshold the algorithm output a signal (a true output), if the sum of the weighted signals was below the threshold, the algorithm did not output a signal (a false output). Technically, the name of the threshold function is a Heaviside step function. If the perceptron made an error, the relevant weights were adjusted. The perceptron required 50 training iterations to reliably distinguish between squares and triangles.

(From the perceptron user manual.)

In 2026, this sounds really basic, but in 1957 it was a breakthrough. Rosenblatt and his team had demonstrated that a machine could learn and change how it “sees” the world.

References:

The perceptron theory

Here’s a simple representation of the perceptron. The inputs from the photocell are fed in and assigned weights. There’s a bias term to account for bias in the photocells, for example, the photocells might give a very small signal instead of zero when there’s no image. The weighted inputs (and the bias) are summed. If the weighted sum exceeds some threshold, the perceptron fires, if not, it doesn’t.

(The perceptron is a linear classifier, meaning it can only separates point on a hyperplane. In two dimensions, this means it can only separate points using a straight line.)

Mathematically, this is how it works.

\[u = \sum w_i x_i + b \]

\[y = f(u(x)) = \begin{cases} 1, & \text{if } u(x) > \theta \\ 0, & \text{otherwise} \end{cases}\]

In the vector notation used in machine learning, the equations are usually written:

\[y = h( \textbf{ w} \cdot \textbf{x } + b ) \]

where h is the Heaviside step function.

So far, this is pretty simple, but how does it learn? Rosenblatt insisted on starting training from a random state, so that gives us a starting point. Then we expose the perceptron to some training data where we know what the output should be (the data is labeled). Here’s how we update the weights:

\[ w_i  \leftarrow w_i + \Delta w_i \]

\[ \Delta w_i = \eta(t - o)x_i \]

where:

  • \(t\) is the target or correct output
  • \(o\) is the measured output
  • \(\eta\) is the training rate and \( 0 \lt \eta \leq 1\)

We update the weights and try again in an iterative loop. This continues until we can successfully predict the training data set within a certain error, or we’ve reached a set number of iterations, or we’re seeing no improvement. This is similar to how machine learning systems work today.

References:

Perceptron problems

There were lots of issues with the perceptron in its original form. Let’s start with the worst: the hype.

Rosenblatt gave interviews to the press on his system and they ran with it, but not in a good way. A 1958 New York Times article was typical, the headline read “NEW NAVY DEVICE LEARNS BY DOING; Psychologist Shows Embryo of Computer Designed to Read and Grow Wiser”, with a lede: “The Navy revealed the embryo of an electronic computer today that it expects will be able to walk, talk, see, write, reproduce itself and be conscious of its existence.” Other press stories were similarly sensational and hyped the technology. The press very much set the expectation that walking, talking AIs were just around the corner. Of course, the technology couldn’t deliver what the press forecast, which helped lead to a loss of confidence.

The technical problems varied from the straightforward to the severe.

The original perceptron used a simple threshold to decide whether to fire or not, but this caused problems for training weights. Most important training algorithms use derivatives (for example, gradient descent). A simple threshold isn’t differentiable, which means it can’t be used in these kinds of training algorithms. Fortunately, this is relatively easy to fix using a differentiable function to replace the simple threshold. There are a number of possible differentiable functions, and a popular choice is the sigmoid function. (The function that decides whether to fire or not is now called the activation function).

A more serious problem is the logical limitations of the simple perceptron. As Minksy and Papert showed in 1969, there are some logical structures (most notably, XOR), you can’t build using the simple single-layer perceptron architecture. Although multi-layer networks solve these problems, the Minsky and Papert book and their papers significantly damaged research in this area, as we'll see.

This is only a summary of the difficulties the perceptron faced. For a fuller description, check out: https://yuxi.ml/essays/posts/perceptron-controversy/

What happened next

By the early 1970s, the hype bubble had burst. Minsky and Papert’s book had an impact and governments found disappointing results from funding perceptron-based projects; projects promised big results, but in reality, very little was produced. Governmental patience eventually wore thin and eventually they concluded this form of AI research wasn't worth funding. The research money went elsewhere leading to the first “AI Winter” which lasted for a decade or so. 

Sadly, AI experienced another hype bubble and collapse in the late 1980s, a second "AI Winter". As a whole, AI research began to get a bad reputation.

The “AI Winters” bled talent and money away from neural network development, but research still continued.  Although multi-layer networks had been developed by the 1960s, it wasn’t known how to train them until the Rumelhart, Hinton, and Williams 1986 paper “Learning representations by back-propagating errors” [https://www.nature.com/articles/323533a0] popularized the back propagation method. Convolutional Neural Networks (CNNs) using back propagation and a convolutional structure were demonstrated in 1989. With these technologies as the backbone, LLMs were developed starting in the mid-to-late 2010s. It’s only the enormous success of LLMs that has brought a flood of money into AI research and a resurgence of interest in its origins.

Rosenblatt had a wide variety of research interests, including astronomy and photometry (measuring light). By any measure he was a genius. Unfortunately, in 1971 he died at the age of 43 in a boating accident. His death was just a few years into the first "AI Winter", so he saw the hype and the subsequent bubble bursting. Sadly, he never go to see how the field eventually developed.

Thoughts on the story

The original perceptron was very much based on what had gone before, but it was a breakthrough and ahead of its time, which was part of the problem. The necessary technology wasn’t there to advance quickly. Unfortunately, the hype in the press, fed by  Rosenblatt and others, set unrealistic expectations. While great for short-term research funding, it was terrible for the long-term when the hype bubble burst.

AI as a whole has been prone to hype cycles through its entire existence. It's no wonder there's a lot of discussion online about the latest AI bubble bursting. My feeling is, it is different this time, but we're still in a bubble and people are going to get hurt when it eventually pops.

Monday, February 9, 2026

Learning by hand is better than learning by AI

Accelerating learning with AI?

Recently, I've been learning a new LLM API from a vendor. There's a ton of documentation to wade through to get to what I need to know and the vendor's examples are overly detailed. In other words, it's costly to figure out how to use their API.

(Gemini)

I decided to use code gen to get me up and running quickly. In the process, I found out how to speed up learning, but equally important, I found out what not to do.

Code gen everywhere!

My first thought was to code gen the entire problem and figure out what was going on from the code. This didn't work so well.

The code worked and gave me the answer I expected, but there were two problems. Firstly, the code was bloated and secondly, it wasn't clear why it was doing what it was doing. The bloated code made it hard to wade through and zero in on what I wanted. It wasn't clear to me why it had split something into two operations, despite code gen commenting the code. Because I didn't know the vendor's API, I couldn't be sure the code was correct; it didn't look right, but was it?

Hand coding wins - mostly

I recoded the whole thing by hand the old fashioned way, but using the generated code as an inspiration (what function to call and what arguments to use). I tried the LLM calls in the way I thought they should work, but the code didn't work the way I thought it would. On the upside, the error message I got was very helpful and I tracked down why it didn't work. Now I knew why code gen had made two LLM calls instead of one and I knew what outputs and inputs I should use.

The next step was properly formatting the final output. Foolishly, I tried code gen again. It gave me code, but once again, I couldn't follow why it was doing what it was doing. I went back looking at the data structure in detail and moved forward by hand.

But code gen was still helpful. I used it to help me fill in API argument calls and to build a Pydantic data structure. I also used it to format my code. Yes, this isn't as helpful as I'd hoped, but it's still something and it still made things easier for me.

Why code gen didn't work fully

Code gen created functioning code, not tutorial code, so the comments it generated weren't appropriate to learn what was going on and why.

Because I didn't know the API, I couldn't tell if code gen was correct. As it turned out, code gen produced code that was overly complex, but it was correct.

Lessons

This experience crystallized some other experiences I've had with AI code gen.

If I didn't care about understanding what's going on underneath, code gen would be OK. It would work perfectly well for a demo. Where things start to go wrong is if you're building a production system where performance matters or a system that will be long-lived - in these cases the why of coding matters.

Code generation is an accelerator if you know what you're doing. If you don't know the libraries (or language) you're using, you're on thin ice. Eventually, something bad is going to happen and you won't know how to fix it.

Wednesday, January 14, 2026

Replit vs. Cursor - who wins?

Building Business Apps - Cursor vs. Replit

For a while now, I've been very interested in using AI to build BI-type apps. I know you can do it with Cursor, but it requires a strong technical background. I've heard people have had great success with Replit, so I thought I would give it a go. I decided to build the same app in both Cursor and Replit. It's a kind of battle of the tools.

(Gemini.)

For my comparison contest. I chose to build a simple app that shows the weather and news for a given location.

Round 1: getting started/ease of use

I gave both contenders the same prompt and asked them to build me an app. Both tools gave me an app in about the same time. However, I found Replit much, much easier to use; by contrast, Cursor can be tough to get started with.

Round 1 is a decisive victory for Replit.

Round 2: building the app

Both apps had problems and I needed to tweak them to get them working. I found I had to give Replit multiple prompts to fix problems; problems that just didn't occur in Cursor. Replit got stuck on some simple things and I had to get creative with prompting to get round them, all the while my AI token consumption went up. Cursor didn't need this level of imaginative prompting.

I'm giving this round to Cursor on points.

Round 3: editing the visual layout

Replit let me edit the visual layout of the app directly, while Cursor did not. I know Cursor has a visual editor, but I just couldn't get it to work. This is of course an ease of use thing, and overall, Replit is easier. For this app, I didn't need to tweak the layout but it's an important consideration. 

Round 3 is a decisive victory for Replit.

Round 4: what is the app doing?

I wanted to know what the apps were doing "under the hood" so I wanted to see the code. Cursor is unashamedly a code editor, so it was simple. By contrast, Replit hides the code away and it requires a bit of digging. On a related theme, Cursor is much better at debugging, so it's easier to track down errors.

Round 4 is a victory for Cursor.

Round 5: changing the app under the hood

I wanted to change the app "under the hood", which meant changing some of the code. Cursor generates code that's very well commented, so it's easy to see what's going on. By contrast, Replit's code is sparsely commented and I found it difficult to understand what each file did. Bear in mind though, Replit is trying to be an app creation tool not a code editor.

Round 5 is a victory for Cursor.

Round 6: running the app locally

Both Replit and Cursor did well here. This round is a draw.

Round 7: deploying the app to the web

Replit makes this really easy, There's a simple process to go through and your app is deployed. Cursor doesn't do deployment and the deployment services like Render have a learning curve.

Round 7 is a victory for Replit.

A disturbing thought

I was looking at how both apps turned out and something struck me when I was looking at the code for the Cursor app: what services did these apps use? I didn't specify what APIs I wanted to use, the AIs chose for me.

Both of these apps converted an address to a latitude/longitude, showed a map, got local news, got a climate chart for the year, and so on. But what APIs (services) did they use underneath? What were the terms and conditions of the services? What are the limitations of the services? The answer is: you have to find out for yourself. Which means either asking the AI or digging into the code.

If I sign up for an API key, I have to go to a website, read what the service offers, and accept the terms and conditions. For example, some APIs forbid commercial use, some are very rate limited, and others require an acknowledgment in the app or web page. If you build an app using an AI, how do you know what you've agreed to? Will your app get rate limited? Will you get banned for using the API service inappropriately? What are the risks? It seems like a feeble defense to say "my AI made me do it".

It looks like the onus is on you to figure this out, which is definitely a problem.

Who won?

Looking at the results of the contest, my answer is: it depends on your end goal.

If you want a tool to let you build a "simplish" app and you don't have much, if any, coding experience, then Replit is the clear winner. On the downside, it will be very difficult to add more complex features later.

If you want to build a more complex app and you have coding experience, then Cursor wins. Cursor also wins if you think that you'll need to edit the app code in the future. 

What would I chose for internal reporting or BI-type development? On balance, Cursor, but it's not a clear victory. Here's my logic.

  • I love the idea of democratizing analysis. I like giving users the power to answer their own questions. This would appear to favor Replit, but...
  • I worry about maintainability and extendability. I've seen too many cases where a one-off app has become business critical and no-one knows how to maintain it. This favors Cursor because in my view, it produces more maintainable code.

Future directions

The ultimate goal is a tool that lets a non-coder quickly and simply build an app, even a complex one, that's maintainable in the future. This could be building an app for internal use (within an organization) or external use. The app development process will be a combination of natural language prompting and visual editing. Right now, we're really, really close to that goal and it's probably arriving later in 2026.

I'm sure some readers will feel I'm being harsh when I say Replit isn't quite there yet; for me, it needs less prompting and better code layout and documentation. Cursor has a way to go and I'm not convinced they're going in this direction (they may well stay focused on code development). 

In my view, the bigger problem is not app development but data availability. To build internal apps, the internal data has to be available, which means it has to be well-described and in a place where the app development program (and the app itself) can access it. In many organizations, their data isn't as well organized as it should be (to put it politely). It's like having a car but not being able to find gas (or only finding the wrong gas), it makes the car useless. To make internal app development really fly, internal data has to be organized "good enough". We may well see more focus on data organization within companies as a result.

Both Cursor hand Replit have the advantage that they both ultimately use common languages and packages. This means that the skills to maintain apps created using them are common in any company with programmers or analysts on staff. Contrast that with BI tools where the skills and knowledge of how to use the BI tools are only in the BI group. I can see tools like Cursor and Replit encroaching more and more into BI territory, especially as app development becomes democratized.