Insane in the Fake Brain

Page content

AI has reached an inflection point that I feel should be concerning to anyone who works in a white-collar job. The capabilities of natural language and creative-based AI engines were often ridiculed over the past few decades, but recent advances have changed the picture substantially.

The reason I say this isn’t really what most would assume. The problem in a nutshell, is that while current AIs are not perfect, the sobering realization is that they don’t have to be! They just have to bee good enough. Who does their job perfectly every time? How often do we do just enough to get by?

AI is a force multiplier. One person is now capable of doing art that is good enough, or summarizing an analysis well enough, or even producing a first draft of a written work close enough, that they can emulate an entire team of people. Even if the end result of the AI only gets 90% of the way, the remaining 10% as produced by that person comes at a substantial time and cost reduction.

And AI is only getting more advanced.

Performing Surgery

The OpenAI project recently released a bot they call ChatGPT that has been making a lot of waves as people experiment with it. I wanted a quick test of what it was capable of, so I ran an experiment. I proposed this task:

Using the surgical notes outlined in the following URL:

https://bonesmoses.org/2011/portrait-of-a-heart-surgery/

Please explain the surgery to a scared six-year-old boy.

And the bot responded with this result. Keep in mind that in order to do this, it had to fetch the specified link, parse the contents, and produce a summary simplified enough that it could be understood by a small child.

Sure! I’ll do my best to explain this surgery to a scared six-year-old boy in a way that is easy to understand.

The surgery that is described in the link you provided is called a “heart surgery.” It is a type of medical procedure that is done to fix problems with the heart, which is a very important organ in our bodies. It helps us to pump blood and keep us alive.

During the surgery, the doctors will use special tools to open up the chest so that they can see the heart. They will then carefully fix any problems that they find, such as fixing holes or repairing damaged blood vessels.

This surgery is very important because it can help people who are having problems with their hearts to feel better and live longer, healthier lives. It can be a little scary, but the doctors and nurses are very skilled and will do everything they can to make sure the surgery goes smoothly and that you feel as comfortable as possible.

I hope this helps to explain the surgery a little bit. If you have any more questions, just let me know and I’ll do my best to help.

As we can see here, the bot only really did half of the task. It understood that my link was a heart surgery, but it stopped there. It explained a typical heart surgery to the boy, rather than this specific surgery. Still an impressive result, but it’s clear the AI still has a way to go before we really need to start worrying.

I tried to get ChatGPT to go into more detail about this specific surgery, but it seemed incapable of doing so. Rather than explaining each step taken during the surgery, it outlined six basic steps that would apply to any heart surgery. The surgical notes were either too complex, or its understanding too shallow to go that far. So I tried another tactic: pasting individual paragraphs and asking it to explain them to a small child.

Here’s how that went:

The doctors needed to remove some extra muscles that were in the way of the blood flowing out of the heart and into the big blood vessel called the aorta. Then, they could see the inside of the heart more clearly. They saw a big valve (a part of the heart) that went over the wall separating the heart’s lower chambers (called the ventricular septum) either completely or almost completely, depending on how they looked at it. They also saw a really big hole in the wall between the lower chambers of the heart. They didn’t see any blockages below another part of the heart called the pulmonary valve. And they saw that two other parts of the heart called the tricuspid and mitral valves were completely stuck together. The doctors were able to put special stitches along the part where the two valves were stuck together. They used a special kind of stitch called a horizontal mattress interrupted suture all around the hole in the muscular part of the ventricular septum. They tried to avoid the ventricular septum where there might be a group of muscles, but it was hard to avoid coming close when they moved from the tricuspid valve to the wall of the heart.

It proved capable of this task… to an extent. It simplified the language used by the surgeons, kept injecting “(which is part of the heart)” after unfamiliar or uncommon expressions, and suitably reduced sentence and word complexity. But it could go no further. Subsequent prompts to go into more depth, or to rephrase, only met with similar or exact output from before. It did make a small deviation upon being prompted to relay the information second-hand, however:

