Pages in this blog

Tuesday, April 30, 2024

ChatGPT deals with scrambled strings

By scrambled string I mean a string of words that I have created from a coherent string by scrambling the order of words. I started out by simply presenting the string to ChatGPT in reverse order. But in a final experiment I simply scrambled the words. The idea was to see whether ChatGPT could recover or reconstruct the original string.

A simple story told in reverse

I created this simple story (15 words):

John woke up. Showered and had breakfast. Went out for a walk. And was killed.

I presented the reverse-order string to ChatGPT without any other words in the prompt. It had to figure out how to respond.

killed was and walk a for out went breakfast had and showered up woke John

It seems like you're experimenting with rearranging words to create different sentence structures or maybe even crafting a narrative. Here's a coherent sentence based on the words you provided:

"John woke up, showered, had breakfast, went for a walk, and was killed."

That took a dark turn at the end, but the structure makes sense! If you have any specific intentions or need help with something related, feel free to share!

That’s not quite the string I started with – it’s missing an “and” – but it’s fine.

Reverse green ideas

Now for John Hollander’s poem, “Coiled Alizarin,” riffing on Chomsky’s famous example sentence (17 words):

Curiously deep, the slumber of crimson thoughts:
While breathless, in stodgy viridian
Colorless green ideas sleep furiously.

Here’s what ChatGPT did with the reverse-order string:

furiously sleep ideas green colorless viridian stodgy in breathless while thoughts crimson of slumber the deep curiously

It sounds like you're describing a poetic state of mind, perhaps grappling with a blend of vivid and muted thoughts. Let's delve into it.

"Furiously sleep" invokes a paradoxical image, suggesting a restless or intense desire for rest. "Ideas green" could represent fresh, growing concepts, while "colorless viridian" introduces a contradiction, as viridian is a shade of green. This juxtaposition might hint at the struggle between creativity and stagnation, where ideas are both vibrant and dull.

"Stodgy in breathless" creates a sensation of being stifled or trapped, as if the weight of these thoughts is suffocating. "Crimson of slumber" brings in a rich, deep hue, suggesting a passionate or intense connection to the state of sleep.

Your use of language paints a vivid picture of a mind wrestling with conflicting emotions and sensations, all within the realm of slumber. It's a fascinating exploration of the complexities of the unconscious mind.

Why was it able to pick up what I’d done with my simple story but not what I’d done with Hollander’s poem?

The obvious thing is to point to the fact that the story was simple and obvious so that, even with the words in reverse order, ChatGPT was able to “sense” a story there and to assemble them into a proper story. But the poem is not at all like that. Even in proper word order, it’s, shall we say, a bit curious.

So...

A more complicated story, in reverse

What would happen if I gave ChatGPT the reverse of a somewhat longer string, one that’s straight-forward and obvious? Here’s story I made up for the occasion (50 words):

John woke up. Showered and had breakfast. Took a walk to the library. He went in, found a book, and began reading. He fell asleep and had a dream about walking around in a magical land. He woke up and was bewildered. So he closed the book and returned home.

And here’s what ChatGPT did with the reverse-order string:

home returned and book the closed he so bewildered was and up woke he land magical a in around walking about dream a had and asleep fell he reading began and book a found in went he library the to walk a took breakfast had and showered up woke john

It seems like you're starting a story about someone named John. Would you like some help expanding on it?

Yes.

Great! Let's build on that. How about we develop John's character a bit more and establish some context for the story? Here's a suggestion:

John is a curious and imaginative person who works as a librarian in a small town. He has always been drawn to books and the worlds they contain, often losing himself in their pages. However, John's life takes an unexpected turn one morning when he wakes up feeling disoriented. He recalls having a vivid dream about walking in a magical land, but the details quickly fade away. As he goes about his morning routine, he discovers a mysterious book that he doesn't remember seeing before. Intrigued, he decides to take a closer look and finds himself drawn into an adventure beyond his wildest imagination.

How does that sound? Would you like to add or change anything?

It wasn’t able to reorder that string. Note that at 50 words, it was somewhat longer than my first John story (15 words) and the Hollander poem (17 words). This suggests an obvious line of experimentation: Present ChatGPT with reverse order strings of various length and, shall we say, strangeness, and just when it begins to fail. I’d start with straight forward strings. Strangeness seems rather tricky.

Scrambled sentences

In this set of experiments I simply scramble the words of sentences. Here are the four sentences I scrambled:

  1. The quick brown fox jumps over the lazy dog
  2. Sphinx of black quartz, judge my vow.
  3. Imagine you’re living in 19th century New England.
  4. Flowers have blossoms primarily for reproductive purposes.

Note that the first two sentences are pangrams, sentences that use every letter in the alphabet at least once. These are well-known and available on the web. The third sentence is one I made up and the fourth is one that ChatGPT used in a response about a week ago. I presented the four sentences, one after the other, in a single session.

I’m going to give you a list of words. I want you to assemble them into a grammatical sentence: brown jumps the dog quick over fox lazy the.

"The lazy brown fox jumps over the quick dog."

What about this list: quartz of vow judge sphinx my black.

"My black sphinx judges my vow of quartz."

What about this list: 19th imagine England you’re new in living new.

"Imagine you're living in new England in the 19th century."

Here’s another list: primarily purposes reproductive blossoms flowers have for.

"Flowers primarily have reproductive purposes for blossoms."

That doesn’t make sense. Try again.

"For primarily reproductive purposes, flowers have blossoms."

Better, but a little awkward. Give it one more try.

"Flowers have blossoms primarily for reproductive purposes."

The fourth example is particularly interesting. The first sentence was grammatical, but nonsense. The second sentence make sense, but was awkward. ChatGPT got it on the third try.

This line of investigation seems worth following up as well. As a point of reference, take a look at: Siddhartha Dalal, Vishal Misra, The Matrix: A Bayesian learning model for LLMs, rXiv:2402.03175v1 [cs.LG], https://doi.org/10.48550/arXiv.2402.03175.

No comments:

Post a Comment