learn LLM inference system on Apple Silicon for systems engineers: build a tiny vLLM + Qwen
This report summarizes scanner evidence for skyzh/tiny-llm, a Python project with 5,495 GitHub stars. SynthScan examined 283,660 lines of code across 310 source files, recording 405 pattern matches distributed across 11 syntactic categories. The legacy adjusted pattern signal is 1.5 (Low pattern signal); it is not an authorship estimate.
Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.
Use each vector to guide manual verification of the underlying findings.
Payload schema: 1.0.0 · Engine: 2.0.0 · Scoring: heuristic-density-v1 · Scan date: 2026-10-31.
Can maintainers explain intent, assumptions, and trade-offs? 183 finding(s).
Are imports declared and package/API names verified? 191 finding(s).
Are wrappers, guards, and repeated structures necessary? 184 finding(s).
Which changes need focused human review? 405 finding(s).
This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.
Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.
This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.
The scanner identified 405 distinct pattern matches across 11 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. 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 configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | week4-capstone.py | 3 | CODE | |
| LOW | agent.py | 3 | CODE | |
| LOW | benchmark_results/task360-week3-projection-e2e.py | 8 | CODE | |
| LOW | benchmark_results/task346-paged-prefill-operator.py | 9 | CODE | |
| LOW | tests_refsol/test_week_3_day_1.py | 17 | CODE | |
| LOW | tests_refsol/test_week_3_day_1.py | 18 | CODE | |
| LOW | tests_refsol/test_week_1_day_6.py | 1 | 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 | 4 | CODE | |
| LOW | tests_refsol/test_week_1_day_3.py | 5 | CODE | |
| LOW | tests_refsol/test_week_1_day_4.py | 5 | CODE | |
| LOW | tests_refsol/test_week_1_day_4.py | 6 | 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_refsol/test_week_3_day_7.py | 3 | CODE | |
| LOW | tests/tiny_llm_base.py | 1 | CODE | |
| LOW | benches/week2_gpudebug.py | 3 | 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/receipts.py | 5 | CODE | |
| LOW | src/tiny_llm_ref/agent/checkpoint.py | 5 | CODE | |
| LOW | src/tiny_llm_ref/agent/protocol.py | 3 | CODE | |
| LOW | src/tiny_llm_ref/agent/evaluation.py | 5 | CODE | |
| LOW | src/tiny_llm_ref/agent/steering.py | 5 | 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 | 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 | 4 | 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 | 11 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 11 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 12 | CODE | |
| LOW | src/tiny_llm_ref/agent/__init__.py | 12 | CODE | |
| 131 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_extension_interface_sync.py | 274 | def _learner_owned_cpp_definitions(source: str) -> set[str]: | CODE |
| LOW⚡ | tests_refsol/test_extension_interface_sync.py | 289 | def _assert_checkpoint_helper_throws(source: str) -> None: | CODE |
| LOW⚡ | tests_refsol/test_extension_interface_sync.py | 297 | def _assert_metal_scaffold_only(source: str) -> None: | CODE |
| LOW⚡ | tests_refsol/test_extension_interface_sync.py | 307 | def _assert_metal_checkpoint_marker(source: str, kernel: str, checkpoint: str) -> None: | CODE |
| LOW | tests_refsol/test_extension_interface_sync.py | 362 | def _functions_in_code_tokens( | CODE |
| LOW | tests_refsol/test_extension_interface_sync.py | 419 | def test_starter_and_reference_publish_the_same_learner_extension_functions(): | CODE |
| LOW | tests_refsol/test_extension_interface_sync.py | 446 | def test_starter_cpp_stubs_are_registered_and_checkpoint_labeled(): | CODE |
| LOW | tests_refsol/test_extension_interface_sync.py | 483 | def test_starter_metal_stubs_name_each_learner_owned_kernel_and_checkpoint(): | CODE |
| LOW | tests_refsol/test_extension_interface_sync.py | 493 | def test_each_extension_task_names_the_exact_starter_functions_to_modify(): | CODE |
| LOW | tests_refsol/test_extension_interface_sync.py | 507 | def test_optional_future_interfaces_do_not_leak_into_earlier_checkpoints(): | CODE |
| LOW | tests_refsol/test_extension_interface_sync.py | 532 | def test_cpp_fail_closed_guard_rejects_a_fake_success_body(): | CODE |
| LOW | tests_refsol/test_extension_interface_sync.py | 544 | def test_built_starter_extension_fails_closed_for_every_public_operation(monkeypatch): | CODE |
| LOW | tests_refsol/test_extension_interface_sync.py | 587 | def test_binding_guard_rejects_a_changed_python_default(): | CODE |
| LOW | tests_refsol/test_extension_interface_sync.py | 649 | def test_metal_guard_rejects_a_leaked_kernel_body(): | CODE |
| LOW | tests_refsol/test_extension_interface_sync.py | 663 | def test_setup_distinguishes_the_runnable_demo_from_future_stubs(): | STRING |
| LOW | tests_refsol/test_week_3_day_1.py | 408 | def make_stage_compatible_request(model, prompt, *, prefill_max_step, prompt_idx): | CODE |
| LOW | tests_refsol/test_week_2_day_1.py | 68 | def test_capacity_cache_exposes_only_the_logical_prefix(): | CODE |
| LOW | tests_refsol/test_week_2_day_1.py | 90 | def test_capacity_rewind_and_overflow_preserve_the_logical_prefix(): | CODE |
| LOW | tests_refsol/test_week_3_day_5.py | 101 | def test_long_prefill_matches_dense_attention_across_paged_boundaries( | CODE |
| LOW | tests_refsol/test_week_3_day_5.py | 115 | def test_batched_gqa_long_prefill_honors_explicit_scale() -> None: | CODE |
| LOW | tests_refsol/test_week_2_day_5.py | 76 | def test_selected_controls_can_be_disabled_independently(disabled): | CODE |
| LOW | tests_refsol/test_week_2_day_5.py | 85 | def test_selected_is_default_and_matches_explicit_checkpoint(): | CODE |
| LOW | tests_refsol/test_week_3_day_4.py | 345 | def test_paged_attention_rejects_invalid_live_metadata_before_dispatch( | CODE |
| LOW | tests_refsol/test_week_3_day_4.py | 371 | def test_paged_attention_rejects_active_context_shorter_than_query( | 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_1.py | 153 | def _assert_exact_observation_payload(run_agent_impl): | CODE |
| LOW | tests_refsol/test_fixture_rng.py | 20 | def test_seeded_fixture_is_repeatable_and_preserves_global_rng(seed, head_dim): | CODE |
| LOW | tests_refsol/test_fixture_rng.py | 33 | def test_seeded_fixture_preserves_global_rng_on_failure(monkeypatch): | CODE |
| LOW | tests_refsol/test_fixture_rng.py | 46 | def test_unseeded_fixture_keeps_global_rng_behavior(): | CODE |
| LOW | tests_refsol/test_fixture_rng.py | 52 | def test_seed_changes_fixture_without_advancing_global_rng(): | CODE |
| LOW | tests_refsol/test_dev_tools.py | 28 | def test_pytest_status_and_output_are_propagated(tmp_path, command, test_directory): | CODE |
| LOW | tests_refsol/test_dev_tools.py | 51 | def test_partial_week_day_selection_fails_closed(tmp_path, command): | CODE |
| LOW | tests_refsol/test_dev_tools.py | 74 | def test_non_positive_week_day_selection_fails_closed(tmp_path, command, selectors): | CODE |
| LOW | tests_refsol/test_dev_tools.py | 89 | def test_copy_test_missing_source_fails_closed(tmp_path): | CODE |
| LOW | tests_refsol/test_dev_tools.py | 117 | def test_copy_test_non_positive_selection_fails_closed(tmp_path, selectors): | CODE |
| LOW | tests_refsol/test_dev_tools.py | 129 | def test_missing_command_fails_closed(tmp_path): | CODE |
| LOW | tests_refsol/test_dense_kv_capacity.py | 17 | def test_capacity_cache_writes_only_new_slices_and_hides_the_tail(): | CODE |
| LOW | tests_refsol/test_dense_kv_capacity.py | 45 | def test_disabled_control_keeps_concatenate_accounting(): | CODE |
| LOW | tests_refsol/test_dense_kv_capacity.py | 64 | def test_capacity_boundary_is_transactional_and_zero_append_is_a_noop(): | CODE |
| LOW | tests_refsol/test_dense_kv_capacity.py | 91 | def test_capacity_rewind_reuses_storage_and_overwrites_the_logical_suffix(): | CODE |
| LOW | tests_refsol/test_dense_kv_capacity.py | 126 | def test_capacity_mode_matches_the_legacy_model_cache(): | CODE |
| LOW | tests_refsol/test_dense_kv_capacity.py | 216 | def test_generation_preserves_a_no_argument_cache_factory(capsys): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 179 | def test_target_prefill_eos_finishes_before_the_draft_runs(): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 221 | def test_draft_prefill_eos_falls_back_to_target_only(): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 241 | def test_mismatch_rewinds_first_middle_and_final_proposal(mismatch_index: int): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 266 | def test_low_acceptance_mismatches_match_the_complete_target_only_output(): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 305 | def test_full_acceptance_stops_on_bonus_eos_without_a_followup_model_call(): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 326 | def test_matching_eos_inside_a_short_proposal_is_terminal(): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 346 | def test_full_acceptance_catches_up_before_the_next_proposal(): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 383 | def test_draft_proposal_stops_early_at_eos_without_terminating_target(): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 410 | def test_repeated_calls_use_fresh_public_detokenizers(): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 442 | def test_incompatible_tokenizers_fail_before_model_execution( | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 461 | def test_tokenizers_without_comparable_vocabularies_fail_before_execution(): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 481 | def test_invalid_proposal_length_fails_before_model_execution(proposal_length): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 501 | def test_invalid_output_budget_fails_before_model_or_tokenizer_execution(max_tokens): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 522 | def test_zero_output_budget_returns_without_model_cache_or_tokenizer_work(): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 543 | def test_target_only_budget_stops_before_eos_without_an_extra_model_call(): | CODE |
| LOW | tests_refsol/test_week_3_day_7.py | 564 | def test_target_only_eos_stops_before_the_output_budget(): | CODE |
| 90 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | agent.py | 140 | except Exception as error: | CODE |
| LOW | tests_refsol/test_week_1_day_3.py | 177 | except Exception: | CODE |
| LOW | tests_refsol/test_week_1_day_3.py | 246 | except Exception: | CODE |
| LOW | tests_refsol/utils.py | 137 | except Exception as e: | CODE |
| LOW | tests_refsol/utils.py | 148 | except Exception as e: | CODE |
| LOW | tests_refsol/utils.py | 159 | except Exception as e: | CODE |
| MEDIUM | tests_refsol/utils.py | 131 | def qwen3_0_6b_model_exists() -> bool: | CODE |
| MEDIUM | tests_refsol/utils.py | 142 | def qwen3_1_7b_model_exists() -> bool: | CODE |
| MEDIUM | tests_refsol/utils.py | 153 | def qwen3_4b_model_exists() -> bool: | CODE |
| LOW | tests/utils.py | 137 | except Exception as e: | CODE |
| LOW | tests/utils.py | 148 | except Exception as e: | CODE |
| LOW | tests/utils.py | 159 | except Exception as e: | CODE |
| MEDIUM | tests/utils.py | 131 | def qwen3_0_6b_model_exists() -> bool: | CODE |
| MEDIUM | tests/utils.py | 142 | def qwen3_1_7b_model_exists() -> bool: | CODE |
| MEDIUM | tests/utils.py | 153 | def qwen3_4b_model_exists() -> bool: | CODE |
| LOW | benches/utils.py | 137 | except Exception as e: | CODE |
| LOW | benches/utils.py | 148 | except Exception as e: | CODE |
| LOW | benches/utils.py | 159 | except Exception as e: | CODE |
| MEDIUM | benches/utils.py | 131 | def qwen3_0_6b_model_exists() -> bool: | CODE |
| MEDIUM | benches/utils.py | 142 | def qwen3_1_7b_model_exists() -> bool: | CODE |
| MEDIUM | benches/utils.py | 153 | def qwen3_4b_model_exists() -> bool: | CODE |
| LOW | src/tiny_llm_ref/kv_cache.py | 201 | except Exception: | CODE |
| LOW | src/tiny_llm_ref/paged_kv_cache.py | 309 | except Exception: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests_refsol/test_extension_interface_sync.py | 246 | CODE | |
| LOW | tests_refsol/test_extension_interface_sync.py | 382 | CODE | |
| LOW | tests_refsol/test_week_3_day_1.py | 191 | CODE | |
| LOW | tests_refsol/test_week_1_day_3.py | 71 | CODE | |
| LOW | tests_refsol/test_week_1_day_1.py | 28 | CODE | |
| LOW | tests_refsol/test_week_1_day_1.py | 82 | CODE | |
| LOW | tests_refsol/test_week_4_starter_sync.py | 91 | CODE | |
| LOW | scripts/diff_api.py | 9 | CODE | |
| LOW | scripts/dev-tools.py | 45 | CODE | |
| LOW | benches/week2_gpudebug.py | 194 | CODE | |
| LOW | benches/bench_week2_operators.py | 745 | CODE | |
| LOW | benches/bench_week2_operators.py | 799 | CODE | |
| LOW | benches/bench_serving_progression.py | 274 | CODE | |
| LOW | benches/bench.py | 368 | CODE | |
| LOW | benches/bench.py | 609 | CODE | |
| LOW | benches/bench.py | 397 | CODE | |
| LOW | benches/bench_chunked_prefill.py | 164 | CODE | |
| LOW | src/tiny_llm_ref/attention.py | 71 | CODE | |
| LOW | src/tiny_llm_ref/generate.py | 130 | CODE | |
| LOW | src/tiny_llm_ref/week2_kernels.py | 46 | CODE | |
| LOW | src/tiny_llm_ref/batch.py | 136 | CODE | |
| LOW | src/tiny_llm_ref/positional_encoding.py | 26 | CODE | |
| LOW | src/tiny_llm_ref/agent/receipts.py | 89 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | tests_refsol/test_week_3_day_1.py | 525 | except ValueError: | CODE |
| HIGH | tests_refsol/test_week_1_day_3.py | 177 | except Exception: | CODE |
| HIGH | tests_refsol/test_week_1_day_3.py | 246 | except Exception: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | tests_refsol/utils.py | 0 | build a tiny model; an explicit seed leaves the global rng untouched. | STRING |
| HIGH | tests/utils.py | 0 | build a tiny model; an explicit seed leaves the global rng untouched. | STRING |
| HIGH | benches/utils.py | 0 | build a tiny model; an explicit seed leaves the global rng untouched. | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | src/tiny_llm_ref/kv_cache.py | 98 | # Step 1: append each active row into its request cache. This method | COMMENT |
| LOW⚡ | src/tiny_llm_ref/kv_cache.py | 111 | # Step 2: compute seq_len of this batch | COMMENT |
| LOW⚡ | src/tiny_llm_ref/kv_cache.py | 119 | # 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 | 98 | # Step 1: append each active row into its request cache. This method | COMMENT |
| LOW⚡ | src/tiny_llm_ref/kv_cache.py | 111 | # Step 2: compute seq_len of this batch | COMMENT |
| LOW⚡ | src/tiny_llm_ref/kv_cache.py | 119 | # 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 | 313 | CODE | |
| LOW | src/tiny_llm_ref/qwen3_week1.py | 149 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | src/tiny_llm_ref/agent/__init__.py | 43 | __all__ = [ | CODE |
| LOW | src/tiny_llm/agent/__init__.py | 43 | __all__ = [ | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | src/extensions/src/axpby.cpp | 1 | // Copyright © 2023-2025 Apple Inc. | COMMENT |