Live data from Hacker News

LLMs, Theory of Mind, and Cheryl's Birthday

github.com

91–100 of 150 posts

Re: LLMs, Theory of Mind, and Cheryl's Birthday

#91
Script generated by o1-preview:

  ```python
  # List of possible dates
  dates = [
      ('May', 15), ('May', 16), ('May', 19),
      ('June', 17), ('June', 18),
      ('July', 14), ('July', 16),
      ('August', 14), ('August', 15), ('August', 17)
  ]
  
  def solve_cheryls_birthday(dates):
      # Initial possible dates
      possible_dates = dates.copy()
      
      # Step 1: Albert's statement
      # Create a count of each day
      day_counts = {}
      for month, day in dates:
          day_counts[day] = day_counts.get(day, 0) + 1
  
      # Filter out months where a unique day exists (Albert knows Bernard doesn't know)
      possible_months = set()
      for month in set(month for month, day in dates):
          month_days = [day for m, day in dates if m == month]
          if not any(day_counts[day] == 1 for day in month_days):
              possible_months.add(month)

      possible_dates = [ (month, day) for (month, day) in possible_dates if month in possible_months ]
  
      # Step 2: Bernard's statement
      # Recount the days in the filtered possible dates
      day_counts_in_possible = {}
      for month, day in possible_dates:
          day_counts_in_possible[day] = day_counts_in_possible.get(day, 0) + 1

      # Bernard can now deduce the date; keep dates where the day is unique
      possible_dates = [ (month, day) for (month, day) in possible_dates if day_counts_in_possible[day] == 1 ]

      # Step 3: Albert's final statement
      # Recount the months in the possible dates
      month_counts_in_possible = {}
      for month, day in possible_dates:
          month_counts_in_possible[month] = month_counts_in_possible.get(month, 0) + 1

      # Albert now knows the date; keep dates where the month is unique
      possible_dates = [ (month, day) for (month, day) in possible_dates if month_counts_in_possible[month] == 1 ]

      # The remaining date is Cheryl's birthday
      if len(possible_dates) == 1:
          return possible_dates[0]
      else:
          return None
  
  # Solve the problem
  birthday = solve_cheryls_birthday(dates)
  if birthday:
      print(f"Cheryl's birthday is on {birthday[0]} {birthday[1]}")
  else:
      print("Unable to determine Cheryl's birthday.")
  ```
Output:

Cheryl's birthday is on July 16

Re: LLMs, Theory of Mind, and Cheryl's Birthday

#92
I tried to replicate this and Claude 3.5 Sonnet got it correct on the first try. It generated a second set of dates which contained no solution so I asked it to write another python program that generates valid date sets.

Here's the code it generated: https://gist.github.com/tel/8e126563d2d5fb13e7d53cf3adad862e

To my test, it has absolutely no trouble with this problem and can correctly translate the "theory of mind" into a progressive constraint solver.

Norvig is, of course, a well-respected researcher, but this is a bit disappointing. I feel confident he found that his tests failed, but to disprove his thesis (at least as is internally consistent with his experiment) we just need to find a single example of an LLM writing Python code that realizes the answer. I found that on the first try.

I think it's possible that there exists some implementation of this problem, or something close enough to it, already in Claude's training data. It's quite hard to disprove that assertion. But still, I am satisfied with the code and its translation. To relate the word problem to this solution requires contemplation of the character's state-of-mind as a set of alternatives consistent with the information they've been given.

Re: LLMs, Theory of Mind, and Cheryl's Birthday

#93
How does solving a logic puzzle imply a theory of mind? I don’t mean to say that LLMs don’t have a theory of mind, just that deductive reasoning does not amount to empathetic evaluations of how someone else thinks and feels…

…unless you’re a programmer.

Re: LLMs, Theory of Mind, and Cheryl's Birthday

#95

Earlier quoted context omitted.

> if you don't spot the change you fail But that's exactly how real world works too.

This has not been my experience with the real world. Riddles and gotchas have played a very small role, so far.

Unfortunately they do show up in tech interviews.

