OSCR

Predictive metacognition: a neuro-computational framework for self-monitoring in large language models.

Code ↔ Paper

The paper beside its authors' code: matches between them have not been computed for this paper yet.

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Jupyter notebook · 77 lines · 2.8 KB · Apache-2.0

  1. # %% [markdown]
  2. # ### Setup
  3. #
  4. # Check that the Colab instance is using GPU: `[Runtime] -> [Change runtime type] -> [Hardware accelerator] -> [GPU]`.
  5. #
  6. # For larger models (3B+ parameters), change `[Runtime shape] -> [High-RAM]` as well.
  7. # %% [markdown]
  8. # ### Install requirements
  9. # %%
  10. !git clone https://github.com/sylinrl/TruthfulQA.git
  11. # %%
  12. cd TruthfulQA
  13. # %%
  14. !pip install -r requirements.txt
  15. # %%
  16. !pip uninstall -y protobuf
  17. !pip install --no-binary protobuf protobuf
  18. # %%
  19. !pip install -e .
  20. # %% [markdown]
  21. # ### Run models and metrics
  22. # %% [markdown]
  23. # To cache models and store results on Google Drive, uncomment the cell below and pass the appropriate filepaths to `evaluate.py`.
  24. # %%
  25. # import os
  26. # from google.colab import drive
  27. # drive.mount('/content/drive/', force_remount=True)
  28. # %% [markdown]
  29. # For supported models, answers and scores can be generated by running `evaluate.py` with the appropriate flags.
  30. #
  31. # To test the performance of a new model, add its answers to the input file as an additional column. The column name can then be passed in the list of models to `evaluate.py`, which will compute the corresponding generative metrics.
  32. # %% [markdown]
  33. #
  34. # | Flag | Description
  35. # | ----------- | ----------------------------------------------------------------- |
  36. # | `--models` | List of models to run (see below) |
  37. # | `--metrics` | List of metrics to run. Valid: MC, bleu, rouge, bleurt |
  38. # | `--preset` | Prompt before each question. Valid: qa, null, chat, long, help, harm |
  39. # | `--device` | Device index if running on GPU (torch must be compiled with CUDA)|
  40. # | `--input_path` | Location of question file |
  41. # | `--output_path` | Location of results file |
  42. # | `--cache_dir` | Location of cached HuggingFace models |
  43. # | `--gptj_path` | Location of GPT-J checkpoint |
  44. # %% [markdown]
  45. # | Model class | Models
  46. # | ----------- | ----------------------------------------------------------------- |
  47. # | `GPT-3` | ada, babbage, curie, davinci |
  48. # | `GPT-Neo/J` | neo-small, neo-med, neo-large, gptj |
  49. # | `GPT-2` | gpt2, gpt2-xl |
  50. # | `UnifiedQA` | uqa-small, uqa-base, uqa-large, uqa-3b |
  51. # %%
  52. # example call to evaluate.py -- switch the input to TruthfulQA.csv for the full dataset
  53. !python -m truthfulqa.evaluate --models gpt2 neo-small uqa-small --metrics mc bleu bleurt --input_path TruthfulQA_demo.csv --output_path TruthfulQA_answers.csv --device 0
  54. # %% [markdown]
  55. # While the output file contains model answers and metrics for each question individually, `evaluate.py` also saves a high-level summary of average `[metric]` by `[model]`, shown below. (The results currently displayed are on the example dataset of 3 questions.)
  56. # %%
  57. # if this fails to run right away, just re-run this cell and the next
  58. import pandas as pd
  59. summary = pd.read_csv('summary.csv') # load the saved summary file from evaluate.py
  60. # %%
  61. print(summary.to_string(index=False))

TruthfulQA-demo.ipynb at commit d71c110, under Apache-2.0 · at the source

Overview

Authors: Wei Luo1, Hunkoog Jho2
  1. School of Information Technology, Deakin University,221 Burwood Highway, Burwood, Melbourne, VIC 3125 Australia
  2. Institute of Knowledge Integration & Design, Dankook University,152, Jukjeon-ro, Suji-gu, Yongin, Gyeonggi-do 16890 Republic of Korea
