SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2304.13343 · 2023

SCM: Enhancing Large Language Model with Self-Controlled Memory Framework

arXiv · PDF · Open in the Atlas

Code that ran

3 of 14 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 3 have no contract verdict; 0 failures of our instrument; 11 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/2304.13343.json · badge: /api/ran/2304.13343.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
wbbeyourself/scm4llms canonical (classifier label)
classifier basis: census
3 ran · 11 no recorded run
FunctionStatusWhere it lives
count_json Ran
ran on a synthesized input
wbbeyourself/scm4llms/annotation_scripts/annotation.py
code served (permissive licence) · get_code("10423bba1f11553a")
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 torch

# Construct valid arguments for count_json
json_list = [
    {'id': 1, 'name': 'item1'},
    {'id': 2, 'name': 'item2'},
    {'id': 1, 'name': 'item3'},
    {'id': 3, 'name': 'item4'},
    {'id': 1, 'name': 'item5'},
]

cur_id = 1

ARGS = {
    'json_list': json_list,
    'cur_id': cur_id,
}
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 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
detect_language Ran
ran on a synthesized input
wbbeyourself/scm4llms/tools.py
code served (permissive licence) · get_code("b9c65960cb210134")
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

LANG_EN = 'English'
LANG_ZH = 'Chinese'

def detect_language(text):
    total_count = len(text)
    en_count = len(re.findall('[a-zA-Z]', text))
    if en_count / total_count > 0.6:
        return LANG_EN
    else:
        return LANG_ZH

# Test case 1: English text (more than 60% English characters)
text_en = "Hello World This is English text with many letters"

# Test case 2: Chinese text (less than 60% English characters)
text_zh = "这是中文文本,包含很少的English字符"

# Setup argument for function execution
ARGS = {
    'text': text_en
}
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
validate_input Ran
ran on a synthesized input
wbbeyourself/scm4llms/annotation_scripts/annotation.py
code served (permissive licence) · get_code("518f9bb7fbca9816")
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 os
import json
import tempfile
import shutil

# Create a temporary directory for the annotation data
temp_dir = tempfile.mkdtemp()
annotation_data_dir = os.path.join(temp_dir, 'annotation_data')
os.makedirs(annotation_data_dir, exist_ok=True)

# Create a sample data.json file
data_file = os.path.join(annotation_data_dir, 'data.json')
sample_data = [
    {'id': '001', 'question': 'What is AI?', 'answer': 'Artificial Intelligence'},
    {'id': '002', 'question': 'What is ML?', 'answer': 'Machine Learning'}
]
with open(data_file, 'w', encoding='utf-8') as f:
    json.dump(sample_data, f, ensure_ascii=False)

# Patch the target_file path for testing
import sys
module_code = '''
import os
import json

target_file = '{}'

def load_data_json():
    if not os.path.exists(target_file):
        return []
    with open(target_file, 'r', encoding='utf-8') as f:
        records = json.load(f)
    return records

def validate_input(id, question, answer):
    """
    校验函数
    """
    data = load_data_json()
    if len(data) > 1 and id == 'same':
        id = data[-1]['id']
    for item in data:
        if item['id'] == id and item['question'] == question and (item['answer'] == answer):
            return f'重复添加 {{str(item)}}'
    if not id.strip() or not question.strip() or (not answer.strip()):
        return '输入不能为空,请输入一个有效的值。'
    return ''
'''.format(data_file)

exec(module_code)

# Define arguments for validate_input function
ARGS = {
    'id': '003',
    'question': 'What is Python?',
    'answer': 'A programming language'
}
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_concat_input Not yet run
unverified (harvested, no recorded run)
wbbeyourself/scm4llms/book_summary.py
code served (permissive licence) · get_code("a411dfa00a1e73ea")
How it ran

no invocation recorded.

get_concat_input Not yet run
unverified (harvested, no recorded run)
wbbeyourself/scm4llms/dialogue_demo.py
code served (permissive licence) · get_code("803c2139dfd43eaa")
How it ran

no invocation recorded.

get_concat_input Not yet run
unverified (harvested, no recorded run)
wbbeyourself/scm4llms/meeting_summary.py
code served (permissive licence) · get_code("7211b8c87c9e925a")
How it ran

no invocation recorded.

get_first_prompt Not yet run
unverified (harvested, no recorded run)
wbbeyourself/scm4llms/book_summary.py
code served (permissive licence) · get_code("1a3268e117d230ad")
How it ran

no invocation recorded.

get_first_prompt Not yet run
unverified (harvested, no recorded run)
wbbeyourself/scm4llms/dialogue_demo.py
code served (permissive licence) · get_code("bb790cffb3d7e668")
How it ran

no invocation recorded.

get_first_prompt Not yet run
unverified (harvested, no recorded run)
wbbeyourself/scm4llms/meeting_summary.py
code served (permissive licence) · get_code("a3ed602f18ef6ed4")
How it ran

no invocation recorded.

get_paragragh_prompt Not yet run
unverified (harvested, no recorded run)
wbbeyourself/scm4llms/book_summary.py
code served (permissive licence) · get_code("ffef86c759629aeb")
How it ran

no invocation recorded.

get_paragragh_prompt Not yet run
unverified (harvested, no recorded run)
wbbeyourself/scm4llms/meeting_summary.py
code served (permissive licence) · get_code("5767be9e7d8c38da")
How it ran

no invocation recorded.

get_token_count_davinci Not yet run
unverified (harvested, no recorded run)
wbbeyourself/scm4llms/tools.py
code served (permissive licence) · get_code("2d0add75408a4bea")
How it ran

no invocation recorded.

get_tokenizer_func Not yet run
unverified (harvested, no recorded run)
wbbeyourself/scm4llms/core/book.py
code served (permissive licence) · get_code("16be2585e4695229")
How it ran

no invocation recorded.

load_cache Not yet run
unverified (harvested, no recorded run)
wbbeyourself/scm4llms/core/api.py
code served (permissive licence) · get_code("80afe2c0051330cf")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 14 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.

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

Large Language Models (LLMs) are constrained by their inability to process lengthy inputs, resulting in the loss of critical historical information. To address this limitation, in this paper, we propose the Self-Controlled Memory (SCM) framework to enhance the ability of LLMs to maintain long-term memory and recall relevant information. Our SCM framework comprises three key components: an LLM-based agent serving as the backbone of the framework, a memory stream storing agent memories, and a memory controller updating memories and determining when and how to utilize memories from memory stream. Additionally, the proposed SCM is able to process ultra-long texts without any modification or fine-tuning, which can integrate with any instruction following LLMs in a plug-and-play paradigm. Furthermore, we annotate a dataset to evaluate the effectiveness of SCM for handling lengthy inputs. The annotated dataset covers three tasks: long-term dialogues, book summarization, and meeting summarization. Experimental results demonstrate that our method achieves better retrieval recall and generates more informative responses compared to competitive baselines in long-term dialogues. (https://github.com/wbbeyourself/SCM4LLMs)

For agents

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

get_harvested_code_for_paper("2304.13343")
get_code_for_paper("2304.13343")
have("2304.13343")

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

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

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

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

Connect an agent — have() is free.