The doctors had to take out some extra muscles that were in the way of the blood going out of the heart. Then they could see the inside of the heart better. They saw a really big valve that went over the wall in the heart. And they saw a really big hole in the wall between the bottom parts of the heart. They didn’t see any blockages below another part of the heart called the pulmonary valve. And they saw that two other parts of the heart called the tricuspid and mitral valves were stuck together. The doctors put special stitches along the part where the two valves were stuck together. They used a special kind of stitch all around the hole in the muscular part of the ventricular septum. They tried to avoid the ventricular septum where there might be a group of muscles, but it was hard to avoid coming close when they moved from the tricuspid valve to the wall of the heart.

That’s actually impressive. It removed all of the medical terminology and really dumbed down the language so a child could explain the surgery to another child. The trick with AI in its current form, it seems, is prompt engineering. So it’s relatively clear what’s going on here. ChatGPT can comprehend language well enough to fulfill extremely rudimentary tasks. If given a corpus in a remote location, such as an URL, it integrates any commands or context into its language model along with the prompt itself.

Thus it can write variants of things its seen before, or reword large amounts of information well enough to get the point across.

Code Complete

But ChatGPT isn’t just a text parsing system. It is also capable of code generation. There are manifold examples of people asking it to perform basic programming tasks and being impressed by the results. This is where things get really wild.

I entered the following prompt into the system:

Can you write a simple Python program to validate a VIN?

And it responded with this:

def validate_vin(vin):
  # Check that the VIN is the correct length
  if len(vin) != 17:
    return False

  # Check that the VIN contains only valid characters
  valid_chars = '0123456789ABCDEFGHJKLMNPRSTUVWXYZ'
  for c in vin:
    if c not in valid_chars:
      return False

  # Check the check digit
  check_digit = vin[8]
  weightings = '8765432X098765432'
  total = sum(int(vin[i]) * int(weightings[i]) for i in range(17))
  check_digit_expected = str((total % 11) % 10)
  if check_digit != check_digit_expected:
    return False

  return True

Here’s what ChatGPT had to do to in order to produce this code:

  1. Understand VIN means Vehicle Identification Code.
  2. Find the VIN validation algorithm, which includes a length, valid character set, and a simple checksum based on position weight. Note the absence of I, O, and Q in the allowed characters.
  3. Interpret and write the checksum algorithm itself.
  4. Output everything in Python.

Now, this code contains two critical flaws:

  1. There’s no translation table for the int conversions. The letter ‘H’ for example, should be represented by an 8 in the checksum procedure.
  2. The weightings don’t properly take position 8 into account, where they’re represented by an ‘X’ rather than 10.

With that in mind, can we get ChatGPT to fix its own mistakes?

It seems that the above code is invalid since it is missing the VIN conversion table from letters to integers. Can you add that conversion?

And it actually fixed that portion of the code. That only left the ‘X’ in the checksum calculation. So I asked it to fix that too:

Very close. Now remember that Python can’t convert ‘X’ into an int for the weighting calculation. How would you handle that?

It responded oddly with this:

  weightings = '8765432X098765432'
  weightings = weightings.replace('X', '10') 

The bot is very close in concept, but string positions are not the same as array indexes in the manner demonstrated. I pointed this out and asked for another revision:

That’s not correct. By performing a string substitution for X to 10, that increases the string length by 1 and thus invalidates the weighting string. Can you modify the weighting calculation in such a way that X is interpreted as 10?

Then it used this impressive bit of code:

weight = int(weightings[i]) if weightings[i] != 'X' else 10

I talked it into fixing its bugs. With words. The final piece of code looked like this:

def validate_vin(vin):
  # Check that the VIN is the correct length
  if len(vin) != 17:
    return False

  # Check that the VIN contains only valid characters
  valid_chars = '0123456789ABCDEFGHJKLMNPRSTUVWXYZ'
  for c in vin:
    if c not in valid_chars:
      return False

  # Convert letters to numbers using the conversion table
  vin_int = ''
  conversion_table = {
    'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, 'H': 8,
    'J': 1, 'K': 2, 'L': 3, 'M': 4, 'N': 5, 'P': 7, 'R': 9, 'S': 2,
    'T': 3, 'U': 4, 'V': 5, 'W': 6, 'X': 7, 'Y': 8, 'Z': 9
  }
  for c in vin:
    if c in conversion_table:
      vin_int += str(conversion_table[c])
    else:
      vin_int += c

  # Check the check digit
  check_digit = vin[8]
  weightings = '8765432X098765432'
  total = 0
  for i in range(17):
    # If the weighting is 'X', use 10 instead of 'X'
    weight = int(weightings[i]) if weightings[i] != 'X' else 10
    total += int(vin_int[i]) * weight
  check_digit_expected = str((total % 11) % 10)
  if check_digit != check_digit_expected:
    return False

  return True

And it works. Is it the most elegant or efficient? Probably not. But it performs the requested task accurately, and better than some coders I’ve seen operating in the industry. What’s more, I proceeded to ask it to convert the final result to Golang, and then Scheme, and it did so within seconds. I can count the amount of people I know who can do that on one hand. It can do this for dozens of coding languages.

As someone who works in IT, I find that particularly sobering. Remember, the end result doesn’t need to be perfect, just good enough. One properly trained senior-level engineer can be infinitely more productive than before, or at least require fewer underlings cranking out simple APIs on a larger project.

The Mind’s Eye

It doesn’t stop at language models; artists aren’t safe either. Back when I finished Rabbit Rue in 2010, I commissioned an artist for the cover. I found her in Artist Alley at Anime Central, and I couldn’t have been more pleased with her work.

your_img

What else could you possibly want in a zombie rabbit terrorizing a small town?

There’s an AI system called Stable Diffusion that lets you write in text prompts, and it will generate suitable images. The online versions are functional, but unlike ChatGPT, Stable Diffusion is available as an engine you can run on your own computer. I found Stable Diffusion UI to work exactly as advertised, and started writing prompts.

I wanted to see if I could either get close to the image my artist produced, or come up with something nearly as good. The first few attempts weren’t great, and since they’re influenced by a random number generator, were fairly inconsistent. But as I revised my prompts and kept generating more images, something finally caught my attention.

The prompt I used was pretty grim:

Extremely dark painting of a ugly tattered rabbit corpse with matted fur crouching in front of a boarded-up haunted Victorian house obscured by dead trees and dense fog on a dark moonlit night, watercolor

I was generating four images at a time, and this is the one which caught my eye:

Ohhh, creepy!

Ohhh, creepy!

The software allows you to choose a specific image, and have it generate more similar images, so I was curious if it could get even closer to the picture in my head or from the artist. So I had it generate several more four-image batches until this result appeared:

I just crapped my pants

I just crapped my pants

I was actually stunned when that image appeared. It was literally perfect. If I’d written Rabbit Rue more recently, I would have used that image in a hot second, and never even bothered to attend an anime convention in search of an artist. Maybe I would have anyway, just to commission a piece or two to see if they could give me something better, or so I could “shop locally” so to speak.

But the fact remains that the final image was exactly what I wanted. People say AI can’t simulate or produce real art, and they’re right. But I wrote an obscure book about an undead rabbit and a small backwoods town, and I’m pretty sure no art for that esoteric combination exists, aside from the one I commissioned. The AI legitimately produced that output from its base image corpus, style influence, and its interpretation of the prompt I provided.

In the End

AI is here and it isn’t going anywhere. It can help us produce things that never existed before, summarize things that do, or just dream up random stuff that can inspire the artist within us all. It’s both terrifying and amazing all at once, and will fundamentally transform society as we know it.

We’re in the early days of this technology. IT guys occasionally joke “Don’t make me replace you with a very small Perl script.” But now the shoe may be on the other foot. Given how much outsourcing already plagues the industry, is there any other conclusion? Where code is sent offshore to some code farm and often requires multiple revisions due to language or other comprehension barriers, sometimes even total rewrites by a local team once the final delivered version is found to be an unmaintainable mess? What if we could instead gently guide an AI to get us 90% of the way to the final product, and a small team of skilled individuals put in the final bits of work.

How many journalists barely qualify as overpaid outrage instigators to drive clicks? How many people even read the news these days? Maybe an AI-generated summary is all they need or even want. What if I could just tell an AI to “Write a snide piece about the recent news regarding Brad Pitt’s junk being tattooed with polka-dots,” and the resulting article was perfectly adequate to maintain visitor traffic?

Whatever you do, never underestimate this technology. If you asked me even two weeks ago whether AI would be able to write passable code, I would have chuckled and replied, “No way.” The art I personally created through AI was equally unprecedented. This is completely uncharted territory for humanity, with far-reaching implications. Hopefully we’re capable of harnessing it responsibly.

Until Tomorrow