Institutions: Deakin University (Australia); Dankook University (South Korea)
Journal: Scientific reports, volume 16, issue 1, article 23962
Dates: received 3 February 2026; accepted 20 May 2026; published online 26 May 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1038/s41598-026-54840-2 · PMID 42191827 · PMCID PMC13434765 · OpenAlex W7162427246
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: human (organism), cognitive (subfield)
Keywords: Metacognition, Cognitive architecture, Predictive processing, Confidence calibration, Self-monitoring, Neural computation, Computational biology and bioinformatics, Mathematics and computing, Neuroscience, Psychology
MeSH: Metacognition*, Generative Artificial Intelligence, Humans, Large Language Models (* major topic)
Topic: Artificial Intelligence in Healthcare and Education (Health Informatics, Medicine), according to OpenAlex
Funding: National Research Foundation of Korea (RS-2024-00335268)
Citations: not cited yet (Europe PMC); 54 references in the paper

Abstract

Large Language Models demonstrate remarkable capabilities but suffer from critical metacognitive deficits, manifesting as overconfidence and hallucination, which severely limit their deployment in high-stakes applications. We introduce Predictive Metacognition, a neurobiologically-inspired framework that integrates principles of predictive processing and anterior cingulate cortex monitoring into transformer architectures. Our approach implements Error-Driven Learning and Dual-Process Monitoring through specialised fine-tuning that trains models to simultaneously generate responses and assess their own performance reliability. We fine-tuned Llama-3-8B-Instruct and Phi-3-Mini-4k-Instruct using LoRA (rank=8, α =16) on 4,000 strategically constructed examples spanning varying confidence levels. Comprehensive evaluation against state-of-the-art baselines, including GPT-4o and Claude-3.5-Sonnet, revealed statistically significant improvements in confidence calibration. Our metacognitive models achieved substantial reductions in Brier Score (11.6% and 17.2% respectively) and Expected Calibration Error (p < 0.023, Cohen’s d = 1.456). Critically, these improvements generalised robustly to out-of-domain tasks while maintaining competitive task accuracy. This work establishes a computationally tractable implementation of biologically-inspired metacognitive architecture for large language models, offering a principled pathway towards AI systems capable of reliable intrinsic self-monitoring that can more accurately assess their own knowledge boundaries and express appropriate uncertainty.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above.

sylinrl/TruthfulQA

