Repository Analysis

openai/tiktoken

tiktoken is a fast BPE tokeniser for use with OpenAI's models.

25.5 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of openai/tiktoken, a Python project with 18,744 GitHub stars. SynthScan v2.0 examined 3,276 lines of code across 25 source files, recording 51 pattern matches distributed across 8 syntactic categories. The overall adjusted score of 25.5 places this repository in the Moderate AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

25.5
Adjusted Score
25.5
Raw Score
100%
Time Factor
2026-05-24
Last Push
18.7K
Stars
Python
Language
3.3K
Lines of Code
25
Files
51
Pattern Hits
2026-07-14
Scan Date
0.00
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 0HIGH 0MEDIUM 14LOW 37

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 51 distinct pattern matches across 8 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Decorative Section Separators14 hits · 45 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_encoding.py127# ====================COMMENT
MEDIUMtests/test_encoding.py129# ====================COMMENT
MEDIUMtests/test_encoding.py170# ====================COMMENT
MEDIUMtests/test_encoding.py172# ====================COMMENT
MEDIUMtests/test_encoding.py234# ====================COMMENT
MEDIUMtests/test_encoding.py236# ====================COMMENT
MEDIUMtiktoken/core.py62 # ====================COMMENT
MEDIUMtiktoken/core.py64 # ====================COMMENT
MEDIUMtiktoken/core.py261 # ====================COMMENT
MEDIUMtiktoken/core.py263 # ====================COMMENT
MEDIUMtiktoken/core.py352 # ====================COMMENT
MEDIUMtiktoken/core.py354 # ====================COMMENT
MEDIUMtiktoken/core.py377 # ====================COMMENT
MEDIUMtiktoken/core.py379 # ====================COMMENT
Unused Imports17 hits · 17 pts
SeverityFileLineSnippetContext
LOWtests/test_helpers.py1CODE
LOWtiktoken/registry.py1CODE
LOWtiktoken/__init__.py2CODE
LOWtiktoken/__init__.py3CODE
LOWtiktoken/__init__.py4CODE
LOWtiktoken/__init__.py5CODE
LOWtiktoken/__init__.py6CODE
LOWtiktoken/core.py1CODE
LOWtiktoken/model.py1CODE
LOWtiktoken/load.py1CODE
LOWtiktoken/_educational.py3CODE
LOWscripts/benchmark.py1CODE
LOWscripts/benchmark.py2CODE
LOWscripts/benchmark.py3CODE
LOWscripts/benchmark.py4CODE
LOWscripts/benchmark.py6CODE
LOWscripts/benchmark.py10CODE
Hyper-Verbose Identifiers10 hits · 10 pts
SeverityFileLineSnippetContext
LOWtests/test_misc.py24def test_optional_blobfile_dependency():CODE
LOWtests/test_encoding.py102def test_encode_surrogate_pairs():CODE
LOWtests/test_encoding.py114def test_catastrophically_repetitive(make_enc: Callable[[], tiktoken.Encoding]):CODE
LOWtests/test_encoding.py159def test_single_token_roundtrip(make_enc: Callable[[], tiktoken.Encoding]):CODE
LOWtests/test_encoding.py229def test_hyp_special_ordinary(make_enc, text: str):CODE
LOWtests/test_simple_public.py36def test_optional_blobfile_dependency():CODE
LOWtiktoken/registry.py20def _available_plugin_modules() -> Sequence[str]:CODE
LOWtiktoken/core.py289 def decode_single_token_bytes(self, token: int) -> bytes:CODE
LOWtiktoken/core.py441def raise_disallowed_special_token(token: str) -> NoReturn:CODE
LOWtiktoken/load.py89def data_gym_to_mergeable_bpe_ranks(CODE
Deep Nesting3 hits · 3 pts
SeverityFileLineSnippetContext
LOWtiktoken/registry.py33CODE
LOWtiktoken/_educational.py83CODE
LOWtiktoken/_educational.py119CODE
Over-Commented Block3 hits · 3 pts
SeverityFileLineSnippetContext
LOWsrc/lib.rs221// Various performance notes:COMMENT
LOWsrc/lib.rs241// =========COMMENT
LOWsrc/lib.rs541 // Morally, this is byte_pair_encode(&possibility, &self.encoder)COMMENT
Excessive Try-Catch Wrapping2 hits · 2 pts
SeverityFileLineSnippetContext
LOWtiktoken/registry.py55 except Exception:CODE
LOWtiktoken/load.py169 except Exception as e:CODE
Redundant / Tautological Comments1 hit · 2 pts
SeverityFileLineSnippetContext
LOWtiktoken/model.py97 # Check if the model matches a known prefixCOMMENT
AI Slop Vocabulary1 hit · 2 pts
SeverityFileLineSnippetContext
LOWtiktoken/_educational.py191 # visualise the token. Here, we'll just use the unicode replacement character to represent someCOMMENT