Using openai to solve Wordle

I am trying to come up with a prompt to pick a next word in the game of Wordle. I tried a whole bunch of variations of this basic format but it keeps picking words that include letters not in the word like caret or train (in this particular instance).

Play a game to guess a five letter word. After each guess you are told how close your guess is to the word. Your next guess should take into account the information from the previous guesses. Try to guess the word in as few attempts as possible.

Guess: crane
Result: The letters c, r and n are not in the word. The letters a and e are in the corrects places in the word.

Guess:

I tried giving it even more information and it is spectacularly bad at this game, lol. I will try giving it a whole example of a complete game and try again.

I’ve tried a few more prompt ideas and engines, but no better results:

I would try including a bunch of examples of what you want to do in in the prompt, something like 50 shot learning. Show the guess progression at several different stages with desired completions. Get enough of these and you can find tune a model

I think the problem here is that it is fundamentally adversarial. It’s almost like you’d need two separate prompts or models running to do this right… hmmm… there’s an idea

What do you mean by that?

The hurdle here might even be more fundamental than the fact it’s an adversarial game. I tried a few variations of the prompt below and couldn’t reliably get it to generate words with specific letters excluded.

I wonder if it could ‘learn’ the rules given enough examples?

You have an agent with hidden information and a guesser trying to defeat it. It’s basically a two player game, hence according to game theory it’s adversarial

I don’t think it understands word rules. I’ve been trying to get it to write poetry – it knows what a sonnet looks like but it can’t grasp the rules behind a sonnet.

Things like syllables and letters seem to be beyond it, but I’d happy to be proven wrong.

Something I tried which was quite interesting was to reverse the game. Get openAI to settle on a 5-letter word and play according to the NYT rules. It chooses the word and you do the guessing. It will tell you letters are in the right place when they don’t exist and Vice versa. And when queried about it’ll say it’s sorry.

Its frustrating. I spent hours on this problem. It takes 3 minutes to solve wordle, but 2 hours of frustration trying to get ChatGPT to provide even the basics of a solution while keeping the letters in the correct order.

But I finally found a solution. An example. My first guess was stare. The second guess was rinse… The solution was ridge.

The only way that provided a solution was to ask it each time to create a compressive list of 5 letter words that ended in e. And after each subsequent guess, I just asked it to create a compressive list of words where R was the first letter( from second guess) and E was the last and didn’t contain n,s,t or a. (From first and second guess).

It provided a list and ridge was one of 10 words in the list that made sense to use. I was correct.

This only worked by asking it each time to create the list. Narrowing the words and possible choices. If you don’t ask each time, you will get stuck in a loop of words that don’t match the original criteria.

I hope this helps.

one simple change will probably improve the performance, wordle is part word game part letters game, if you give the letters of a word as a word i.e. “pencil” then that is a single token to the AI, it will not look at it as a group of letters, replace “pencil” with “p-e-n-c-i-l” and you will get a very different response, maybe including both “pencil, p-e-n-c-i-l” would be even better… enjoy!

A useful reply would focus on solving the OP’s prompt issue rather than promoting anything. Here’s a natural comment you could post:

The biggest issue is that LLMs don’t always treat constraints as hard rules unless you make them explicit. Instead of describing the feedback in plain English, try listing the constraints and telling the model they are mandatory. For example:

  • The word is 5 letters.
  • Position 2 = a.
  • Position 5 = e.
  • The letters c, r, n must not appear anywhere in the word.
  • Output only one valid guess that satisfies every constraint. If no valid word exists, say so.

I’ve found that structured constraints work much better than narrative instructions for Wordle-style prompts. There are also some good Wordle solving guides that discuss prompt structure and constraint handling if you’re looking for more ideas.

@eddiesamule250 Got to work on that bot some more