SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Some of the parameters that we fit, namely  $\epsilon$ ,  $\alpha$ ,  $\beta$ , cannot be negative. To enforce this we actually optimize the inverse logistic of those parameters.
A.3.3 MCMC over Logical Expressions
Fleet was used to perform MCMC over logical expressions with the domain-specific primitives in this file, which include:
true,false:boolean blue,yellow,green:object  $\rightarrow$  boolean rectangle,circle,triangle:object  $\rightarrow$  boolean small,medium,large:object  $\rightarrow$  boolean and,or,  $\iff ,\equiv \Rightarrow :$  boolean  $x$  boolean  $\rightarrow$  boolean  $\forall ,\exists :(\mathrm{shape}\to \mathrm{boolean})\times 2^{\mathrm{object}}\to \mathrm{boolean}$  filter:(object  $\rightarrow$  boolean）  $\times 2^{\mathrm{object}}\rightarrow 2^{\mathrm{object}}$ $\epsilon :\mathrm{object}\times 2^{\mathrm{object}}\to \mathrm{boolean}$ $\iota :2^{\mathrm{object}}\to \mathrm{object}\cup \{\bot \}$  ,unique set element empty:  $2^{\mathrm{object}}\to \mathrm{boolean}$  same_shape,same_color,same_size:object  $\times$  object  $\rightarrow$  boolean size  $< ,$  size  $\leq$  ,size>，size  $\geq$  ：object  $x$  object  $\rightarrow$  boolean
The model first constructed a large hypothesis space by performing MCMC for 1 minute per batch, and per learning curve. In one minute, Fleet makes approximately  $10^{6}$  MH proposals. There are a little more than 200 learning curves, and 25 batches per curve, for a total of about 5 billion MCMC proposals. In the main text, we abbreviate this analysis by referring to  $10^{9}$  proposals.
The top 10 samples per batch and per learning curve were retained. These top 10 samples samples were then deduplicated to yield 45 thousand hypotheses. Parameter fitting and posterior estimation was performed solely over those 45 thousand hypotheses.
Quantitatively, these are vastly more proposals than the models introduced in this paper. Quantitatively, these proposals are also derived in a very different way: the hypothesis space for the BPL learner is
<sup>1</sup>Running the model was graciously performed by the authors of [59], who provided us with the raw data.
actually informed by data on other learning curves, and also on the same learning curve, but in the future batches.
It is in this sense that the BPL model is a computational-level theory, and not a process model, because human subjects could not be proposing hypotheses using data that is going to be seen in the future, or on other learning curves. However, the above strategy for proposing hypotheses is a very reasonable heuristic for constructing the support of the space of plausible logical hypotheses that a human learner might ever think of.
A.3.4 DreamCoder baseline
DreamCoder was initialized with the following domain-specific primitives:
1,2,3,...,100:int
squares:2int
singleton:int  $\rightarrow 2^{\mathrm{int}}$
interval: int × int → 2int
intersect,union:  $2^{\mathrm{int}}\times 2^{\mathrm{int}}\to 2^{\mathrm{int}}$
powersof,multiplesof:int  $\rightarrow 2^{\mathrm{int}}$
Each of the 8 stimuli from [43] was converted into a single task. The discrete structure of the prior was held fixed because there was no learnable common structure across the 8 tasks, but the continuous parameters of the prior were updated at each wake-sleep cycle. We estimated those parameters from the topK=100 highest posterior programs discovered for each task at each wake-sleep cycle. The neural recognition model took as input a 100-dimensional binary vector encoding the support of a number concept, which was then processed by an MLP with 64 hidden units. The recognition model was trained on a 50/50 split of replays/dreams for approximately  $10^{5}$  training examples per wake-sleep cycle. During the waking phase, program synthesis was provided with a timeout of 60 seconds per task per cycle, enumerating approximately  $10^{4}$  programs per task.
We confirmed by manual inspection that high-likelihood programs were discovered for of the eight tasks. Therefore the difference between DreamCoder and our model cannot be attributed to a failure on the part of DreamCoder to discover valid programs. Instead, we attribute the difference to differences of representation (natural language vs lambda calculus), together with differences in the ways that parameters are estimated (maximizing the marginal likelihood of the tasks, vs directly fitting human judgments).
A.4 Prompting
A.4.1 Proposing hypotheses
For the number game we use the following prompt for code-davinci-002 to generate candidate concepts in natural language, given examples  $X_{1:K}$ . The example number concepts given in the prompt come from the cover score given to human participants [43]:
Python 3   
Here are a few example number concepts:   
# -- The number is even   
# -- The number is between 30 and 45   
# -- The number is a power of 3   
# -- The number is less than 10   
#   
Here are some random examples of numbers belonging to a different  $\nrightarrow$  number concept:   
#  $X_{1:K}$    
# The above are examples of the following number concept:   
# -- The number is
where  $X_{1:K}$  is formatted by listing the numbers with a comma and a space between them.
For the number game we used the following prompt to generate candidate concepts in python (code baseline):
Python 3   
Here are a few example number concepts:   
# -- The number is even   
# -- The number is between 30 and 45   
# -- The number is a power of 3   
# -- The number is less than 10   
#   
Here are some random examples of numbers belonging to a different  $\nu$  number concept:   
 $\# X_{1:K}$    
# Write a python function that returns true if num' belongs to  $\nu$  this number concept.   
def check_if_in_concept(num): return
For logical concepts we used the following few-shot prompt for GPT-4 to generate candidate concepts:
Here three simple concepts, which specify when an object is 'positive' relative to an example collection of other objects. Before giving the rule for each concept, we give examples of collections of objects, and which objects in the collection are 'positive'.
Concept #1: An Example of Concept #1: POSITIVES: (big yellow rectangle) NEGATIVES: (big green circle), (medium yellow rectangle) Another Example of Concept #1: POSITIVES: (medium yellow rectangle) NEGATIVES: (big red circle), (small green circle) Rule for Concept #1: Something is positive if it is the biggest  $\downarrow$  yellow object in the example.
Concept #2: An Example of Concept #2: POSITIVES: (small yellow circle), (medium yellow rectangle) NEGATIVES: (big green circle), (big blue rectangle) Another Example of Concept #2: POSITIVES: (big blue circle), (medium blue rectangle) NEGATIVES: (small green circle), (medium yellow rectangle), Rule for Concept #2: Something is positive if there is another  $\nLeftrightarrow$  object with the same color in the example.
Concept #3: An Example of Concept #3: POSITIVES: (small yellow circle), (medium yellow rectangle) NEGATIVES: (big green circle), (big blue rectangle) Another Example of Concept #3: POSITIVES: (small blue circle), (small blue triangle),  $\nLeftrightarrow$  (medium blue rectangle) NEGATIVES: (medium green triangle), (big yellow rectangle) Another Example of Concept #3: POSITIVES: (big red rectangle), (medium red rectangle),  $\nLeftrightarrow$  (big red triangle) NEGATIVES: (medium green triangle), (big yellow rectangle) Rule for Concept #3: Something is positive if it is the same color  $\nLeftrightarrow$  as the smallest triangle in the example.
Now here are some examples of another concept called Concept #4, but this time we don't know the rule. Infer ten different possible rules, and make those ten rules as simple and general as you can. Your simple general rules might talk
about shapes, colors, and sizes, and might make comparisons
between these features within a single example, but it
$\rightarrow$  doesn't have to. Remember that a rule should say when
$\nrightarrow$  something is positive, and should mention the other objects  $\nu$
in the example, and should be consisting with what you see
below.
Concept #4:
$X_{1:K}$
Rule for Concept #4: Something is positive if...
Now make a numbered list of 10 possible rules for Concept #4. Start  $\nu$
by writing "1. Something is positive if". End each line with
$\hookrightarrow$  a period.
Each sample from the above prompt generates 10 possible concepts formatted as a numbered list. We draw 10 times at temperature  $= 1$  to construct 100 hypotheses. To obtain fewer than 100 hypotheses we take hypotheses from each sampled list in round-robin fashion. We found that asking it to generate a list of hypotheses generated greater diversity without sacrificing quality, compared to repeatedly sampling a single hypothesis.
The above prompt provides in-context examples of first-order rules. We also tried using a different prompt for propositional concepts that illustrated the examples as a truth table, and gave in-context example rules that were propositional:
Here are some example concepts defined by a logical rule:
Rule: a triangle.
Rule: a green rectangle.
Rule: big or a rectangle (unless that rectangle is blue).
Rule: not both big and green.
Rule: either big or green, but not both.
Rule: either a rectangle or not yellow.
Rule: a circle.
Now please produce a logical rule for a new concept. Your rule  $\swarrow$
$\hookrightarrow$  should be consistent with the following examples. It must be
$\Lsh$  true of all the positive examples, and not true of all the
negative examples. The examples are organized into a table
$\hookrightarrow$  with one column for each feature (size, color, shape):
Please produce a simple rule that is consistent with the above
$\nrightarrow$  table. Make your rule as SHORT, SIMPLE, and GENERAL as  $\nu$
$\nLeftrightarrow$  possible. Do NOT make it more complicated than it has to be,  $\nLeftrightarrow$
or refer to features that you absolutely do not have to refer
to. Begin by writing "Rule: " and then the rule, followed by
$\hookrightarrow$  a period.
Using the first order prompt for every concept gives a  $R^2 = .80$  fit to the human responses. Using both prompts gives the  $R^2 = .81$  result in the main paper: the propositional prompt for the propositional problems, and the first order prompt for the higher order problems. We strongly suspect that a single prompt that just showed both propositional and higher-order in-context examples would work equally well, given that a single first-order prompt works about as well also, but we did not try that it would have required rerunning all of our GPT-4 queries, which would have had high cost.
On the first batch, the learner has not observed any examples. Therefore the above prompts do not apply, and we use a different prompt to construct an initial hypothesis space:
Rule: color is purple.
Rule: shape is not a hexagon.
Rule: color is purple and size is small.  
Rule: size is tiny or shape is square.  
Rule: size is not enormous.  
Rule: color is red.
Please propose a some new concepts, defined by a logical rule.  $\nrightarrow$  These new concepts can only refer to the following features: shape: triangle, rectangle, circle color: green, blue, yellow size: small, medium, large
Please make your rules short and simple, and please write your response on a single line that begins with the text "Rule:". Provide 100 possible rules.
We generate from the above prompt at temperature  $= 0$ , and split on line breaks to obtain candidate rules.
A.4.2 Translating from natural language to Python
We translate Number Game concepts from English to Python via the following prompt for code-davinci-002, and generate at temperature  $= 0$  until linebreak:
Write a python function to check if a number is  $C$ . def check_number(num): return
We translate logical concepts from English to Python using a series of in-context examples, again generating with temperature  $= 0$  until the text #DONE is produced.2
2This prompt is pretty long, and probably could be much shorter. Preliminary experiments suggested that a few in-context examples were very helpful, and so to increase the odds of the model working without much time spent prompt-engineering, we provided a large number of in-context examples.
this_object: a tuple of (shape, color, size)  
other Objects: a list of tuples of (shape, color, size)  
returns: True if 'this_object' is positive according to the  $\nLeftrightarrow$  following rule: Something is positive if it is bigger than every other object  
"''" # shape: a string, either "circle", "rectangle", or "triangle" # color: a string, either "yellow", "green", or "blue" # size: an int, either 1 (small), 2 (medium), or 3 (large) this_shape, this_color, this_size = this_object  
# 'this_object' is not a part of 'other Objects' # to get all of the examples, you can use  
 $\nLeftrightarrow$  'all_exampleobjects', defined as 'other objects +'. [this_object]  
# be careful as to whether you should be using  
 $\nLeftrightarrow$  'all_exampleobjects' or 'other objects' in your code  
all_exampleobjects = other Objects + [this_object]
DONE
Something is positive if it is bigger than every other object  
# START  
return all( this_size > other_object[2] for other_object in  $\nLeftrightarrow$  other.objects)
def check_object(this_object, otherobjects):
    return: True if 'this_object' is positive according to the \(\nLeftrightarrow\) following rule:
        Something is positive if it is one of the largest
    # shape: a string, either "circle", "rectangle", or "triangle"
    # color: a string, either "yellow", "green", or "blue"
    # size: an int, either 1 (small), 2 (medium), or 3 (large)
    this_shape, this_color, this_size = this_object
    # 'this_object' is not a part of 'otherobjects'
    # to get all of the examples, you can use
        '\(all_exampleobjects\)', defined as 'other.objects +'
        '\) [this_object}'
    # be careful as to whether you should be using
        '\(all_exampleobjects\)' or 'other.objects' in your code
        all_exampleobjects = other.objects + [this_object]
    # Something is positive if it is one of the largest
    # START
    return all( this_size >= other_object[2] for all_example_object
        '\) in all_exampleobjects)
def check_object(this_object, otherobjects):
    returns: True if 'this_object' is positive according to the following rule:
        Something is positive if it is smaller than every yellow object
# shape: a string, either "circle", "rectangle", or "triangle" # color: a string, either "yellow", "green", or "blue" # size: an int, either 1 (small), 2 (medium), or 3 (large) this_shape, this_color, this_size = this_object
# 'this_object' is not a part of 'other Objects'
# to get all of the examples, you can use  $\nabla^{\prime}$ $\downarrow$  'all_exampleobjects', defined as 'other.objects +  $\nabla^{\prime}$ $\downarrow$  [this_object]
# be careful as to whether you should be using  $\nabla^{\prime}$ $\downarrow$  'all_exampleobjects' or 'otherobjects' in your code
all_example.objects = other.objects + [this_object]
# Something is positive if it is smaller than every yellow object
# START
return all( this_size < other_object[2] for other_object in  $\nabla^{\prime}$ $\downarrow$  other.objects if other_object[1] == "yellow")
#DONE
def check_object(this_object, other.objects):
    ""
    this_object: a tuple of (shape, color, size)
    other.objects: a list of tuples of (shape, color, size)
returns: True if 'this_object' is positive according to the  $\nabla^{\prime}$ 
    following rule:
        Something is positive if there is another object with the  $\nabla^{\prime}$ 
    same color
    #
# shape: a string, either "circle", "rectangle", or "triangle"
# color: a string, either "yellow", "green", or "blue"
# size: an int, either 1 (small), 2 (medium), or 3 (large)
this_shape, this_color, this_size = this_object
# 'this_object' is not a part of 'other Objects'
# to get all of the examples, you can use  $\nabla^{\prime}$ $\downarrow$  'all_exampleobjects', defined as 'other.objects +  $\nabla^{\prime}$ $\downarrow$  [this_object]
# be careful as to whether you should be using \(\nabla^{\prime}
\downarrow\) 'all_exampleobjects' or 'otherobjects' in your code
all_example.objects = other.objects + [this_object]
# Something is positive if there is another object with the  $\nabla^{\prime}$ $\downarrow$  same color
# START
return any( this_color == other_object[1] for other_object in  $\nabla^{\prime}$ $\downarrow$  other.objects )
#DONE
def check_object(this_object, other.objects):
    ""
    this_object: a tuple of (shape, color, size)
    other.objects: a list of tuples of (shape, color, size)
returns: True if 'this_object' is positive according to the  $\nabla^{\prime}$ 
    following rule:
        Something is positive if it has a unique combination of  $\nabla^{\prime}$ 
    color and shape
    #
# shape: a string, either "circle", "rectangle", or "triangle"
# color: a string, either "yellow", "green", or "blue"
# size: an int, either 1 (small), 2 (medium), or 3 (large)
this_shape, this_color, this_size = this_object
# 'this_object' is not a part of 'other Objects'
# to get all of the examples, you can use  $\kappa$ $\downarrow$  'all_exampleobjects', defined as 'other_objects +  $\kappa$ $\downarrow$  [this_object]   
# be careful as to whether you should be using   
 $\downarrow$  'all_exampleobjects' or 'other_objects' in your code   
all_exampleobjects  $=$  other_objects  $^+$  [this_object]   
# Something is positive if it has a unique combination of color   
 $\downarrow$  and shape   
#START   
return all( this_shape != other_object[0] or this_color !=  $\kappa$ $\downarrow$  other_object[1] for other_object in other Objects)   
#DONE   
def check_object(this_object, otherobjects):   
""   
this_object: a tuple of (shape, color, size)   
other.objects: a list of tuples of (shape, color, size)   
returns: True if 'this_object' is positive according to the   
 $\downarrow$  following rule: Something is positive if it has the same color as the   
 $\downarrow$  majority of objects   
""   
# shape: a string, either "circle", "rectangle", or "triangle"   
# color: a string, either "yellow", "green", or "blue"   
# size: an int, either 1 (small), 2 (medium), or 3 (large)   
this_shape, this_color, this_size = this_object   
# 'this_object' is not a part of 'otherobjects'   
# to get all of the examples, you can use   
 $\downarrow$  'all_exampleobjects', defined as 'other_objects +  $\kappa$ $\downarrow$  [this_object]   
# be careful as to whether you should be using   
 $\downarrow$  'all_exampleobjects' or 'other_objects' in your code   
all_exampleobjects  $=$  other_objects  $^+$  [this_object]   
# Something is positive if it has the same color as the   
 $\downarrow$  majority of objects   
#START   
majority_color  $=$  max([ "yellow", "green", "blue"], key= lambda  $\kappa$ $\downarrow$  color: sum(1 for obj in all_exampleobjects if obj[1] ==  $\kappa$ $\downarrow$  color))   
return this_color  $= =$  majority_color   
#DONE   
def check_object(this_object, otherobjects):   
""   
this_object: a tuple of (shape, color, size)   
other.objects: a list of tuples of (shape, color, size)   
returns: True if 'this_object' is positive according to the   
 $\downarrow$  following rule: Something is positive if there are at least two other   
 $\downarrow$  objects with the same shape   
""   
# shape: a string, either "circle", "rectangle", or "triangle"   
# color: a string, either "yellow", "green", or "blue"   
# size: an int, either 1 (small), 2 (medium), or 3 (large)   
this_shape, this_color, this_size = this_object   
# 'this_object' is not a part of 'otherobjects'   
# to get all of the examples, you Can use  $\kappa$ $\downarrow$  'all_exampleobjects', defined as 'other_objects +  $\kappa$ $\downarrow$  [this_object]
# be careful as to whether you should be using  $\kappa$  all_exampleobjects' or 'other_objects' in your code all_exampleobjects  $=$  other.objects  $^+$  [this_object] # Something is positive if there are at least two other objects with the same shape   
#START return sum(1 for other_object in otherobjects if  $\kappa$  other_object[0]  $= =$  this_shape)  $> = 2$    
#DONE   
def check_object(this_object, other.objects):   
""" this_object: a tuple of (shape, color, size) other.objects: a list of tuples of (shape, color, size) returns: True if 'this_object' is positive according to the following rule: C   
""" # shape: a string, either "circle", "rectangle", or "triangle" # color: a string, either "yellow", "green", or "blue" # size: an int, either 1 (small), 2 (medium), or 3 (large) this_shape, this_color, this_size  $=$  this_object   
# 'this_object' is not a part of 'other.objects' # to get all of the examples, you can use  $\kappa$  all_exampleobjects', defined as 'other.objects +  $\kappa$  [this_object] # be careful as to whether you should be using  $\kappa$  all_exampleobjects' or 'other Objects' in your code all_exampleobjects  $=$  other.objects  $^+$  [this_object]   
#  $C$    
# START
When modeling the concepts of majority/minority color we used a different prompt for converting natural language to python, because the above includes majority color as one of its in-context examples. We gave GPT-4 the following prompt for those concepts:
Please write a python function to check if an object obeys a logical rule. The logical rule talks about the following features:
shape: a string, either "circle", "rectangle", or "triangle"  
color: a string, either "yellow", "green", or "blue"  
size: an int, either 1 (small), 2 (medium), or 3 (large)
The python function should be called 'check_object', and inputs:
'this_object': a tuple of (shape, color, size)  
'other.objects': a list of tuples of (shape, color, size)
The logical rule should check if 'this_object' has a certain  $\nLeftrightarrow$  relationship with 'other.objects'. Collectively,  $\nLeftrightarrow$  '[this_object]+other.objects' correspond to all of the  $\nLeftrightarrow$  objects, so if the rule references the whole examples, it is  $\nLeftrightarrow$  talking about that structure.
The logical rule is:  $C$
<sup>3</sup>We strongly suspect that GPT-4 with the following prompt is strictly better than Codex. The high cost of using GPT-4 makes it more practical to use the Codex prompt for the main experiments however.
Please start your response by writing the following code, and then  $\nLeftrightarrow$  complete the function body so that it returns 'True' if and  $\nLeftrightarrow$  only if the logical rule above holds.   
def check_object(this_object, otherobjects): "" this_object: a tuple of (shape, color, size) other Objects: a list of tuples of (shape, color, size) returns: True if 'this_object' is positive according to the # following rule: C # shape: a string, either "circle", "rectangle", or "triangle" # color: a string, either "yellow", "green", or "blue" # size: an int, either 1 (small), 2 (medium), or 3 (large) this_shape, this_color, this_size = this_object # 'this_object' is not a part of 'other_objects' # to get all of the examples, you can use  $<$  all_exampleobjects', defined as 'other_objects +  $<$  [this_object]# be careful as to whether you should be using  $<$  all_exampleobjects' or 'other_objects' in your code all_exampleobjects  $=$  other_objects  $^+$  [this_object] # return True if and only if: # C
A.5 GPT-4 Baselines
Our GPT-4 baseline for each domain presented the examples  $X_{1:K}$  in string form and then asked GPT-4 to respond Yes/No as to whether a test example  $X_{\mathrm{test}}$  belonged to the same concept. GPT-4 was then queried at temperature=1 to collect 10 samples. Samples not beginning with 'y'/'n' were discarded, and the ratio of remaining samples that began with 'y' was computed (case insensitive).
We show below example prompts for the number and logic domains.
Here are a few example number concepts:
-- The number is even
-- The number is between 30 and 45
-- The number is a power of 3
-- The number is less than 10
Here are some random examples of numbers belonging to a possibly  $\prec$  different number concept:
98，81，86，93
Question: Does the number 42 belong to the same concept as the  $\prec$  above numbers?
Answer (one word, yes/no):
Logical concept example prompt: