Repository Analysis

skyzh/tiny-llm

A course of learning LLM inference serving on Apple Silicon for systems engineers: build a tiny vLLM + Qwen.

11.6 Low AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of skyzh/tiny-llm, a Python project with 4,431 GitHub stars. SynthScan v2.0 examined 20,059 lines of code across 163 source files, recording 206 pattern matches distributed across 10 syntactic categories. The overall adjusted score of 11.6 places this repository in the Low 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).

11.6
Adjusted Score
11.6
Raw Score
100%
Time Factor
2026-08-01
Last Push
4.4K
Stars
Python
Language
20.1K
Lines of Code
163
Files
206
Pattern Hits
2026-08-02
Scan Date
0.02
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

Longitudinal tracking requires multiple scan runs. Once this repository is re-scanned after new commits land, this chart will visualise how the synthetic code signal evolves over time — enabling you to detect whether AI authorship is growing, stabilising, or being actively corrected by human engineers.

No multi-scan history yet — run the scanner again to build trend data.

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 3MEDIUM 9LOW 194

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 206 distinct pattern matches across 10 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 Imports125 hits · 125 pts
SeverityFileLineSnippetContext
LOWtests_refsol/test_week_3_day_1.py8CODE
LOWtests_refsol/test_week_3_day_1.py9CODE
LOWtests_refsol/test_week_1_day_2.py3CODE
LOWtests_refsol/test_week_1_day_2.py5CODE
LOWtests_refsol/test_week_1_day_3.py3CODE
LOWtests_refsol/test_week_1_day_3.py4CODE
LOWtests_refsol/test_week_1_day_4.py4CODE
LOWtests_refsol/test_week_1_day_4.py5CODE
LOWtests_refsol/test_rope.py3CODE
LOWtests_refsol/test_rope.py4CODE
LOWtests_refsol/tiny_llm_base.py1CODE
LOWtests_refsol/test_week_1_day_5.py2CODE
LOWtests_refsol/test_week_1_day_1.py4CODE
LOWtests_refsol/test_week_1_day_1.py5CODE
LOWtests/tiny_llm_base.py1CODE
LOWsrc/tiny_llm_ref/generate.py3CODE
LOWsrc/tiny_llm_ref/batch.py3CODE
LOWsrc/tiny_llm_ref/batch.py4CODE
LOWsrc/tiny_llm_ref/batch.py5CODE
LOWsrc/tiny_llm_ref/__init__.py1CODE
LOWsrc/tiny_llm_ref/__init__.py2CODE
LOWsrc/tiny_llm_ref/__init__.py3CODE
LOWsrc/tiny_llm_ref/__init__.py4CODE
LOWsrc/tiny_llm_ref/__init__.py5CODE
LOWsrc/tiny_llm_ref/__init__.py6CODE
LOWsrc/tiny_llm_ref/__init__.py7CODE
LOWsrc/tiny_llm_ref/__init__.py8CODE
LOWsrc/tiny_llm_ref/__init__.py9CODE
LOWsrc/tiny_llm_ref/__init__.py10CODE
LOWsrc/tiny_llm_ref/__init__.py11CODE
LOWsrc/tiny_llm_ref/__init__.py12CODE
LOWsrc/tiny_llm_ref/__init__.py13CODE
LOWsrc/tiny_llm_ref/__init__.py14CODE
LOWsrc/tiny_llm_ref/__init__.py15CODE
LOWsrc/tiny_llm_ref/__init__.py16CODE
LOWsrc/tiny_llm_ref/__init__.py17CODE
LOWsrc/tiny_llm_ref/__init__.py18CODE
LOWsrc/tiny_llm_ref/__init__.py19CODE
LOWsrc/tiny_llm_ref/__init__.py20CODE
LOWsrc/tiny_llm_ref/basics.py2CODE
LOWsrc/tiny_llm_ref/agent/protocol.py3CODE
LOWsrc/tiny_llm_ref/agent/__init__.py3CODE
LOWsrc/tiny_llm_ref/agent/__init__.py3CODE
LOWsrc/tiny_llm_ref/agent/__init__.py4CODE
LOWsrc/tiny_llm_ref/agent/__init__.py4CODE
LOWsrc/tiny_llm_ref/agent/__init__.py5CODE
LOWsrc/tiny_llm_ref/agent/__init__.py5CODE
LOWsrc/tiny_llm_ref/agent/__init__.py5CODE
LOWsrc/tiny_llm_ref/agent/__init__.py5CODE
LOWsrc/tiny_llm_ref/agent/__init__.py6CODE
LOWsrc/tiny_llm_ref/agent/__init__.py6CODE
LOWsrc/tiny_llm_ref/agent/__init__.py6CODE
LOWsrc/tiny_llm_ref/agent/__init__.py6CODE
LOWsrc/tiny_llm_ref/agent/__init__.py6CODE
LOWsrc/tiny_llm_ref/agent/__init__.py13CODE
LOWsrc/tiny_llm_ref/agent/__init__.py13CODE
LOWsrc/extensions_ref/build.py2CODE
LOWsrc/extensions_ref/build.py5CODE
LOWsrc/extensions_ref/build.py6CODE
LOWsrc/extensions_ref/build.py7CODE
65 more matches not shown…
Hyper-Verbose Identifiers34 hits · 34 pts
SeverityFileLineSnippetContext
LOWmodel_names.py11def shortcut_name_to_full_name(model_name: str) -> str:CODE
LOWtests_refsol/test_week_3_day_5.py24def test_paged_flash_attention_crosses_noncontiguous_pages(query_length: int):CODE
LOWtests_refsol/test_week_2_day_5.py54def test_swiglu_matches_readable_expression():CODE
LOWtests_refsol/test_week_2_day_5.py60def test_completed_model_integrates_all_cumulative_kernels():CODE
LOWtests_refsol/test_week_2_day_5.py71def test_rmsnorm_checkpoint_does_not_enable_later_fast_kernels():CODE
LOWtests_refsol/test_week_2_day_5.py82def test_rope_checkpoint_does_not_enable_swiglu_early():CODE
LOWtests_refsol/test_week_3_day_4.py19def test_paged_attention_is_course_owned():CODE
LOWtests_refsol/test_week_2_day_4.py17def test_model_integrates_decode_attention_before_fast_kernels():CODE
LOWtests_refsol/test_week_2_day_4.py27def test_fast_attention_matches_grouped_attention():CODE
LOWtests_refsol/test_week_2_day_4.py42def test_custom_metal_attention_matches_grouped_attention():CODE
LOWtests_refsol/test_model_names.py17def test_shortcut_name_to_full_name(shortcut, full_name):CODE
LOWtests_refsol/test_model_names.py21def test_full_model_name_is_unchanged():CODE
LOWtests_refsol/test_week_4_day_7.py13def test_capstone_records_a_safe_reviewable_change(tmp_path):CODE
LOWtests_refsol/test_week_4_day_7.py31def test_capstone_cannot_smuggle_in_a_command(tmp_path):CODE
LOWtests_refsol/test_week_2_day_7.py50def test_split_k_handles_partial_output_tiles_gpu():CODE
LOWtests_refsol/test_week_2_day_7.py80def test_split_k_request_falls_back_for_larger_prefill_gpu():CODE
LOWtests_refsol/test_week_2_day_3.py144def quantized_matvec_custom_helper(num_rows: int):CODE
LOWtests_refsol/test_week_3_day_2.py46def test_chunked_prefill_bounds_work_and_advances_cache():CODE
LOWtests_refsol/test_week_2_day_2.py25def test_single_request_benchmark_releases_cache(monkeypatch):CODE
LOWtests_refsol/test_week_2_day_2.py44def test_single_request_benchmark_releases_cache_after_failure(monkeypatch):CODE
LOWtests_refsol/test_week_2_day_2.py60def test_single_request_benchmark_selects_serving_prefill_logits(monkeypatch):CODE
LOWbenches/bench_week2_operators.py66def report_matmul_progression(CODE
LOWbenches/bench.py338def run_batch_requests_serving(CODE
LOWbenches/test_quantized_matmul.py36def test_mlx_quantized_matmul(benchmark):CODE
LOWbenches/test_quantized_matmul.py50def test_refsol_quantized_matmul(benchmark):CODE
LOWbenches/test_quantized_matmul.py64def test_refsol_quantized_matvec_custom(benchmark):CODE
LOWsrc/tiny_llm_ref/attention.py6def scaled_dot_product_attention_simple(CODE
LOWsrc/tiny_llm_ref/attention.py30def scaled_dot_product_attention_grouped(CODE
LOWsrc/tiny_llm_ref/generate.py47def simple_generate_with_kv_cache(CODE
LOWsrc/tiny_llm_ref/week2_kernels.py60def scaled_dot_product_attention(CODE
LOWsrc/tiny_llm/attention.py5def scaled_dot_product_attention_simple(CODE
LOWsrc/tiny_llm/attention.py41def scaled_dot_product_attention_grouped(CODE
LOWsrc/tiny_llm/generate.py18def simple_generate_with_kv_cache(CODE
LOWsrc/tiny_llm/week2_kernels.py30def scaled_dot_product_attention(CODE
Excessive Try-Catch Wrapping18 hits · 27 pts
SeverityFileLineSnippetContext
LOWtests_refsol/utils.py125 except Exception as e:CODE
LOWtests_refsol/utils.py136 except Exception as e:CODE
LOWtests_refsol/utils.py147 except Exception as e:CODE
MEDIUMtests_refsol/utils.py119def qwen3_0_6b_model_exists() -> bool:CODE
MEDIUMtests_refsol/utils.py130def qwen3_1_7b_model_exists() -> bool:CODE
MEDIUMtests_refsol/utils.py141def qwen3_4b_model_exists() -> bool:CODE
LOWtests/utils.py125 except Exception as e:CODE
LOWtests/utils.py136 except Exception as e:CODE
LOWtests/utils.py147 except Exception as e:CODE
MEDIUMtests/utils.py119def qwen3_0_6b_model_exists() -> bool:CODE
MEDIUMtests/utils.py130def qwen3_1_7b_model_exists() -> bool:CODE
MEDIUMtests/utils.py141def qwen3_4b_model_exists() -> bool:CODE
LOWbenches/utils.py125 except Exception as e:CODE
LOWbenches/utils.py136 except Exception as e:CODE
LOWbenches/utils.py147 except Exception as e:CODE
MEDIUMbenches/utils.py119def qwen3_0_6b_model_exists() -> bool:CODE
MEDIUMbenches/utils.py130def qwen3_1_7b_model_exists() -> bool:CODE
MEDIUMbenches/utils.py141def qwen3_4b_model_exists() -> bool:CODE
Cross-File Repetition3 hits · 15 pts
SeverityFileLineSnippetContext
HIGHtests_refsol/utils.py0build a small mlx-shaped qwen3 model for integration tests.STRING
HIGHtests/utils.py0build a small mlx-shaped qwen3 model for integration tests.STRING
HIGHbenches/utils.py0build a small mlx-shaped qwen3 model for integration tests.STRING
Deep Nesting14 hits · 14 pts
SeverityFileLineSnippetContext
LOWtests_refsol/test_week_3_day_1.py130CODE
LOWtests_refsol/test_week_1_day_3.py7CODE
LOWtests_refsol/test_week_1_day_1.py26CODE
LOWtests_refsol/test_week_1_day_1.py69CODE
LOWscripts/diff_api.py9CODE
LOWbenches/bench_serving_progression.py229CODE
LOWbenches/bench.py338CODE
LOWbenches/bench.py523CODE
LOWbenches/bench.py364CODE
LOWsrc/tiny_llm_ref/generate.py82CODE
LOWsrc/tiny_llm_ref/week2_kernels.py35CODE
LOWsrc/tiny_llm_ref/batch.py120CODE
LOWsrc/tiny_llm_ref/positional_encoding.py26CODE
LOWsrc/tiny_llm_ref/agent/workspace.py258CODE
Verbosity Indicators3 hits · 6 pts
SeverityFileLineSnippetContext
LOWsrc/tiny_llm_ref/kv_cache.py95 # Step 1: append each active row into its request cache. This methodCOMMENT
LOWsrc/tiny_llm_ref/kv_cache.py108 # Step 2: compute seq_len of this batchCOMMENT
LOWsrc/tiny_llm_ref/kv_cache.py116 # Step 3: rebuild one dense batch tensor. True paged attention willCOMMENT
Structural Annotation Overuse3 hits · 6 pts
SeverityFileLineSnippetContext
LOWsrc/tiny_llm_ref/kv_cache.py95 # Step 1: append each active row into its request cache. This methodCOMMENT
LOWsrc/tiny_llm_ref/kv_cache.py108 # Step 2: compute seq_len of this batchCOMMENT
LOWsrc/tiny_llm_ref/kv_cache.py116 # Step 3: rebuild one dense batch tensor. True paged attention willCOMMENT
AI Structural Patterns3 hits · 3 pts
SeverityFileLineSnippetContext
LOWsrc/tiny_llm_ref/qwen3_week3.py207CODE
LOWsrc/tiny_llm_ref/qwen3_week2.py239CODE
LOWsrc/tiny_llm_ref/qwen3_week1.py149CODE
Modern Structural Boilerplate2 hits · 2 pts
SeverityFileLineSnippetContext
LOWsrc/tiny_llm_ref/agent/__init__.py16__all__ = [CODE
LOWsrc/tiny_llm/agent/__init__.py16__all__ = [CODE
Over-Commented Block1 hit · 1 pts
SeverityFileLineSnippetContext
LOWsrc/extensions/src/axpby.cpp1// Copyright © 2023-2025 Apple Inc.COMMENT