الانتقال إلى المحتوى
أساسيات الـ AIمفاهيم الـ AI· 6 دقائق للقراءة

Knowledge Cutoff: Why Your Assistant Suggests Deprecated APIs with Confidence

Training data stops at a date the model can't see, so give it current versions, docs and the date yourself.

ReadIn

مقال كل يوم يفرق معاك

21 نوفمبر 2026
  • كاتب موثّق
محتويات المقال

A developer asks an assistant to add new rows to a pandas DataFrame in a fresh project. It answers instantly with orders.append(new_rows, ignore_index=True) and a short explanation. CI fails with AttributeError: 'DataFrame' object has no attribute 'append'. pandas deprecated that method in 1.4 and removed it in 2.0, and the project runs a newer major version. The assistant never hinted that its answer might be out of date.

The common misconception

"An LLM knows the latest library versions and current facts unless it tells you otherwise." Developers come to expect this for good reasons:

  • Assistants often do know recent APIs, so the misses look like exceptions.
  • The tone never changes. A stale answer is written with the same assurance as a current one.
  • Some assistants search the web, so the same question is current in one tool and stale in another.
  • It's natural to assume a system would say "I'm not sure about the newest version" when it should.

The half-truth: a model may know a lot about recent releases, up to a point. It has no built-in signal for where that point is, and it doesn't flag the edge for you.

What actually happens

Knowledge stops at a cutoff

A model is trained on data collected up to some date, then frozen. Anthropic's models overview lists two dates for each model: a training data cutoff, the broader range of data used, and a reliable , the date through which its knowledge is most extensive and reliable. Anything after the training data cutoff is simply absent. And models stay in service long after it: the same page lists retirement dates for the current models that fall more than a year after their training data cutoff.

For a developer, that gap is concrete: a framework's next major version, a renamed configuration option, a security advisory published last month. None of it exists for the model until you put it in the context, and a question about it gets an answer about whatever the model saw last, delivered as if it were current.

The effective cutoff is fuzzier than the reported one

Cheng and colleagues, in Dated Data, probed models against versioned data and found that effective cutoffs often differ from the reported cutoffs, and can differ between resources and topics within one model. Two causes stood out: new web crawl dumps contain non-trivial amounts of old data, and deduplication of near-identical documents behaves in complicated ways. So even before the official cutoff, a model may have seen mostly older versions of a page.

Why the deprecated API wins

Wang and colleagues tested seven LLMs on code completion across eight popular Python libraries. All of them struggled with deprecated APIs, and the paper names two causes: deprecated usages are present in training data, which comes from open-source code without filtering for deprecation, and deprecation knowledge is absent at inference time. The surrounding code mattered a lot: inside functions written in the old style, 70% to 90% of completions used the deprecated API, against 9% to 18% inside up-to-date functions. Legacy code in your file invites legacy suggestions.

Nothing in the output marks it as stale

As earlier articles in this path showed, every answer is generated by the same next-token process. The model has no clock either: today's date reaches it only if your app puts it in the prompt. It can't compare its knowledge with a present it doesn't see.

The same task, old API and current API

Python orders.py
import pandas as pdorders = pd.DataFrame({"id": [1, 2], "total": [120, 80]})new_rows = pd.DataFrame({"id": [3], "total": [50]})# Common in code written before pandas 2.0:orders = orders.append(new_rows, ignore_index=True)# AttributeError: 'DataFrame' object has no attribute 'append'

The fix itself is one line. The point is where the knowledge came from: pandas' 2.0 release notes, not the model. Better still, put the facts the model lacks into its context. This script builds a system prompt from the versions actually installed and today's date:

Python build_prompt.py
from datetime import datefrom importlib.metadata import versionpackages = ["pandas", "numpy", "scikit-learn"]pins = "\n".join(f"- {name} {version(name)}" for name in packages)system_prompt = f"""Today is {date.today().isoformat()}.This project uses exactly these versions:{pins}Use only APIs that exist in these versions. If you are not sure that anAPI exists in them, say so instead of guessing."""print(system_prompt)
MythReality
The model knows the latest versionsIt knows its training data up to a cutoff, then stays in use for months or years
If it's outdated, it will say soStale and current answers come out of the same process, with the same tone
The reported cutoff is exactEffective cutoffs often differ from reported ones and vary by source and topic
It knows today's dateOnly if your app puts the date in the prompt
A deprecation hint in the prompt is enoughIn one study it wasn't; run the code and the tests

How to apply it in your project

  1. Pin and state your versionsKeep a lockfile, and put the versions that matter, plus today's date, into the system prompt or the project instructions your assistant reads.
  2. Ground answers in current docsFor anything that changes, such as APIs, prices or policies, supply the current documentation or enable a search tool instead of relying on memory.
  3. Make deprecations loudFail CI on deprecation warnings and run linters that know your library versions, so stale suggestions fail fast.
  4. Check generated code against release notes when you upgradeBefore a major upgrade, search the codebase for APIs the release notes remove, including code an assistant wrote.

Key takeaways

  • A model's knowledge stops at a training cutoff, and the model keeps answering long after it.
  • Effective cutoffs are fuzzy and vary by topic, so recent releases may be thin or missing even before the cutoff.
  • Deprecated APIs are part of the training data, and nothing in the output marks them as old.
  • The model doesn't know today's date or your versions unless you put them in the prompt.
  • Ground the model with current docs and versions, and let tests and warnings catch the rest.

📚 المصادر

  1. Cheng et al., Dated Data: Tracing Knowledge Cutoffs in Large Language Models, arXiv:2403.12958
  2. Wang et al., LLMs Meet Library Evolution: Evaluating Deprecated API Usage in LLM-based Code Completion (ICSE 2025), arXiv:2406.09834
  3. Models overview: reliable knowledge cutoff and training data cutoff — Claude API Docs
  4. Web search tool — Claude API Docs
  5. What's new in pandas 2.0.0: removed DataFrame.append — pandas documentation

التعليقات (0)