SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.17626 · ACL · 2023

In-Context Analogical Reasoning with Pre-Trained Language Models

Richard Lewis, Joyce Chai, Xiaoyang Hu, Shane Storks

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 2 failures of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2305.17626.json · badge: /api/ran/2305.17626.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
hxiaoyang/lm-raven canonical (classifier label)
classifier basis: classifier_2025
3 ran · 1 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
get_sample Ran
ran; our contract draft was wrong, not the code
hxiaoyang/lm-raven/task.py
code served (permissive licence) · get_code("fb271e4c166d5129")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import xml.etree.ElementTree as ET
import tempfile
import os

# Create a minimal valid XML file that the function can parse
xml_content = """<?xml version="1.0" encoding="UTF-8"?>
<root>
  <Panels>
    <Panel>
      <Struct>
        <Comp>
          <Layout name="Distribute_1">
            <Entity Type="rect" Size="10" Color="red" Angle="0" bbox="[1.0, 2.0, 3.0, 4.0]"/>
            <Entity Type="circle" Size="5" Color="blue" Angle="45" bbox="[5.0, 6.0, 7.0, 8.0]"/>
          </Layout>
        </Comp>
        <Comp>
          <Layout name="Static">
            <Entity Type="line" Size="2" Color="green" Angle="90" bbox="[0.0, 0.0, 1.0, 1.0]"/>
          </Layout>
        </Comp>
      </Struct>
    </Panel>
    <Panel>
      <Struct>
        <Comp>
          <Layout name="Distribute_2">
            <Entity Type="polygon" Size="15" Color="yellow" Angle="30" bbox="[10.0, 11.0, 12.0, 13.0]"/>
          </Layout>
        </Comp>
      </Struct>
    </Panel>
    <Panel>
      <Struct>
        <Comp>
          <Layout name="Static">
            <Entity Type="arc" Size="8" Color="purple" Angle="60" bbox="[2.0, 3.0, 4.0, 5.0]"/>
          </Layout>
        </Comp>
      </Struct>
    </Panel>
    <Panel>
      <Struct>
        <Comp>
          <Layout name="Distribute_3">
            <Entity Type="triangle" Size="7" Color="orange" Angle="120" bbox="[15.0, 16.0, 17.0, 18.0]"/>
          </Layout>
        </Comp>
      </Struct>
    </Panel>
    <Panel>
      <Struct>
        <Comp>
          <Layout name="Static">
            <Entity Type="star" Size="12" Color="cyan" Angle="180" bbox="[3.0, 4.0, 5.0, 6.0]"/>
          </Layout>
        </Comp>
      </Struct>
    </Panel>
    <Panel>
      <Struct>
        <Comp>
          <Layout name="Distribute_4">
            <Entity Type="diamond" Size="9" Color="magenta" Angle="270" bbox="[20.0, 21.0, 22.0, 23.0]"/>
          </Layout>
        </Comp>
      </Struct>
    </Panel>
    <Panel>
      <Struct>
        <Comp>
          <Layout name="Static">
            <Entity Type="square" Size="6" Color="lime" Angle="45" bbox="[4.0, 5.0, 6.0, 7.0]"/>
          </Layout>
        </Comp>
      </Struct>
    </Panel>
    <Panel>
      <Struct>
        <Comp>
          <Layout name="Distribute_5">
            <Entity Type="ellipse" Size="11" Color="navy" Angle="90" bbox="[25.0, 26.0, 27.0, 28.0]"/>
          </Layout>
        </Comp>
      </Struct>
    </Panel>
    <Panel>
      <Struct>
        <Comp>
          <Layout name="Static">
            <Entity Type="hexagon" Size="14" Color="teal" Angle="0" bbox="[5.0, 6.0, 7.0, 8.0]"/>
          </Layout>
        </Comp>
      </Struct>
    </Panel>
    <Panel>
      <Struct>
        <Comp>
          <Layout name="Distribute_6">
            <Entity Type="pentagon" Size="13" Color="maroon" Angle="60" bbox="[30.0, 31.0, 32.0, 33.0]"/>
          </Layout>
        </Comp>
      </Struct>
    </Panel>
  </Panels>
  <Rules>
    <RuleGroup>
      <Rule attr="color" name="primary_color"/>
      <Rule attr="size" name="primary_size"/>
    </RuleGroup>
    <RuleGroup>
      <Rule attr="angle" name="rotation_angle"/>
      <Rule attr="type" name="entity_type"/>
    </RuleGroup>
  </Rules>
</root>
"""

# Create a temporary XML file
temp_fd, temp_file_path = tempfile.mkstemp(suffix='.xml')
os.write(temp_fd, xml_content.encode('utf-8'))
os.close(temp_fd)

ARGS = {
    'file_name': temp_file_path,
    'target': 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_data Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from maybenotime/css
pointer only; the stored copy get_code serves, from maybenotime/css, is pointer only (licence: NONE) · get_code("83f4dfab09dd0247")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

switch Ran
ran, violated the contract we drafted
hxiaoyang/lm-raven/task.py
code served (permissive licence) · get_code("87587c1452d559e6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# The switch function takes an array-like object and two indices
# It swaps elements at positions i and j
# Let's create a simple list as the array

arr = [1, 2, 3, 4, 5]
i = 0
j = 4

ARGS = {
    "arr": arr,
    "i": i,
    "j": j,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
to_list Ran
ran, honoured the contract we drafted
hxiaoyang/lm-raven/task.py
code served (permissive licence) · get_code("03884bb215982e58")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

def to_list(s):
    s = s.replace('[', '')
    s = s.replace(']', '')
    s = s.split(',')
    return [float(n) for n in s]

ARGS = {
    's': '[1.5, 2.3, 3.7, 4.1]'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
evaluate Not yet run
unverified (harvested, no recorded run)
hxiaoyang/lm-raven/evaluation.py
code served (permissive licence) · get_code("8c7dd9a3bb2f9b0f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 3 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 3 later) and 2 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
load_data 1 other paper
1 later
2306.04188 (2023-06)
A New Dataset and Empirical Study for Sentence Simplification in Chinese
switch 1 other paper
1 later
2412.05586 (2024-12)
Towards Learning to Reason: Comparing LLMs with Neuro-Symbolic on Arithmetic Relations in Abstract Reasoning
to_list 1 other paper
1 later
2412.05586 (2024-12)
Towards Learning to Reason: Comparing LLMs with Neuro-Symbolic on Arithmetic Relations in Abstract Reasoning

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Analogical reasoning is a fundamental capacity of human cognition that allows us to reason abstractly about novel situations by relating them to past experiences. While it is thought to be essential for robust reasoning in AI systems, conventional approaches require significant training and/or hard-coding of domain knowledge to be applied to benchmark tasks. Inspired by cognitive science research that has found connections between human language and analogy-making, we explore the use of intuitive language-based abstractions to support analogy in AI systems. Specifically, we apply large pre-trained language models (PLMs) to visual Raven's Progressive Matrices (RPM), a common relational reasoning test. By simply encoding the perceptual features of the problem into language form, we find that PLMs exhibit a striking capacity for zero-shot relational reasoning, exceeding human performance and nearing supervised vision-based methods. We explore different encodings that vary the level of abstraction over task features, finding that higherlevel abstractions further strengthen PLMs' analogical reasoning. Our detailed analysis reveals insights on the role of model complexity, incontext learning, and prior knowledge in solving RPM tasks.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2305.17626")
get_code_for_paper("2305.17626")
have("2305.17626")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2305.17626.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2305.17626.svg)](https://syntology.ai/paper/2305.17626)

Connect an agent — have() is free.