SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.17359 · ICLR · 2025

Chain-of-Action: Faithful and Multimodal Question Answering through Large Language Models

Han Liu, Manling Li, Zhenyu Pan, Haozheng Luo

arXiv · PDF · Open in the Atlas

Code that ran

8 of 10 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; 5 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 2 failures of our instrument; 2 no recorded run), measured 2026-11-22; 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/2403.17359.json · badge: /api/ran/2403.17359.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
MAGICS-LAB/Chain-of-Actions canonical (classifier label)
classifier basis: census
8 ran · 2 no recorded run
FunctionStatusWhere it lives
calculate_metrics Ran
ran, honoured the contract we drafted
MAGICS-LAB/Chain-of-Actions/chain-of-search.py
code served (permissive licence) · get_code("483518008187ff8f")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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

torch.manual_seed(0)

# The function takes two string parameters: generated_text and reference_text
# It performs text processing by splitting on whitespace and computing metrics
# based on token overlap and average word length

generated_text = "the quick brown fox jumps over the lazy dog"
reference_text = "the quick brown fox jumps over a lazy cat"

ARGS = {
    "generated_text": generated_text,
    "reference_text": reference_text
}
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 float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
calculate_rouge_l Ran
ran, honoured the contract we drafted
MAGICS-LAB/Chain-of-Actions/chain-of-search-wo-ir.py
code served (permissive licence) · get_code("0982eadbeea994c8")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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

