SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.11626 · 2024

Metacognitive Retrieval-Augmented Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 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; 0 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 5 failures of our instrument; 2 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/2402.11626.json · badge: /api/ran/2402.11626.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
ignorejjj/metarag canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
FunctionStatusWhere it lives
average_pool Ran
ran; our contract draft was wrong, not the code
ignorejjj/metarag/WikiSearcher.py
pointer only (licence: MIT); the stored copy get_code serves, from smallporridge/AssistRAG, is pointer only (licence: NONE) · get_code("da78af27b71bc211")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from smallporridge/AssistRAG, 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.

check_answer Ran
ran, violated the contract we drafted
ignorejjj/metarag/utils.py
code served (permissive licence) · get_code("fa69772964833f8a")
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 torch

ARGS = {
    "answer": "The quick brown fox jumps over the lazy dog"
}
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 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
format_ref Ran
ran; our contract draft was wrong, not the code
ignorejjj/metarag/utils.py
code served (permissive licence) · get_code("f5cdeb2d53ccfae4")
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.

import torch

def format_ref(reference):

    def format_step(step: str) -> str:
        return step.strip('\n').strip().replace('\n', '  ')
    return format_step(' '.join(reference))


ARGS = {
    'reference': ['step one', 'step two', 'step three']
}
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 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
mean_pooling Ran
ran; our contract draft was wrong, not the code
ignorejjj/metarag/monitor.py
pointer only (licence: MIT); the stored copy get_code serves, from dengyang17/llm-proactive, is pointer only (licence: NONE) · get_code("77f69af078e09830")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from dengyang17/llm-proactive, 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.

normalize_answer Ran
ran; our contract draft was wrong, not the code
ignorejjj/metarag/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from shmsw25/GraphRetriever, is pointer only (licence: NONE) · get_code("dae7ab386661a4f4")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from shmsw25/GraphRetriever, 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.

parse_llm_output_rewrite Ran
ran; our contract draft was wrong, not the code
ignorejjj/metarag/critic.py
code served (permissive licence) · get_code("940ccb205137bea2")
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.

import re

def parse_llm_output_rewrite(output):
    pattern = '(.*?The rewrite query is.*?)'
    match = re.search(pattern, output, re.IGNORECASE | re.DOTALL)
    if match:
        query = match.group(1).strip()
    else:
        query = output.replace('the rewrite query is', '')
    return query

# The function takes a single parameter 'output' which is a string
# It searches for a pattern containing "The rewrite query is" (case-insensitive)
# and returns either the matched group or processes the string by replacing

ARGS = {
    "output": "Here is some text. The rewrite query is: find all cats in the database."
}
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
batch_encode Not yet run
unverified (harvested, no recorded run)
ignorejjj/metarag/WikiSearcher.py
pointer only (licence: MIT); the stored copy get_code serves, from smallporridge/AssistRAG, is pointer only (licence: NONE) · get_code("c22bebebf87a4a31")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from smallporridge/AssistRAG, 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. No invocation recorded.

get_llama_answer Not yet run
unverified (harvested, no recorded run)
ignorejjj/metarag/monitor.py
code served (permissive licence) · get_code("ea4d73e85288f29d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 4 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 2 the same month, 4 later) and 4 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 133 other papers
59 dated earlier, 8 the same month, 65 later, 1 undated · 1 only as an assembly brick
1508.06615 (2015-08)
Character-Aware Neural Language Models
1606.05250 (2016-06)
SQuAD: 100,000+ Questions for Machine Comprehension of Text
1608.07905 (2016-08)
Machine Comprehension Using Match-LSTM and Answer Pointer
and 130 more not named here
mean_pooling 22 other papers
8 dated earlier, 2 the same month, 12 later · 1 only as an assembly brick
2206.04624 (2022-06)
Factuality Enhanced Language Models for Open-Ended Text Generation
2023.findings-emnlp.540 (2023 (year only))
Open-ended Commonsense Reasoning with Unrestricted Answer Scope
2302.05698 (2023-02)
Compositional Exemplars for In-context Learning
and 19 more not named here
average_pool 5 other papers
3 dated earlier, 2 later
2306.03799 (2023-06)
Prompt Space Optimizing Few-shot Reasoning Success with Large Language Models
2308.10633 (2023-08)
RALLE: A Framework for Developing and Evaluating Retrieval-Augmented Large Language Models
2310.04678 (2023-10)
DORIS-MAE: Scientific Document Retrieval using Multi-level Aspect-based Queries
and 2 more not named here
batch_encode 1 other paper
1 later
2411.06805 (2024-11)
Boosting the Potential of Large Language Models with an Intelligent Information Assistant

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

Retrieval-augmented generation have become central in natural language processing due to their efficacy in generating factual content. While traditional methods employ single-time retrieval, more recent approaches have shifted towards multi-time retrieval for multi-hop reasoning tasks. However, these strategies are bound by predefined reasoning steps, potentially leading to inaccuracies in response generation. This paper introduces MetaRAG, an approach that combines the retrieval-augmented generation process with metacognition. Drawing from cognitive psychology, metacognition allows an entity to self-reflect and critically evaluate its cognitive processes. By integrating this, MetaRAG enables the model to monitor, evaluate, and plan its response strategies, enhancing its introspective reasoning abilities. Through a three-step metacognitive regulation pipeline, the model can identify inadequacies in initial cognitive responses and fixes them. Empirical evaluations show that MetaRAG significantly outperforms existing methods.

For agents

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

get_harvested_code_for_paper("2402.11626")
get_code_for_paper("2402.11626")
have("2402.11626")

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

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

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

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

Connect an agent — have() is free.