SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2502.11196 · 2025

How Do LLMs Acquire New Knowledge? A Knowledge Circuits Perspective on Continual Pre-Training

arXiv · PDF · Open in the Atlas

Code that ran

10 of 13 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, 0 violated it and 7 have no contract verdict; 3 failures of our instrument; 3 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/2502.11196.json · badge: /api/ran/2502.11196.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
zjunlp/dynamicknowledgecircuits canonical (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
zjunlp/knowledgecircuits canonical (classifier label)
classifier basis not recorded on the link
4 ran · 3 no recorded run
FunctionStatusWhere it lives
check_subrange Ran
ran on a synthesized input
zjunlp/dynamicknowledgecircuits/analyzer.py
code served (permissive licence) · get_code("40e6588541e6e5a6")
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
import numpy as np

torch.manual_seed(0)

# Analyze the function:
# - tokens: needs to support slicing with tokens[range[0]:range[1]]
# - sublist: needs to be iterable and support equality comparison with elements from tokens
# - range: needs to be indexable with range[0] and range[1]

# The function extracts a slice from tokens and compares it element-wise with sublist
# tokens can be a list, tuple, or tensor
# sublist should be a list or similar iterable
# range should be a tuple or list with two integer indices

# Create a simple list of tokens (strings or integers work)
tokens = ['hello', 'world', 'foo', 'bar', 'baz']

# Create a sublist that matches a portion of tokens
sublist = ['foo', 'bar']

# Create a range that extracts indices 2:4 (which gives 'foo', 'bar')
range_indices = (2, 4)

ARGS = {
    'tokens': tokens,
    'sublist': sublist,
    'range': range_indices
}
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 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
collate_EAP Ran
ran on a synthesized input
zjunlp/knowledgecircuits/eap/dataset.py
code served (permissive licence) · get_code("efc2c35b94f77777")
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 tuple. 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

torch.manual_seed(0)

# The function expects:
# - xs: an iterable of tuples with (clean, corrupted, labels)
# - task: a string that determines whether 'hypernymy' is in it

# Create sample data items
# Each item is a tuple of (clean, corrupted, labels)
clean_1 = torch.randn(4, 3)
corrupted_1 = torch.randn(4, 3)
labels_1 = 1

clean_2 = torch.randn(4, 3)
corrupted_2 = torch.randn(4, 3)
labels_2 = 0

xs = [
    (clean_1, corrupted_1, labels_1),
    (clean_2, corrupted_2, labels_2),
]

task = "classification"

ARGS = {
    "xs": xs,
    "task": task,
}
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 tuple — a tuple output has no array shape of its own; none is 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
collate_custom Ran
ran on a synthesized input
zjunlp/dynamicknowledgecircuits/circuit_eval.py
code served (permissive licence) · get_code("afcfba1b1dd54a83")
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 tuple. 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
import numpy as np

torch.manual_seed(0)

# The function expects xs to be an iterable of tuples (clean, label)
# It unpacks them, converts clean to a list, and returns (clean_list, labels_tuple)

# Create a small batch of data
# Each element is a tuple of (clean_data, label)
xs = [
    (torch.randn(4), 0),
    (torch.randn(4), 1),
]

ARGS = {
    "xs": xs
}
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 tuple — a tuple output has no array shape of its own; none is 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
decode_tokens Ran
ran; our contract draft was wrong, not the code
zjunlp/dynamicknowledgecircuits/analyzer.py
code served (permissive licence) · get_code("9532c9c8f3eec45b")
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 2, 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
import numpy as np

torch.manual_seed(0)

class MockTokenizer:
    def decode(self, token_list):
        return "".join([f"token_{t}" for t in token_list])

tokenizer = MockTokenizer()

# Test with 1D array
token_array_1d = np.array([1, 2, 3, 4])

# Test with 2D array
token_array_2d = np.array([[1, 2, 3], [4, 5, 6]])

ARGS = {
    "tokenizer": tokenizer,
    "token_array": token_array_2d
}
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 2, 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
find_sublist_index Ran
ran on a synthesized input
zjunlp/dynamicknowledgecircuits/analyzer.py
code served (permissive licence) · get_code("fdb50ecaa0c44c72")
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 tuple, 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

torch.manual_seed(0)

# The function find_sublist_index takes two lists and finds if sub_list appears in main_list
# It returns a tuple (start_index, end_index) if found, None otherwise
# The function uses list slicing and list equality comparison

main_list = [1, 2, 3, 4, 5, 6, 7, 8]
sub_list = [4, 5, 6]

ARGS = {
    "main_list": main_list,
    "sub_list": sub_list
}
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 tuple, ndim 1, dtype family int — a tuple 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
get_logit_positions Ran
ran; our contract draft was wrong, not the code
zjunlp/knowledgecircuits/eap/metrics.py
pointer only (licence: MIT); the stored copy get_code serves, from Zodiark-ch/MechLocalization, is pointer only (licence: NONE) · get_code("2d0e3af4f9982026")
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 Zodiark-ch/MechLocalization, 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.

js_div Ran
ran; our contract draft was wrong, not the code
zjunlp/knowledgecircuits/eap/metrics.py
code served (permissive licence) · get_code("495039ab141aa6fa")
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 Tensor, ndim 1, dtype family float, shape (2,) 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 torch.nn.functional as F

torch.manual_seed(0)

# Create two probability distributions as tensors
# Shape: (batch_size=2, num_classes=4)
# These should be log-probabilities or probabilities depending on the function's needs
p = torch.randn(2, 4)
p = F.softmax(p, dim=-1)  # Normalize to valid probability distribution

q = torch.randn(2, 4)
q = F.softmax(q, dim=-1)  # Normalize to valid probability distribution

ARGS = {
    "p": p,
    "q": q,
}
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 Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) 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
logit_diff_metric Ran
ran on a synthesized input
zjunlp/knowledgecircuits/acdc/acdc_utils.py
code served (permissive licence) · get_code("988d0ee24c8fd958")
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 Tensor, 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

