NanoKnow: How to Know What Your Language Model Knows
Organizations: University of Waterloo Waterloo, ON, Canada
Abstract
How do large language models (LLMs) know what they know? Answering this question has been difficult because pre-training data is often a "black box" - unknown or inaccessible. The recent release of nanochat - a family of small LLMs with fully open pre-training data - addresses this as it provides a transparent view into where a model's parametric knowledge comes from. Towards the goal of understanding how knowledge is encoded by LLMs, we release NanoKnow, a benchmark dataset that partitions questions from Natural Questions and SQuAD into splits based on whether their answers are present in nanochat's pre-training corpus. Using these splits, we can now properly disentangle the sources of knowledge that LLMs rely on when producing an output. To demonstrate NanoKnow's utility, we conduct experiments using eight nanochat checkpoints. Our findings show: (1) closed-book accuracy is strongly influenced by answer frequency in the pre-training data, (2) providing external evidence can mitigate this frequency dependence, (3) even with external evidence, models are more accurate when answers were seen during pre-training, demonstrating that parametric and external knowledge are complementary, and (4) non-relevant information is harmful, with accuracy decreasing based on both the position and the number of non-relevant contexts. We release all NanoKnow artifacts at https://github.com/castorini/NanoKnow.
Figures & tables
| Type | Question | Answer | Evidence |
| Supported | When was the last time anyone was on the moon? | December 1972 | “No one has walked on the Moon since December 1972 .” |
| What is the main artery that takes blood from the heart to the body? | The aorta | “Arteries begin with the aorta , the large artery leaving the heart.” | |
| Unsupported (Failed LLM Verify) | Who won last year’s NCAA women’s basketball? | South Carolina | “The Wildcats were ranked 8th in the nation before a loss to South Carolina on October 4.” |
| Love Yourself by Justin Bieber is about who? | Rihanna | “Other Icelandic artists have followed in his footsteps, collaborating with international acts like Rihanna and Ed Sheeran.” | |
| Unsupported (No String Match) | Who sang I ran all the way home? | The Impalas | – |
| Who plays Gram on The Young and the Restless? | Max Shippee | – |
| NQ | SQuAD | |
|---|---|---|
| Total QA Pairs | 3,610 | 10,570 |
| String Match only | 73.9% | 78.9% |
| String Match LLM Verify (Supported) | 66.2% | 70.9% |
| NQ | SQuAD | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Closed-Book | w/ FineWeb Context | Closed-Book | w/ FineWeb Context | w/ Original Context | ||||||||
| Model Checkpoint | Model Size | EM | LLM-Judge | EM | LLM-Judge | EM | LLM-Judge | EM | LLM-Judge | EM | LLM-Judge | |
| 1 | sampathchanda/nanochat-d20 | 561M | 0.004 | 0.008 | 0.022 | 0.018 | 0.004 | 0.002 | 0.021 | 0.019 | 0.086 | 0.081 |
| 2 | shu127/nanochat-d20 | 0.003 | 0.005 | 0.021 | 0.016 | 0.003 | 0.011 | 0.016 | 0.013 | 0.042 | 0.040 | |
| 3 | pankajmathur/nanochat-d20 | 0.003 | 0.014 | 0.028 | 0.023 | 0.005 | 0.008 | 0.022 | 0.020 | 0.056 | 0.052 | |
| 4 | karpathy/nanochat-d32 | 1.9B | 0.196 | 0.224 | 0.468 | 0.476 | 0.114 | 0.173 | 0.465 | 0.540 | 0.672 | 0.736 |
| Supported | Unsupported | ||||
| Model Checkpoint | Model Size | EM | LLM-Judge | EM | LLM-Judge |
| sampathchanda/nanochat-d20 | 561M | 0.086 | 0.081 | 0.069 | 0.068 |
| shu127/nanochat-d20 | 0.042 | 0.040 | 0.032 | 0.031 | |
| pankajmathur/nanochat-d20 | 0.056 | 0.052 | 0.051 | 0.054 | |
| karpathy/nanochat-d32 | 1.9B | 0.672 | 0.736 | 0.554 | 0.688 |
| Antigma/nanochat-d32 | 0.686 | 0.740 | 0.553 | 0.680 | |
| Far: [A, D, Q] | Mid: [D, A, D, Q] | Near: [D, A, Q] | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| NQ | SQuAD | NQ | SQuAD | NQ | SQuAD | ||||||||
| Setting | EM | LLM-Judge | EM | LLM-Judge | EM | LLM-Judge | EM | LLM-Judge | EM | LLM-Judge | EM | LLM-Judge | |
| 1 | Closed-Book | 0.198 | 0.226 | 0.122 | 0.169 | 0.198 | 0.226 | 0.122 | 0.169 | 0.198 | 0.226 | 0.122 | 0.169 |
| 2 | Distractor only | 0.152 | 0.194 | 0.091 | 0.154 | 0.152 | 0.194 | 0.091 | 0.154 | 0.152 | 0.194 | 0.091 | 0.154 |
| 3 | Answer only | 0.516 | 0.492 | 0.483 | 0.551 | 0.516 | 0.492 | 0.483 | 0.551 | 0.516 | 0.492 | 0.483 | 0.551 |
| 4 | Answer + 1 Distractor | 0.452 | 0.447 | 0.411 | 0.478 | N/A | 0.456 | 0.457 | 0.428 | 0.501 | |||
Factual Knowledge in Language Models
Factual knowledge in language models concerns what facts they store, how reliably they retrieve them, and how that knowledge can be tested or changed.
See all 193 papers