A course of learning LLM inference serving on Apple Silicon for systems engineers: build a tiny vLLM + Qwen.
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).
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.
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.
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.
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.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests_refsol/test_week_3_day_1.py | 8 | CODE | |
| LOW | tests_refsol/test_week_3_day_1.py | 9 | CODE | |
| LOW | tests_refsol/test_week_1_day_2.py | 3 | CODE | |
| LOW | tests_refsol/test_week_1_day_2.py | 5 | CODE | |
| LOW | tests_refsol/test_week_1_day_3.py | 3 | CODE | |
| LOW | tests_refsol/test_week_1_day_3.py | 4 | CODE | |
| LOW | tests_refsol/test_week_1_day_4.py | 4 | CODE | |
| LOW | tests_refsol/test_week_1_day_4.py | 5 | CODE | |
| LOW | tests_refsol/test_rope.py | 3 | CODE | |
| LOW | tests_refsol/test_rope.py | 4 | CODE | |
| LOW | tests_refsol/tiny_llm_base.py | 1 | CODE | |
| LOW | tests_refsol/test_week_1_day_5.py | 2 | CODE | |
| LOW | tests_refsol/test_week_1_day_1.py | 4 | CODE | |
| LOW | tests_refsol/test_week_1_day_1.py | 5 | CODE | |
| LOW | tests/tiny_llm_base.py | 1 | CODE | |
| LOW | src/tiny_llm_ref/generate.py | 3 | CODE | |
| LOW | src/tiny_llm_ref/batch.py | 3 | CODE | |
| LOW | src/tiny_llm_ref/batch.py | 4 | CODE | |
| LOW | src/tiny_llm_ref/batch.py | 5 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 1 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 2 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 3 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 4 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 5 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 6 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 7 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 8 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 9 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 10 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 11 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 12 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 13 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 14 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 15 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 16 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 17 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 18 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 19 | CODE | |
| LOW | src/tiny_llm_ref/__init__.py | 20 | CODE | |
| LOW | src/tiny_llm_ref/basics.py | 2 | CODE | |
| LOW | src/tiny_llm_ref/agent/protocol.py | 3 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 3 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 3 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 4 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 4 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 5 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 5 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 5 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 5 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 6 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 6 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 6 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 6 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 6 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 13 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 13 | CODE | |
| LOW | src/extensions_ref/build.py | 2 | CODE | |
| LOW | src/extensions_ref/build.py | 5 | CODE | |
| LOW | src/extensions_ref/build.py | 6 | CODE | |
| LOW | src/extensions_ref/build.py | 7 | CODE | |
| 65 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | model_names.py | 11 | def shortcut_name_to_full_name(model_name: str) -> str: | CODE |
| LOW | tests_refsol/test_week_3_day_5.py | 24 | def test_paged_flash_attention_crosses_noncontiguous_pages(query_length: int): | CODE |
| LOW | tests_refsol/test_week_2_day_5.py | 54 | def test_swiglu_matches_readable_expression(): | CODE |
| LOW | tests_refsol/test_week_2_day_5.py | 60 | def test_completed_model_integrates_all_cumulative_kernels(): | CODE |
| LOW | tests_refsol/test_week_2_day_5.py | 71 | def test_rmsnorm_checkpoint_does_not_enable_later_fast_kernels(): | CODE |
| LOW | tests_refsol/test_week_2_day_5.py | 82 | def test_rope_checkpoint_does_not_enable_swiglu_early(): | CODE |
| LOW | tests_refsol/test_week_3_day_4.py | 19 | def test_paged_attention_is_course_owned(): | CODE |
| LOW | tests_refsol/test_week_2_day_4.py | 17 | def test_model_integrates_decode_attention_before_fast_kernels(): | CODE |
| LOW | tests_refsol/test_week_2_day_4.py | 27 | def test_fast_attention_matches_grouped_attention(): | CODE |
| LOW | tests_refsol/test_week_2_day_4.py | 42 | def test_custom_metal_attention_matches_grouped_attention(): | CODE |
| LOW | tests_refsol/test_model_names.py | 17 | def test_shortcut_name_to_full_name(shortcut, full_name): | CODE |
| LOW | tests_refsol/test_model_names.py | 21 | def test_full_model_name_is_unchanged(): | CODE |
| LOW | tests_refsol/test_week_4_day_7.py | 13 | def test_capstone_records_a_safe_reviewable_change(tmp_path): | CODE |
| LOW | tests_refsol/test_week_4_day_7.py | 31 | def test_capstone_cannot_smuggle_in_a_command(tmp_path): | CODE |
| LOW | tests_refsol/test_week_2_day_7.py | 50 | def test_split_k_handles_partial_output_tiles_gpu(): | CODE |
| LOW | tests_refsol/test_week_2_day_7.py | 80 | def test_split_k_request_falls_back_for_larger_prefill_gpu(): | CODE |
| LOW | tests_refsol/test_week_2_day_3.py | 144 | def quantized_matvec_custom_helper(num_rows: int): | CODE |
| LOW | tests_refsol/test_week_3_day_2.py | 46 | def test_chunked_prefill_bounds_work_and_advances_cache(): | CODE |
| LOW | tests_refsol/test_week_2_day_2.py | 25 | def test_single_request_benchmark_releases_cache(monkeypatch): | CODE |
| LOW | tests_refsol/test_week_2_day_2.py | 44 | def test_single_request_benchmark_releases_cache_after_failure(monkeypatch): | CODE |
| LOW | tests_refsol/test_week_2_day_2.py | 60 | def test_single_request_benchmark_selects_serving_prefill_logits(monkeypatch): | CODE |
| LOW | benches/bench_week2_operators.py | 66 | def report_matmul_progression( | CODE |
| LOW | benches/bench.py | 338 | def run_batch_requests_serving( | CODE |
| LOW | benches/test_quantized_matmul.py | 36 | def test_mlx_quantized_matmul(benchmark): | CODE |
| LOW | benches/test_quantized_matmul.py | 50 | def test_refsol_quantized_matmul(benchmark): | CODE |
| LOW | benches/test_quantized_matmul.py | 64 | def test_refsol_quantized_matvec_custom(benchmark): | CODE |
| LOW | src/tiny_llm_ref/attention.py | 6 | def scaled_dot_product_attention_simple( | CODE |
| LOW | src/tiny_llm_ref/attention.py | 30 | def scaled_dot_product_attention_grouped( | CODE |
| LOW | src/tiny_llm_ref/generate.py | 47 | def simple_generate_with_kv_cache( | CODE |
| LOW | src/tiny_llm_ref/week2_kernels.py | 60 | def scaled_dot_product_attention( | CODE |
| LOW | src/tiny_llm/attention.py | 5 | def scaled_dot_product_attention_simple( | CODE |
| LOW | src/tiny_llm/attention.py | 41 | def scaled_dot_product_attention_grouped( | CODE |
| LOW | src/tiny_llm/generate.py | 18 | def simple_generate_with_kv_cache( | CODE |
| LOW | src/tiny_llm/week2_kernels.py | 30 | def scaled_dot_product_attention( | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests_refsol/utils.py | 125 | except Exception as e: | CODE |
| LOW | tests_refsol/utils.py | 136 | except Exception as e: | CODE |
| LOW | tests_refsol/utils.py | 147 | except Exception as e: | CODE |
| MEDIUM | tests_refsol/utils.py | 119 | def qwen3_0_6b_model_exists() -> bool: | CODE |
| MEDIUM | tests_refsol/utils.py | 130 | def qwen3_1_7b_model_exists() -> bool: | CODE |
| MEDIUM | tests_refsol/utils.py | 141 | def qwen3_4b_model_exists() -> bool: | CODE |
| LOW | tests/utils.py | 125 | except Exception as e: | CODE |
| LOW | tests/utils.py | 136 | except Exception as e: | CODE |
| LOW | tests/utils.py | 147 | except Exception as e: | CODE |
| MEDIUM | tests/utils.py | 119 | def qwen3_0_6b_model_exists() -> bool: | CODE |
| MEDIUM | tests/utils.py | 130 | def qwen3_1_7b_model_exists() -> bool: | CODE |
| MEDIUM | tests/utils.py | 141 | def qwen3_4b_model_exists() -> bool: | CODE |
| LOW | benches/utils.py | 125 | except Exception as e: | CODE |
| LOW | benches/utils.py | 136 | except Exception as e: | CODE |
| LOW | benches/utils.py | 147 | except Exception as e: | CODE |
| MEDIUM | benches/utils.py | 119 | def qwen3_0_6b_model_exists() -> bool: | CODE |
| MEDIUM | benches/utils.py | 130 | def qwen3_1_7b_model_exists() -> bool: | CODE |
| MEDIUM | benches/utils.py | 141 | def qwen3_4b_model_exists() -> bool: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | tests_refsol/utils.py | 0 | build a small mlx-shaped qwen3 model for integration tests. | STRING |
| HIGH | tests/utils.py | 0 | build a small mlx-shaped qwen3 model for integration tests. | STRING |
| HIGH | benches/utils.py | 0 | build a small mlx-shaped qwen3 model for integration tests. | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests_refsol/test_week_3_day_1.py | 130 | CODE | |
| LOW | tests_refsol/test_week_1_day_3.py | 7 | CODE | |
| LOW | tests_refsol/test_week_1_day_1.py | 26 | CODE | |
| LOW | tests_refsol/test_week_1_day_1.py | 69 | CODE | |
| LOW | scripts/diff_api.py | 9 | CODE | |
| LOW | benches/bench_serving_progression.py | 229 | CODE | |
| LOW | benches/bench.py | 338 | CODE | |
| LOW | benches/bench.py | 523 | CODE | |
| LOW | benches/bench.py | 364 | CODE | |
| LOW | src/tiny_llm_ref/generate.py | 82 | CODE | |
| LOW | src/tiny_llm_ref/week2_kernels.py | 35 | CODE | |
| LOW | src/tiny_llm_ref/batch.py | 120 | CODE | |
| LOW | src/tiny_llm_ref/positional_encoding.py | 26 | CODE | |
| LOW | src/tiny_llm_ref/agent/workspace.py | 258 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | src/tiny_llm_ref/kv_cache.py | 95 | # Step 1: append each active row into its request cache. This method | COMMENT |
| LOW⚡ | src/tiny_llm_ref/kv_cache.py | 108 | # Step 2: compute seq_len of this batch | COMMENT |
| LOW⚡ | src/tiny_llm_ref/kv_cache.py | 116 | # Step 3: rebuild one dense batch tensor. True paged attention will | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | src/tiny_llm_ref/kv_cache.py | 95 | # Step 1: append each active row into its request cache. This method | COMMENT |
| LOW⚡ | src/tiny_llm_ref/kv_cache.py | 108 | # Step 2: compute seq_len of this batch | COMMENT |
| LOW⚡ | src/tiny_llm_ref/kv_cache.py | 116 | # Step 3: rebuild one dense batch tensor. True paged attention will | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | src/tiny_llm_ref/qwen3_week3.py | 207 | CODE | |
| LOW | src/tiny_llm_ref/qwen3_week2.py | 239 | CODE | |
| LOW | src/tiny_llm_ref/qwen3_week1.py | 149 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | src/tiny_llm_ref/agent/__init__.py | 16 | __all__ = [ | CODE |
| LOW | src/tiny_llm/agent/__init__.py | 16 | __all__ = [ | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | src/extensions/src/axpby.cpp | 1 | // Copyright © 2023-2025 Apple Inc. | COMMENT |