ARGS = {
    'string1': 'The quick brown fox jumps over the lazy dog',
    'string2': 'The quick brown fox jumps over a lazy dog'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, rouge_score, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
excute Ran
ran, honoured the contract we drafted
MAGICS-LAB/Chain-of-Actions/baselines/src/Search-in-the-Chain/SearChain_without_IR.py
code served (permissive licence) · get_code("ae9e2f22ae2b60f8")
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 int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 tempfile
import json
import os

# Create a temporary data file with sample questions and answers
temp_dir = tempfile.gettempdir()
data_path = os.path.join(temp_dir, "test_data.jsonl")

# Write sample data to the file
sample_data = [
    {"question": "What is the capital of France?", "answer": "Paris"},
    {"question": "What is the capital of Germany?", "answer": "Berlin"},
    {"question": "What is the capital of Spain?", "answer": "Madrid"},
]

with open(data_path, 'w') as f:
    for item in sample_data:
        f.write(json.dumps(item) + '\n')

# Define arguments
ARGS = {
    "data_path": data_path,
    "start_idx": 0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
openai — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
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
extract_answer Ran
ran; our contract draft was wrong, not the code
MAGICS-LAB/Chain-of-Actions/chain-of-search-wo-ir.py
code served (permissive licence) · get_code("047a7d86ce36d383")
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 str. 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.

# Analyze the function to understand what it needs
# The function takes a single parameter 'generated' which appears to be a string
# It processes the string by splitting on newlines and colons, and cleaning up whitespace and periods

# Create test cases for the generated parameter
generated_simple = "42"
generated_with_newline = "The answer is:\n42"
generated_with_colon = "Result: 42"
generated_with_colon_and_newline = "Calculation:\nFinal answer: 42"
generated_complex = "Step 1: Calculate\nStep 2: Verify\nAnswer: 42."

# Use a simple test case that exercises the main logic
generated = "The final answer is: 42"

ARGS = {
    "generated": generated
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
get_max_rouge_l Ran
ran, honoured the contract we drafted
MAGICS-LAB/Chain-of-Actions/baselines/dsp-cot.py
code served (permissive licence) · get_code("5b6d30b9deb44c97")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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

torch.manual_seed(0)

# The function get_max_rouge_l takes three string parameters (A, B, C)
# and compares them using ROUGE-L score
# Looking at the function body:
# - It calls calculate_rouge_l(A, B) and calculate_rouge_l(A, C)
# - calculate_rouge_l takes two strings and returns a float (fmeasure * 100)
# - get_max_rouge_l returns the maximum of these two scores

# We need three distinct strings for A, B, C
A = "The quick brown fox jumps over the lazy dog"
B = "The quick brown fox jumps over a lazy dog"
C = "A fast brown fox leaps over the lazy dog"

ARGS = {
    "A": A,
    "B": B,
    "C": C,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, rouge_score, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
match_or_not Ran
ran, violated the contract we drafted
MAGICS-LAB/Chain-of-Actions/baselines/src/Search-in-the-Chain/Server/server.py
code served (permissive licence) · get_code("2399d46f91722e1d")
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 bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 regex
import string

def normalize_answer(s):

    def remove_articles(text):
        return regex.sub('\\b(a|an|the)\\b', ' ', text)

    def white_space_fix(text):
        return ' '.join(text.split())

    def remove_punc(text):
        exclude = set(string.punctuation)
        return ''.join((ch for ch in text if ch not in exclude))

    def lower(text):
        return text.lower()
    return white_space_fix(remove_articles(remove_punc(lower(s))))

def match_or_not(prediction, ground_truth):
    norm_predict = normalize_answer(prediction)
    norm_answer = normalize_answer(ground_truth)
    return norm_answer in norm_predict

ARGS = {
    "prediction": "The quick brown fox jumps over the lazy dog.",
    "ground_truth": "quick brown fox"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
regex — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
normalize_answer Ran
ran; our contract draft was wrong, not the code
MAGICS-LAB/Chain-of-Actions/baselines/src/Search-in-the-Chain/Server/server.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from mjy1111/PRUNE, is pointer only (licence: NONE) · get_code("4cca112e5e6da5dc")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from mjy1111/PRUNE, and GitHub detected no licence in that repository when it was checked. 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.

retrieve_top_k Ran
ran, honoured the contract we drafted
MAGICS-LAB/Chain-of-Actions/chain-of-search.py
code served (permissive licence) · get_code("b9c8e9c4a7c30765")
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 requests
from unittest.mock import Mock, patch

# Mock the requests.get to avoid actual network calls
def mock_get(url, **kwargs):
    mock_response = Mock()
    mock_response.json.return_value = {
        'topk': [
            {'id': 1, 'score': 0.95, 'text': 'result 1'},
            {'id': 2, 'score': 0.87, 'text': 'result 2'}
        ]
    }
    mock_response.raise_for_status.return_value = None
    return mock_response

# Patch requests.get before defining ARGS
with patch('requests.get', side_effect=mock_get):
    ARGS = {
        'query_item': 'test query',
        'k': 5,
        'api_url': 'http://172.20.213.2:8893/api/search'
    }
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
requests — 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
excute Not yet run
unverified (harvested, no recorded run)
MAGICS-LAB/Chain-of-Actions/baselines/src/Search-in-the-Chain/SearChain_w_IR.py
code served (permissive licence) · get_code("f3f4aec2e916df51")
How it ran

no invocation recorded.

excute Not yet run
unverified (harvested, no recorded run)
MAGICS-LAB/Chain-of-Actions/baselines/src/Search-in-the-Chain/without_retriveal.py
code served (permissive licence) · get_code("4ee7b08849b3f9fc")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 9 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
normalize_answer 9 other papers
6 dated earlier, 3 later
2305.12421 (2023-05)
Evaluating Open-QA Evaluation
2308.11730 (2023-08)
Knowledge Graph Prompting for Multi-Document Question Answering
2310.14393 (2023-10)
Merging Generated and Retrieved Knowledge for Open-Domain QA
and 6 more not named here

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-22.

Repositories linked to this paper

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

Abstract

We present a Chain-of-Action (CoA) framework for multimodal and retrievalaugmented Question-Answering (QA). Compared to the literature, CoA overcomes two major challenges of current QA applications: (i) unfaithful hallucination that is inconsistent with real-time or domain facts and (ii) weak reasoning performance over compositional information. Our key contribution is a novel reasoning-retrieval mechanism that decomposes a complex question into a reasoning chain via systematic prompting and pre-designed actions. Methodologically, we propose three types of domain-adaptable 'Plug-and-Play' actions for retrieving real-time information from heterogeneous sources. We also propose a multi-reference faith score to verify conflicts in the answers. In addition, our system demonstrates that detecting the knowledge boundaries of LLMs can significantly reduce both system latency and LLM usage in QA tasks. Empirically, we exploit both public benchmarks and a Web3 case study to demonstrate the capability of CoA over other methods.

For agents

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

get_harvested_code_for_paper("2403.17359")
get_code_for_paper("2403.17359")
have("2403.17359")

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

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

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

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

Connect an agent — have() is free.