Repository Analysis

deepseek-ai/DeepSpec

DeepSpec: a full-stack codebase for training and evaluating speculative decoding algorithms

16.0 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of deepseek-ai/DeepSpec, a Python project with 6,639 GitHub stars. SynthScan v2.0 examined 11,816 lines of code across 76 source files, recording 185 pattern matches distributed across 9 syntactic categories. The overall adjusted score of 16.0 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).

16.0
Adjusted Score
16.0
Raw Score
100%
Time Factor
2026-07-09
Last Push
6.6K
Stars
Python
Language
11.8K
Lines of Code
76
Files
185
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 2LOW 183

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 185 distinct pattern matches across 9 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.

Unused Imports78 hits · 78 pts
SeverityFileLineSnippetContext
LOWeval.py1CODE
LOWdeepspec/utils/__init__.py6CODE
LOWdeepspec/utils/__init__.py6CODE
LOWdeepspec/utils/__init__.py6CODE
LOWdeepspec/utils/__init__.py6CODE
LOWdeepspec/utils/__init__.py7CODE
LOWdeepspec/utils/__init__.py7CODE
LOWdeepspec/utils/__init__.py7CODE
LOWdeepspec/utils/__init__.py7CODE
LOWdeepspec/utils/__init__.py7CODE
LOWdeepspec/utils/__init__.py7CODE
LOWdeepspec/utils/__init__.py7CODE
LOWdeepspec/utils/__init__.py16CODE
LOWdeepspec/utils/__init__.py16CODE
LOWdeepspec/utils/__init__.py17CODE
LOWdeepspec/utils/__init__.py17CODE
LOWdeepspec/utils/__init__.py17CODE
LOWdeepspec/utils/__init__.py18CODE
LOWdeepspec/utils/sampling.py1CODE
LOWdeepspec/utils/constant/__init__.py2CODE
LOWdeepspec/utils/constant/__init__.py3CODE
LOWdeepspec/utils/constant/__init__.py5CODE
LOWdeepspec/modeling/__init__.py1CODE
LOWdeepspec/modeling/__init__.py1CODE
LOWdeepspec/modeling/__init__.py1CODE
LOWdeepspec/modeling/__init__.py6CODE
LOWdeepspec/modeling/__init__.py6CODE
LOWdeepspec/modeling/eagle3/__init__.py1CODE
LOWdeepspec/modeling/eagle3/__init__.py1CODE
LOWdeepspec/modeling/eagle3/__init__.py2CODE
LOWdeepspec/modeling/eagle3/__init__.py3CODE
LOWdeepspec/modeling/eagle3/common.py1CODE
LOWdeepspec/modeling/eagle3/gemma4/__init__.py1CODE
LOWdeepspec/modeling/eagle3/gemma4/__init__.py2CODE
LOWdeepspec/modeling/eagle3/gemma4/modeling.py1CODE
LOWdeepspec/modeling/eagle3/qwen3/__init__.py1CODE
LOWdeepspec/modeling/eagle3/qwen3/__init__.py2CODE
LOWdeepspec/modeling/eagle3/qwen3/modeling.py1CODE
LOWdeepspec/modeling/dspark/__init__.py1CODE
LOWdeepspec/modeling/dspark/__init__.py1CODE
LOWdeepspec/modeling/dspark/__init__.py2CODE
LOWdeepspec/modeling/dspark/__init__.py3CODE
LOWdeepspec/modeling/dspark/gemma4/__init__.py1CODE
LOWdeepspec/modeling/dspark/gemma4/__init__.py2CODE
LOWdeepspec/modeling/dspark/qwen3/__init__.py1CODE
LOWdeepspec/modeling/dspark/qwen3/__init__.py2CODE
LOWdeepspec/eval/base_evaluator.py1CODE
LOWdeepspec/eval/__init__.py1CODE
LOWdeepspec/eval/__init__.py1CODE
LOWdeepspec/eval/__init__.py1CODE
LOWdeepspec/eval/__init__.py2CODE
LOWdeepspec/eval/__init__.py2CODE
LOWdeepspec/eval/__init__.py3CODE
LOWdeepspec/eval/__init__.py3CODE
LOWdeepspec/eval/eagle3/__init__.py1CODE
LOWdeepspec/eval/eagle3/__init__.py1CODE
LOWdeepspec/eval/eagle3/evaluator.py1CODE
LOWdeepspec/eval/dspark/__init__.py1CODE
LOWdeepspec/eval/dspark/__init__.py1CODE
LOWdeepspec/eval/dspark/__init__.py2CODE
18 more matches not shown…
Hyper-Verbose Identifiers53 hits · 53 pts
SeverityFileLineSnippetContext
LOWdeepspec/utils/metrics.py72def _assert_schema_consistent():CODE
LOWdeepspec/modeling/eagle3/loss.py57def _compute_loss_normalizers(CODE
LOWdeepspec/modeling/eagle3/loss.py77def _build_next_token_position_mask(CODE
LOWdeepspec/modeling/eagle3/loss.py92def _build_padded_next_token_target_probs(CODE
LOWdeepspec/modeling/eagle3/loss.py162def _log_softmax_forward_kernel(CODE
LOWdeepspec/modeling/eagle3/loss.py225def _log_softmax_backward_kernel(CODE
LOWdeepspec/modeling/eagle3/common.py56def get_compiled_flex_attention():CODE
LOWdeepspec/modeling/eagle3/common.py64def compile_friendly_flex_attention(CODE
LOWdeepspec/modeling/eagle3/common.py77def get_compiled_create_block_mask():CODE
LOWdeepspec/modeling/eagle3/common.py87def compile_friendly_create_block_mask(CODE
LOWdeepspec/modeling/eagle3/gemma4/config.py22def _validate_required_text_fields(text_config) -> None:CODE
LOWdeepspec/modeling/eagle3/gemma4/modeling.py307 def initialize_embeddings_and_head(CODE
LOWdeepspec/modeling/eagle3/gemma4/modeling.py322 def set_embedding_head_trainable(self, trainable: bool):CODE
LOWdeepspec/modeling/eagle3/qwen3/modeling.py245 def initialize_embeddings_and_head(CODE
LOWdeepspec/modeling/eagle3/qwen3/modeling.py260 def set_embedding_head_trainable(self, trainable: bool):CODE
LOWdeepspec/modeling/dspark/loss.py11def _all_reduce_loss_denominators(CODE
LOWdeepspec/modeling/dspark/loss.py40def _compute_local_probabilistic_stats(CODE
LOWdeepspec/modeling/dspark/common.py59def validate_target_layer_ids(layer_ids, num_target_layers: int):CODE
LOWdeepspec/modeling/dspark/common.py78def create_dspark_attention_mask(CODE
LOWdeepspec/modeling/dspark/common.py109def build_anchor_candidate_mask(CODE
LOWdeepspec/modeling/dspark/gemma4/config.py22def _validate_required_text_fields(text_config) -> None:CODE
LOWdeepspec/modeling/dspark/gemma4/modeling.py320 def initialize_embeddings_and_head(CODE
LOWdeepspec/modeling/dspark/gemma4/modeling.py335 def set_embedding_head_trainable(self, trainable: bool):CODE
LOWdeepspec/modeling/dspark/qwen3/modeling.py270 def initialize_embeddings_and_head(CODE
LOWdeepspec/modeling/dspark/qwen3/modeling.py285 def set_embedding_head_trainable(self, trainable: bool):CODE
LOWdeepspec/eval/base_evaluator.py100def assert_no_final_target_layer(target_model, target_layer_ids) -> None:CODE
LOWdeepspec/eval/base_evaluator.py550 def allreduce_response_metrics(CODE
LOWdeepspec/eval/dspark/draft_ops.py22def forward_dspark_draft_block(CODE
LOWdeepspec/eval/dspark/draft_ops.py57def _predict_confidence_logits(CODE
LOWdeepspec/eval/dspark/evaluator.py44 def _build_confidence_head_recorder(self) -> ConfidenceHeadRecorder | None:CODE
LOWdeepspec/data/target_cache_dataset.py38def build_target_cache_shard_path(cache_dir: str, file_name: str) -> str:CODE
LOWdeepspec/data/target_cache_dataset.py42def expected_target_cache_tensor_numel(CODE
LOWdeepspec/data/target_cache_dataset.py57def expected_target_cache_tensor_nbytes(CODE
LOWdeepspec/data/target_cache_dataset.py123def load_target_cache_manifest(cache_dir: str):CODE
LOWdeepspec/data/target_cache_dataset.py132def validate_target_cache_manifest(*, cache_dir: str, manifest):CODE
LOWdeepspec/data/target_cache_dataset.py231def compute_local_sample_range(*, num_samples: int, rank: int, world_size: int):CODE
LOWdeepspec/data/target_cache_dataset.py239def prepare_target_cache_output_dir(output_dir: str):CODE
LOWdeepspec/data/target_cache_dataset.py283def build_target_cache_sample_bytes(CODE
LOWdeepspec/data/target_cache_dataset.py505def load_local_cache_write_summary(rank_dir: str):CODE
LOWdeepspec/data/target_cache_dataset.py510def build_global_target_cache_shard_map(summaries):CODE
LOWdeepspec/data/target_cache_dataset.py532def rename_local_target_cache_shards(*, output_dir: str, rank_dir: str, summary, shard_map):CODE
LOWdeepspec/data/target_cache_dataset.py540def finalize_target_cache_index(*, output_dir: str, summaries, shard_map):CODE
LOWdeepspec/data/target_cache_dataset.py580def build_target_cache_manifest(CODE
LOWdeepspec/data/target_cache_dataset.py605def write_target_cache_manifest(*, output_dir: str, manifest):CODE
LOWdeepspec/data/target_cache_dataset.py609def cleanup_target_cache_tmp_dir(output_dir: str):CODE
LOWdeepspec/trainer/base_trainer.py77def _compute_gradient_accumulation_steps(CODE
LOWdeepspec/trainer/base_trainer.py89def _compute_samples_per_epoch(*, dataset_size: int, global_batch_size: int) -> int:CODE
LOWdeepspec/trainer/base_trainer.py98def _compute_training_schedule(CODE
LOWdeepspec/trainer/ckpt_manager.py25def discover_latest_checkpoint(checkpoint_dir):CODE
LOWdeepspec/trainer/ckpt_manager.py188def _rank_training_state_path(checkpoint_dir: str, global_rank: int) -> str:CODE
LOWdeepspec/trainer/ckpt_manager.py195def _serialize_training_state(CODE
LOWscripts/data/generate_train_data.py53def get_random_reasoning_effort():CODE
LOWscripts/data/prepare_target_cache.py83def run_target_forward_with_hooks(CODE
Modern Structural Boilerplate30 hits · 30 pts
SeverityFileLineSnippetContext
LOWdeepspec/__init__.py1__all__ = []CODE
LOWdeepspec/utils/metrics.py173__all__ = ["add_metric", "flush", "reset"]CODE
LOWdeepspec/utils/__init__.py66__all__ = [CODE
LOWdeepspec/utils/sampling.py47__all__ = [CODE
LOWdeepspec/modeling/__init__.py8__all__ = [CODE
LOWdeepspec/modeling/eagle3/__init__.py5__all__ = [CODE
LOWdeepspec/modeling/eagle3/loss.py455__all__ = [CODE
LOWdeepspec/modeling/eagle3/common.py193__all__ = [CODE
LOWdeepspec/modeling/eagle3/gemma4/config.py91__all__ = [CODE
LOWdeepspec/modeling/eagle3/gemma4/__init__.py4__all__ = [CODE
LOWdeepspec/modeling/eagle3/gemma4/modeling.py491__all__ = [CODE
LOWdeepspec/modeling/eagle3/qwen3/config.py42__all__ = [CODE
LOWdeepspec/modeling/eagle3/qwen3/__init__.py4__all__ = [CODE
LOWdeepspec/modeling/eagle3/qwen3/modeling.py410__all__ = [CODE
LOWdeepspec/modeling/dspark/__init__.py5__all__ = [CODE
LOWdeepspec/modeling/dspark/loss.py332__all__ = [CODE
LOWdeepspec/modeling/dspark/common.py297__all__ = [CODE
LOWdeepspec/modeling/dspark/markov_head.py314__all__ = [CODE
LOWdeepspec/modeling/dspark/gemma4/config.py105__all__ = [CODE
LOWdeepspec/modeling/dspark/gemma4/__init__.py4__all__ = [CODE
LOWdeepspec/modeling/dspark/gemma4/modeling.py600__all__ = [CODE
LOWdeepspec/modeling/dspark/qwen3/config.py59__all__ = [CODE
LOWdeepspec/modeling/dspark/qwen3/__init__.py4__all__ = [CODE
LOWdeepspec/modeling/dspark/qwen3/modeling.py528__all__ = [CODE
LOWdeepspec/eval/__init__.py5__all__ = [CODE
LOWdeepspec/eval/eagle3/__init__.py3__all__ = ["Gemma4Eagle3Evaluator", "Qwen3Eagle3Evaluator"]CODE
LOWdeepspec/eval/eagle3/evaluator.py195__all__ = ["Gemma4Eagle3Evaluator", "Qwen3Eagle3Evaluator"]CODE
LOWdeepspec/eval/dspark/__init__.py9__all__ = [CODE
LOWdeepspec/data/__init__.py9__all__ = [CODE
LOWdeepspec/trainer/__init__.py5__all__ = [CODE
Excessive Try-Catch Wrapping6 hits · 7 pts
SeverityFileLineSnippetContext
MEDIUMdeepspec/utils/__init__.py29def run_git_text(cmd):CODE
LOWdeepspec/utils/__init__.py36 except Exception:CODE
LOWdeepspec/utils/__init__.py62 except Exception:CODE
LOWscripts/data/generate_train_data.py131 except Exception as exc:CODE
LOWscripts/data/generate_train_data.py165 except Exception as exc:CODE
LOWscripts/data/generate_train_data.py192 except Exception as exc:CODE
AI Structural Patterns6 hits · 6 pts
SeverityFileLineSnippetContext
LOWdeepspec/modeling/eagle3/gemma4/modeling.py221CODE
LOWdeepspec/modeling/eagle3/gemma4/modeling.py398CODE
LOWdeepspec/modeling/eagle3/qwen3/modeling.py169CODE
LOWdeepspec/modeling/eagle3/qwen3/modeling.py324CODE
LOWdeepspec/modeling/dspark/gemma4/modeling.py201CODE
LOWdeepspec/modeling/dspark/qwen3/modeling.py165CODE
Deep Nesting6 hits · 6 pts
SeverityFileLineSnippetContext
LOWdeepspec/eval/base_evaluator.py550CODE
LOWdeepspec/data/target_cache_dataset.py438CODE
LOWeval_datasets/convert_eval_datasets_to_jsonl.py251CODE
LOWscripts/data/generate_train_data.py57CODE
LOWscripts/data/generate_train_data.py272CODE
LOWscripts/data/prepare_target_cache.py209CODE
Structural Annotation Overuse3 hits · 4 pts
SeverityFileLineSnippetContext
LOWscripts/data/README.md27## Step 1: Download And Split DataCOMMENT
LOWscripts/data/README.md47## Step 2: Regenerate Answers With Qwen3-4BCOMMENT
LOWscripts/data/README.md103## Step 3: Prepare Target CacheCOMMENT
AI Slop Vocabulary1 hit · 3 pts
SeverityFileLineSnippetContext
MEDIUMscripts/train/train.sh34# local_batch_size is the per-GPU micro-batch size. Raise it to better utilize GPUsCOMMENT
Over-Commented Block2 hits · 2 pts
SeverityFileLineSnippetContext
LOWscripts/train/train.sh1#!/usr/bin/env bashCOMMENT
LOWscripts/train/train.sh21# config/eagle3/eagle3_qwen3_4b.pyCOMMENT