“What’s the correct way to delete an element from a Java array while iterating over it?”

“Well I suppose you’d need to avoid invalidating the iterator state but I don’t recall the…”

“BZZT!”

Re: LLMs, Theory of Mind, and Cheryl's Birthday

#96
post #79
post #7

Earlier quoted context omitted.

"seems to" isn't good enough, especially since it's entirely possible to generate code that doesn't give the right answer. 4o is able to write some bad code, run it, recognize that it's bad, and then fix it, if you tell it to. https://chatgpt.com/share/670086ed-67bc-8009-b96c-39e539791f...

Did you actually run the "fixed" code here? Its output is an empty list, just like the pre-"fixed" code.

Hm, actually, it's confusing, because clicking the [>_] links where it mentions running code gives different code than it just mentioned.

Re: LLMs, Theory of Mind, and Cheryl's Birthday

#97
post #70

Gp1-o1 preview solves this puzzle correctly in 13 seconds and has a thorough logical deduction in the comments and explanation. I think it’s a bit unfair on llm to ask it to retrieve the puzzle definition from its training data. I posted the info on the puzzle from his notebook. https://chatgpt.com/share/670103ae-1c18-8011-8068-dd21793727...

Disappointing that Norvig didn’t use the model that OpenAI states is their best model for programming.

Also using himself as the programmer seemed like a convenient choice. I’d much rather see him grab a random professional programmer for the task.

Re: LLMs, Theory of Mind, and Cheryl's Birthday

#98
post #6

> At least with respect to this problem, they had no theory of mind. This is very interesting and insightful, but I take issue with the above conclusion. Your average software engineer would probably fail to code up a python solution to this problem. But most people would agree that the average software engineer, and the average person, possesses some theory of mind. This seems to be a pattern I'm noticing with AI. T…

I consider myself a pretty average human programmer, and I was able to solve the logic puzzle and write a python program for it in ~10 mins. [0] I agree though, the people who are unable to solve this probably still have a theory of mind. It seems like we're setting a rather high bar. [0] https://pastebin.com/q33K0HJ1

With all due respect, if you wrote a python program for this in 10 minutes you are not an average programmer.

Re: LLMs, Theory of Mind, and Cheryl's Birthday

#99
post #65

I'm not a huge fan of using these kind of riddles or gotchas. Other comments have riddle variants which feel also like ways of tripping someone up - if you don't spot the change you fail. And what's more the originals are things that lots of people struggle with (that's why they're riddles not basic questions). There's also little prompting, which feels like calling up a random person and demanding they solve a riddl…

> if you don't spot the change you fail But that's exactly how real world works too.

No it doesn't.

You'd get the answer to a riddle wrong or miss something and nobody would start assuming that means you lack a fundamental understanding of how the world works. There's entire fields that look into how and why we make various mistakes and riddles and puzzles designed specifically to trip people up.

If you want to test if these models can solve riddles, or where they make mistakes go right ahead that's great. It's any assumption it has a much deeper meaning that is wrong to me.

Re: LLMs, Theory of Mind, and Cheryl's Birthday

#100

Earlier quoted context omitted.

Well it depends on what you mean patched, but I'll be generous and say that it gets the right answer and there are no logical errors. I used to use Which weighs more, a kilogram of bricks or a pound of feathers and that worked until the second or third update on GPT 3.5 (when everyone was like "but did you try 3.5?) Here's a river crossing puzzle with the current GPT-4o that "works" ----------------------------------…

I like the noise variant! The "everything can in one trip" variant is the one I've been using, and I was able to get 4o to get it right in one shot with enough couching, and o1-preview without couching, which convinced me (of what, I'm not sure). my other riddle is the car accident doctor son one, which 4o couldn't get but o1-preview does. I'll have to come up with more obscure riddles and not talk about them online…

Be careful with coaching. It's very easy to leak information. The point is to get it without letting it know.

As for o1, well I've been using this for a year and a few big players have used it too. So remember that they get spoiled because they end up in the training set

Post reply on HN