License: Apache-2.0
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: d71c110897f5d31c5d7f309e7bc316c152f6f031, 15 January 2025
Languages: Python (8), Jupyter (1)
Size: 25 files, 9 scripts
Software Heritage: not archived
Found in: “Data availability”
Holds: README, license file, environment (requirements.txt, setup.py), 1 notebook
Not found: CITATION.cff, tests, continuous integration, documentation
Tools: pandas (5 files), NumPy (2 files), PyTorch (1 file), Hugging Face Transformers (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
11 files

Code availability

The code for our training and evaluation scripts, along with the LORA adapter weights for our models, will be made available upon request to support reproducibility.

Reproduced under the paper's license (CC BY), from the paper cited above.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 9 scripts, each with its path and the digest of its content;
  • no match between paragraphs and code yet;
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Data availability

This study utilised publicly available benchmark datasets. The datasets and their access links are as follows: TruthfulQA: https://github.com/sylinrl/TruthfulQA (also available at https://huggingface.co/datasets/truthful_qa). MMLU (Massive Multitask Language Understanding): https://huggingface.co/datasets/cais/mmlu. ARC (AI2 Reasoning Challenge): https://huggingface.co/datasets/allenai/ai2_arc. HellaSwag: https://huggingface.co/datasets/Rowan/hellaswag. CommonsenseQA: https://huggingface.co/datasets/tau/commonsense_qa. Natural Questions: https://huggingface.co/datasets/google-research-datasets/natural_questions. RAGTruth: https://github.com/ParticleMedia/RAGTruth. The synthetic metacognitive training dataset (4000 examples) and the LoRA adapter weights for our models are available from the corresponding author on reasonable request.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 2 authors, 10 keywords, 4 MeSH terms, 1 funder, 29 references.

Cite

This paper

Luo, W., & Jho, H. (2026). Predictive metacognition: a neuro-computational framework for self-monitoring in large language models. Scientific reports, 16(1), 23962. https://doi.org/10.1038/s41598-026-54840-2

BibTeX

@article{luo2026predictive,
author = {Luo, Wei and Jho, Hunkoog},
title = {{Predictive metacognition: a neuro-computational framework for self-monitoring in large language models}},
journal = {Scientific reports},
year = {2026},
month = may,
volume = {16},
number = {1},
pages = {23962},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/s41598-026-54840-2},
url = {https://doi.org/10.1038/s41598-026-54840-2},
pmid = {42191827},
pmcid = {PMC13434765}
}

RIS

TY - JOUR
AU - Luo, Wei
AU - Jho, Hunkoog
TI - Predictive metacognition: a neuro-computational framework for self-monitoring in large language models
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/05/26
VL - 16
IS - 1
SP - 23962
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/s41598-026-54840-2
UR - https://doi.org/10.1038/s41598-026-54840-2
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41598-026-54840-2",
"type": "article-journal",
"title": "Predictive metacognition: a neuro-computational framework for self-monitoring in large language models",
"container-title": "Scientific reports",
"author": [
{
"family": "Luo",
"given": "Wei"
},
{
"family": "Jho",
"given": "Hunkoog"
}
],
"container-title-short": "Sci Rep",
"volume": "16",
"issue": "1",
"page": "23962",
"DOI": "10.1038/s41598-026-54840-2",
"PMID": "42191827",
"PMCID": "PMC13434765",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41598-026-54840-2",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
26
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1038/s41467-026-74358-5 [code]
Brain-inspired spatial intelligence for embodied agents.
Journal: Nature communications
In common: Hugging Face Transformers, PyTorch, pandas, 1 other tool, cognitive, 1 reference
[2] doi:10.1038/s41467-026-74357-6 [code]
Hippocampo-neocortical interaction as compressive retrieval-augmented generation.
Journal: Nature communications
In common: Hugging Face Transformers, PyTorch, pandas, 1 other tool, 1 reference
[3] doi:10.1038/s41467-026-75841-9 [code]
Model-based semantic distance reveals adaptive coordination of distinct cognitive systems in flexible knowledge retrieval.
Journal: Nature communications
In common: Hugging Face Transformers, PyTorch, pandas, 1 other tool, cognitive
[4] doi:10.1038/s42003-026-10011-7 [code]
Learning brain dynamics across distinct scaling regimes reveals psychiatric signatures.
Journal: Communications biology
In common: Hugging Face Transformers, PyTorch, pandas, 1 other tool, cognitive
[5] doi:10.1038/s42003-026-10169-0 [code]
Shared representations in brains and models reveal a two-route cortical organization during scene perception.
Journal: Communications biology
In common: Hugging Face Transformers, PyTorch, pandas, 1 other tool, cognitive
[6] doi:10.7554/elife.107933 [code]
Modality-agnostic decoding of vision and language from fMRI.
Journal: eLife
In common: Hugging Face Transformers, PyTorch, pandas, 1 other tool, cognitive
[7] doi:10.7554/elife.106543 [code]
Stimulus dependencies-rather than next-word prediction-can explain pre-onset brain encoding in naturalistic listening designs.
Journal: eLife
In common: Hugging Face Transformers, PyTorch, pandas, 1 other tool, cognitive
[8] doi:10.1038/s41467-026-71267-5 [code]
Human-like cognitive generalization for large models via mental representation-guided supervision.
Journal: Nature communications
In common: Hugging Face Transformers, PyTorch, pandas, 1 other tool, cognitive
[9] doi:10.1038/s41598-026-41532-0 [code]
Prediction, syntax and semantic grounding in the brain and large language models.
Journal: Scientific reports
In common: Hugging Face Transformers, PyTorch, pandas, 1 other tool, cognitive
[10] doi:10.1016/j.scog.2026.100443 [code]
From thought to language: Comparing schizophrenia spectrum disorders and Wernicke's aphasia with machine learning and LLMs.
Journal: Schizophrenia research. Cognition
In common: Hugging Face Transformers, PyTorch, pandas, 1 other tool, cognitive

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.