torch.manual_seed(0)

# The function expects:
# - logits: a tensor indexed as logits[range, -1, labels], so shape (batch_size, seq_len, vocab_size)
# - correct_labels: indices into the vocab dimension
# - wrong_labels: indices into the vocab dimension
# - return_one_element: bool

batch_size = 2
seq_len = 3
vocab_size = 4

logits = torch.randn(batch_size, seq_len, vocab_size)
correct_labels = torch.tensor([0, 2])
wrong_labels = torch.tensor([1, 3])
return_one_element = True

ARGS = {
    "logits": logits,
    "correct_labels": correct_labels,
    "wrong_labels": wrong_labels,
    "return_one_element": return_one_element,
}
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 Tensor, 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
read_jsonl Ran
ran on a synthesized input
zjunlp/dynamicknowledgecircuits/utils.py
code served (permissive licence) · get_code("bf43819905001d75")
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 json
import tempfile
import os

# Create a temporary JSONL file with test data
temp_dir = tempfile.mkdtemp()
test_file = os.path.join(temp_dir, 'test.jsonl')

# Write some valid JSONL data
with open(test_file, 'w', encoding='utf-8') as f:
    f.write(json.dumps({'id': 1, 'text': 'hello'}) + '\n')
    f.write(json.dumps({'id': 2, 'text': 'world'}) + '\n')
    f.write(json.dumps({'id': 3, 'data': [1, 2, 3]}) + '\n')

ARGS = {
    'file_path': test_file
}
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 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
reduce_array Ran
ran on a synthesized input
zjunlp/dynamicknowledgecircuits/utils.py
code served (permissive licence) · get_code("531c98e0ea0d23d5")
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

torch.manual_seed(0)

# The function takes an array and reduces it to n elements
# arr: can be a list or array-like object that supports len() and indexing
# n: an integer representing the target number of elements

# Create a sorted array (can be list or numpy array)
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
n = 5

ARGS = {
    "arr": arr,
    "n": n,
}
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
generate_random_color Not yet run
unverified (harvested, no recorded run)
zjunlp/knowledgecircuits/acdc/acdc_graphics.py
code served (permissive licence) · get_code("6f89c1453cf54061")
How it ran

no invocation recorded.

kl_divergence Not yet run
unverified (harvested, no recorded run)
zjunlp/knowledgecircuits/acdc/acdc_utils.py
code served (permissive licence) · get_code("de093820db99eddf")
How it ran

no invocation recorded.

negative_log_probs Not yet run
unverified (harvested, no recorded run)
zjunlp/knowledgecircuits/acdc/acdc_utils.py
code served (permissive licence) · get_code("196dd4ba51364877")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 6 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 2 later) and 7 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
decode_tokens 3 other papers
3 dated earlier
2312.07876 (2023-12)
Causality Analysis for Evaluating the Security of Large Language Models
2405.18166 (2024-05)
Defending Large Language Models Against Jailbreak Attacks via Layer-specific Editing
2411.18620 (2024-11)
Cross-modal Information Flow in Multimodal Large Language Models
generate_random_color 1 other paper
1 dated earlier
2304.14997 (2023-04)
Towards Automated Circuit Discovery for Mechanistic Interpretability
get_logit_positions 1 other paper
1 later
2605.06076 (2026-05)
Navigating by Old Maps: The Pitfalls of Static Mechanistic Localization in LLM Post-Training
js_div 1 other paper
1 later
2606.16920 (2026-06)
Demystifying Variance in Circuit Discovery of LLMs
kl_divergence 1 other paper
1 dated earlier
2304.14997 (2023-04)
Towards Automated Circuit Discovery for Mechanistic Interpretability
logit_diff_metric 1 other paper
1 dated earlier
2304.14997 (2023-04)
Towards Automated Circuit Discovery for Mechanistic Interpretability

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

Despite exceptional capabilities in knowledge-intensive tasks, Large Language Models (LLMs) face a critical gap in understanding how they internalize new knowledge, particularly how to structurally embed acquired knowledge in their neural computations. We address this issue through the lens of knowledge circuit evolution, identifying computational subgraphs that facilitate knowledge storage and processing. Our systematic analysis of circuit evolution throughout continual pre-training reveals several key findings: (1) the acquisition of new knowledge is influenced by its relevance to pre-existing knowledge; (2) the evolution of knowledge circuits exhibits a distinct phase shift from formation to optimization; (3) the evolution of knowledge circuits follows a deep-to-shallow pattern. These insights not only advance our theoretical understanding of the mechanisms of new knowledge acquisition in LLMs, but also provide potential implications for improving continual pre-training strategies to enhance model performance. Code and data will be available at https://github.com/zjunlp/DynamicKnowledgeCircuits.

For agents

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

get_harvested_code_for_paper("2502.11196")
get_code_for_paper("2502.11196")
have("2502.11196")

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

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

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

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

Connect an agent — have() is free.