AI Slop Code RIsk Monitor

rasbt/LLMs-from-scratch

Implement a ChatGPT-like LLM in PyTorch from scratch, step by step

9.2 Moderate pattern signal View on GitHub

Maintenance and Governance Review

This report summarizes scanner evidence for rasbt/LLMs-from-scratch, a Jupyter Notebook project with 106,330 GitHub stars. SynthScan examined 58,524 lines of code across 278 source files, recording 363 pattern matches distributed across 14 syntactic categories. The legacy adjusted pattern signal is 9.2 (Moderate 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.

9.2
Adjusted Signal
9.2
Raw Pattern Score
100%
Time Factor
2026-10-02
Last Push
106.3K
Stars
Jupyter Notebook
Language
58.5K
Lines of Code
278
Files
363
Pattern Hits
2026-10-12
Scan Date
0.06
HC Hit Rate

Risk Review · v3

Use each vector to guide manual verification of the underlying findings.

Cognitive Ownership Risk 25.9/100 · MEDIUM

Can maintainers explain intent, assumptions, and trade-offs? 277 finding(s).

Hallucinated Dependency & Supply Chain Risk 2.4/100 · LOW

Are imports declared and package/API names verified? 28 finding(s).

Agent Over-Engineering Ratio 20.5/100 · LOW

Are wrappers, guards, and repeated structures necessary? 165 finding(s).

PR Review Velocity Impact 38.9/100 · MEDIUM

Which changes need focused human review? 363 finding(s).

What These Metrics Mean

Adjusted Signal
Legacy pattern score normalized per 1,000 scanned lines and multiplied by the repository-level time factor. It is not an estimate of AI authorship.
Raw Pattern Score
Sum of severity- and context-weighted pattern findings before applying the time factor.
Time Factor
A coarse multiplier based on repository last-push metadata. It does not identify when individual code was written.
Pattern Hits
Count of configured pattern findings. Review each location and surrounding code before acting.
HC Hit Rate
High- and critical-severity findings per scanned file. Severity is a configured detector weight, not proof of a vulnerability or authorship.
Lines / Files
Scan coverage denominators used by the legacy normalized score.

Pattern-Signal History

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.

Severity Breakdown

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.

CRITICAL 0HIGH 17MEDIUM 64LOW 282

Directory Score Breakdown

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.

Pattern Findings

The scanner identified 363 distinct pattern matches across 14 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.

Self-Referential Comments45 hits · 108 pts
SeverityFileLineSnippetContext
MEDIUMch07/01_main-chapter-code/previous_chapters.py467 # Create a second x-axis for tokens seenCOMMENT
MEDIUMch07/01_main-chapter-code/previous_chapters.py468 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMch07/01_main-chapter-code/exercise_experiments.py291 # Create a second x-axis for tokens seenCOMMENT
MEDIUMch07/01_main-chapter-code/exercise_experiments.py292 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMch07/01_main-chapter-code/ollama_evaluate.py15 # Create the data payload as a dictionaryCOMMENT
MEDIUMch07/01_main-chapter-code/gpt_instruction_finetuning.py135 # Create a second x-axis for tokens seenCOMMENT
MEDIUMch07/01_main-chapter-code/gpt_instruction_finetuning.py136 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMch07/04_preference-tuning-with-dpo/previous_chapters.py468 # Create a second x-axis for tokens seenCOMMENT
MEDIUMch07/04_preference-tuning-with-dpo/previous_chapters.py469 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMch06/01_main-chapter-code/gpt_class_finetune.py230 # Create a second x-axis for tokens seenCOMMENT
MEDIUMch06/01_main-chapter-code/gpt_class_finetune.py231 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMch06/01_main-chapter-code/gpt_download.py111 # Define the block size for reading the fileSTRING
MEDIUMch06/02_bonus_additional-experiments/gpt_download.py111 # Define the block size for reading the fileSTRING
MEDIUM…_bonus_imdb-classification/download_prepare_dataset.py58 # Create a DataFrame for each file and add it to the listCOMMENT
MEDIUMch06/03_bonus_imdb-classification/gpt_download.py111 # Define the block size for reading the fileSTRING
MEDIUM…6/03_bonus_imdb-classification/train_sklearn_logreg.py65 # Create a dummy classifier with the strategy to predict the most frequent classCOMMENT
MEDIUM…nal-aws-sagemaker-notebook/cloudformation-template.yml59 # Create a startup script that will run in the backgroundCOMMENT
MEDIUM…nal-aws-sagemaker-notebook/cloudformation-template.yml104 # Create a flag file to indicate setup is completeCOMMENT
MEDIUMappendix-D/01_main-chapter-code/previous_chapters.py305 # Create a second x-axis for tokens seenCOMMENT
MEDIUMappendix-D/01_main-chapter-code/previous_chapters.py306 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMappendix-E/01_main-chapter-code/previous_chapters.py540 # Create a second x-axis for tokens seenCOMMENT
MEDIUMappendix-E/01_main-chapter-code/previous_chapters.py541 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMappendix-E/01_main-chapter-code/gpt_download.py111 # Define the block size for reading the fileSTRING
MEDIUMch05/16_qwen3.5/qwen3_5_transformers.py97 """This function is intended to align with the l2norm implementation in the FLA library."""STRING
MEDIUMch05/01_main-chapter-code/gpt_train.py122 # Create a second x-axis for tokens seenCOMMENT
MEDIUMch05/01_main-chapter-code/gpt_train.py123 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMch05/01_main-chapter-code/gpt_download.py111 # Define the block size for reading the fileSTRING
MEDIUMch05/01_main-chapter-code/gpt_generate.py77 # Define the block size for reading the fileCOMMENT
MEDIUMch05/07_gpt_to_llama/tests/tests_rope_and_parts.py113 # Create a module to store the imported functions and classesCOMMENT
MEDIUMch05/10_llm-training-speed/01_opt_single_gpu.py361 # Create a second x-axis for tokens seenCOMMENT
MEDIUMch05/10_llm-training-speed/01_opt_single_gpu.py362 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMch05/10_llm-training-speed/00_orig.py397 # Create a second x-axis for tokens seenCOMMENT
MEDIUMch05/10_llm-training-speed/00_orig.py398 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMch05/10_llm-training-speed/02_opt_multi_gpu_ddp.py426 # Create a second x-axis for tokens seenCOMMENT
MEDIUMch05/10_llm-training-speed/02_opt_multi_gpu_ddp.py427 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMch05/05_bonus_hparam_tuning/hparam_search.py18# Define a grid of hyperparameters to search overCOMMENT
MEDIUMch05/18_muon/gpt_train_muon.py166 # Create a second x-axis for tokens seenCOMMENT
MEDIUMch05/18_muon/gpt_train_muon.py167 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMch05/18_muon/gpt_train.py122 # Create a second x-axis for tokens seenCOMMENT
MEDIUMch05/18_muon/gpt_train.py123 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMpkg/llms_from_scratch/ch06.py225 # Create a second x-axis for examples seenCOMMENT
MEDIUMpkg/llms_from_scratch/ch06.py226 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
MEDIUMpkg/llms_from_scratch/ch07.py214 # Create the data payload as a dictionaryCOMMENT
MEDIUMpkg/llms_from_scratch/ch05.py236 # Create a second x-axis for tokens seenCOMMENT
MEDIUMpkg/llms_from_scratch/ch05.py237 ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axisCODE
Hyper-Verbose Identifiers105 hits · 105 pts
SeverityFileLineSnippetContext
LOWch07/01_main-chapter-code/previous_chapters.py338def generate_and_print_sample(model, tokenizer, device, start_context):CODE
LOWch07/01_main-chapter-code/exercise_experiments.py195def custom_collate_with_masking_fn(CODE
LOWch07/02_dataset-utilities/find-near-duplicates.py76def find_print_and_remove_near_duplicates(json_data, remove_duplicates=False, threshold=0.75):CODE
LOWch07/04_preference-tuning-with-dpo/previous_chapters.py339def generate_and_print_sample(model, tokenizer, device, start_context):CODE
LOWch06/01_main-chapter-code/gpt_class_finetune.py26def download_and_unzip_spam_data(url, zip_path, extracted_path, data_file_path):CODE
LOW…_bonus_imdb-classification/download_prepare_dataset.py31def download_and_extract_dataset(dataset_url, target_file, directory):CODE
LOW…_bonus_imdb-classification/download_prepare_dataset.py51def load_dataset_to_dataframe(basepath="aclImdb", labels={"pos": 1, "neg": 0}):CODE
LOWappendix-D/01_main-chapter-code/previous_chapters.py282def generate_and_print_sample(model, tokenizer, device, start_context):CODE
LOWappendix-E/01_main-chapter-code/previous_chapters.py364def download_and_unzip_spam_data(url, zip_path, extracted_path, data_file_path):CODE
LOWch04/06_swa/gpt_with_kv_mha.py253def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/06_swa/tests.py12def test_cached_prefill_matches_uncached_swa():CODE
LOWch04/06_swa/tests.py37def test_swa_matches_base_model_when_window_equals_context():CODE
LOWch04/06_swa/plot_memory_estimates_swa.py57def calc_kv_bytes_total_mha_swa(CODE
LOWch04/06_swa/plot_memory_estimates_swa.py75def calc_kv_bytes_total_gqa_swa(CODE
LOWch04/06_swa/gpt_with_kv_swa.py294def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/07_moe/plot_memory_estimates_moe.py16def calc_moe_active_and_total(CODE
LOWch04/07_moe/plot_memory_estimates_moe.py42def plot_active_params_vs_experts(CODE
LOWch04/07_moe/gpt_with_kv_moe.py339def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/07_moe/memory_estimator_moe.py39def estimate_params_and_hidden(CODE
LOWch04/07_moe/gpt_with_kv_ffn.py279def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/04_gqa/gpt_with_kv_mha.py253def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/04_gqa/gpt_with_kv_gqa.py265def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/04_gqa/plot_memory_estimates_gqa.py23def plot_abs_kv_vs_context_multi_groups():CODE
LOWch04/09_dsa/gpt_with_kv_dsa.py389def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/09_dsa/test_dsa.py16def import_transformers_dsa_model():CODE
LOWch04/09_dsa/test_dsa.py89def test_indexer_matches_transformers_reference():CODE
LOWch04/09_dsa/test_dsa.py163def dense_attention_reference(attn, x):CODE
LOWch04/09_dsa/test_dsa.py181def test_topk_full_equals_dense():CODE
LOWch04/10_kv-sharing/gpt_with_kv_mha.py253def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/10_kv-sharing/gpt_with_kv_sharing.py270def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/10_kv-sharing/tests.py10def test_kv_sharing_matches_mha_when_all_layers_produce_kv():CODE
LOWch04/10_kv-sharing/tests.py55def test_only_producer_layers_store_kv_cache():CODE
LOWch04/10_kv-sharing/tests.py84def test_memory_estimator_counts_cached_layers():CODE
LOW…04/08_deltanet/plot_memory_estimates_gated_deltanet.py27def calc_kv_bytes_total_deltanet_no_conv(batch, emb_dim, n_layers, bytes_per_elem, n_heads):CODE
LOWch04/05_mla/plot_memory_estimates_mla.py33def plot_abs_kv_vs_context_multiple():CODE
LOWch04/05_mla/gpt_with_kv_mla.py261def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/05_mla/gpt_with_kv_mha.py253def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/03_kv-cache/gpt_with_kv_cache.py280def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/03_kv-cache/README.md173def generate_text_simple_cached(model, idx, max_new_tokens,CODE
LOWch04/03_kv-cache/gpt_with_kv_cache_optimized.py306def generate_text_simple_cached(model, idx, max_new_tokens, context_size=None, use_cache=True):CODE
LOWch04/03_kv-cache/tests.py32def test_gpt_model_equivalence_not_cached(ModelClass):CODE
LOWch04/03_kv-cache/tests.py66def test_gpt_model_equivalence_cached(ModelClass):CODE
LOWch04/03_kv-cache/tests.py113def test_context_overflow_bug():CODE
LOWch04/03_kv-cache/tests.py150def test_prefill_chunking_basic():CODE
LOW…-multihead-attention/tests/test_mha_implementations.py66def test_sdpa_without_flash_does_not_attend_to_future_tokens(import_notebook_defs):CODE
LOWch02/05_bpe-from-scratch/tests.py11def import_definitions_from_notebook(fullname, names):CODE
LOWch02/05_bpe-from-scratch/tests.py185def test_no_eot_aliasing_and_disallowed_logic(imported_module, gpt2_files):CODE
LOWch02/05_bpe-from-scratch/tests.py214def test_newline_roundtrip_and_equivalence(imported_module, gpt2_files, text):CODE
LOWch02/05_bpe-from-scratch/tests.py234def test_space_newline_space_patterns(imported_module, gpt2_files):CODE
LOWch02/05_bpe-from-scratch/tests.py250def test_multiple_leading_spaces_roundtrip(imported_module, gpt2_files):CODE
LOWch05/16_qwen3.5/qwen3_5_transformers.py66def apply_mask_to_padding_states(hidden_states, attention_mask):CODE
LOWch05/16_qwen3.5/qwen3_5_transformers.py102def torch_chunk_gated_delta_rule(CODE
LOWch05/16_qwen3.5/qwen3_5_transformers.py182def torch_recurrent_gated_delta_rule(CODE
LOWch05/01_main-chapter-code/gpt_train.py61def generate_and_print_sample(model, tokenizer, device, start_context):CODE
LOWch05/15_tiny-aya/tests/test_tiny_aya_nb.py54def test_dummy_tiny_aya_forward(dummy_cfg_base, dummy_input, import_notebook_defs):CODE
LOWch05/15_tiny-aya/tests/test_tiny_aya_nb.py64def test_tiny_aya_base_equivalence_with_transformers(import_notebook_defs):CODE
LOWch05/15_tiny-aya/tests/test_tiny_aya_kvcache_nb.py55def test_dummy_tiny_aya_forward(dummy_cfg_base, dummy_input, import_notebook_defs):CODE
LOWch05/15_tiny-aya/tests/test_tiny_aya_kvcache_nb.py65def test_tiny_aya_base_equivalence_with_transformers(import_notebook_defs):CODE
LOWch05/07_gpt_to_llama/tests/tests_rope_and_parts.py97 def import_definitions_from_notebook(notebooks):CODE
LOWch05/10_llm-training-speed/01_opt_single_gpu.py255def generate_and_print_sample(model, tokenizer, device, start_context):CODE
45 more matches not shown…
Deep Nesting60 hits · 60 pts
SeverityFileLineSnippetContext
LOWch07/01_main-chapter-code/gpt_download.py48CODE
LOWch07/01_main-chapter-code/gpt_download.py49CODE
LOWch07/02_dataset-utilities/find-near-duplicates.py41CODE
LOWch06/01_main-chapter-code/gpt_download.py47CODE
LOWch06/01_main-chapter-code/gpt_download.py48CODE
LOWch06/02_bonus_additional-experiments/gpt_download.py47CODE
LOWch06/02_bonus_additional-experiments/gpt_download.py48CODE
LOW…bonus_additional-experiments/additional_experiments.py257CODE
LOW…_bonus_imdb-classification/download_prepare_dataset.py31CODE
LOW…_bonus_imdb-classification/download_prepare_dataset.py51CODE
LOWch06/03_bonus_imdb-classification/gpt_download.py47CODE
LOWch06/03_bonus_imdb-classification/gpt_download.py48CODE
LOW…nstalling-python-libraries/python_environment_check.py20CODE
LOWappendix-E/01_main-chapter-code/gpt_download.py47CODE
LOWappendix-E/01_main-chapter-code/gpt_download.py48CODE
LOWch04/06_swa/gpt_with_kv_mha.py253CODE
LOWch04/06_swa/gpt_with_kv_swa.py294CODE
LOWch04/07_moe/gpt_with_kv_moe.py339CODE
LOWch04/07_moe/gpt_with_kv_ffn.py279CODE
LOWch04/04_gqa/gpt_with_kv_mha.py253CODE
LOWch04/04_gqa/gpt_with_kv_gqa.py265CODE
LOWch04/09_dsa/gpt_with_kv_dsa.py389CODE
LOWch04/10_kv-sharing/gpt_with_kv_mha.py253CODE
LOWch04/10_kv-sharing/gpt_with_kv_sharing.py270CODE
LOWch04/05_mla/gpt_with_kv_mla.py261CODE
LOWch04/05_mla/gpt_with_kv_mha.py253CODE
LOWch04/03_kv-cache/gpt_with_kv_cache.py280CODE
LOWch04/03_kv-cache/gpt_with_kv_cache_optimized.py306CODE
LOWch02/02_bonus_bytepair-encoder/bpe_openai_gpt2.py148CODE
LOWch05/16_qwen3.5/tests/qwen3_5_layer_debugger.py248CODE
LOW…3_bonus_pretraining_on_gutenberg/pretraining_simple.py80CODE
LOWch05/12_gemma3/tests/gemma3_layer_debugger.py206CODE
LOWch05/01_main-chapter-code/gpt_download.py48CODE
LOWch05/01_main-chapter-code/gpt_download.py49CODE
LOWch05/01_main-chapter-code/gpt_generate.py62CODE
LOWch05/15_tiny-aya/tests/tiny_aya_layer_debugger.py199CODE
LOWch05/07_gpt_to_llama/tests/tests_rope_and_parts.py96CODE
LOWch05/07_gpt_to_llama/tests/tests_rope_and_parts.py97CODE
LOWch05/13_olmo3/tests/olmo3_layer_debugger.py251CODE
LOW…/17_gemma4/tests/test_e4b/gemma4_e4b_layer_debugger.py258CODE
LOW…/17_gemma4/tests/test_e2b/gemma4_e2b_layer_debugger.py270CODE
LOWch05/10_llm-training-speed/01_opt_single_gpu.py269CODE
LOWch05/10_llm-training-speed/00_orig.py305CODE
LOWch05/10_llm-training-speed/02_opt_multi_gpu_ddp.py314CODE
LOW…qwen3-chat-interface/qwen3-chat-interface-multiturn.py33CODE
LOW…/11_qwen3/qwen3-chat-interface/qwen3-chat-interface.py32CODE
LOW.github/scripts/check_double_quotes.py76CODE
LOWpkg/llms_from_scratch/utils.py17CODE
LOWpkg/llms_from_scratch/utils.py39CODE
LOWpkg/llms_from_scratch/utils.py110CODE
LOWpkg/llms_from_scratch/utils.py153CODE
LOWpkg/llms_from_scratch/qwen3.py653CODE
LOWpkg/llms_from_scratch/ch05.py280CODE
LOWpkg/llms_from_scratch/ch05.py281CODE
LOWpkg/llms_from_scratch/appendix_d.py23CODE
LOWpkg/llms_from_scratch/tests/test_qwen3.py63CODE
LOWpkg/llms_from_scratch/tests/test_qwen3.py630CODE
LOWpkg/llms_from_scratch/tests/test_qwen3.py704CODE
LOWpkg/llms_from_scratch/kv_cache/generate.py13CODE
LOWpkg/llms_from_scratch/kv_cache_batched/generate.py11CODE
Empty Error Handlers9 hits · 45 pts
SeverityFileLineSnippetContext
HIGHch07/01_main-chapter-code/gpt_download.py81except requests.exceptions.RequestException:CODE
HIGHch06/01_main-chapter-code/gpt_download.py80except requests.exceptions.RequestException:CODE
HIGHch06/02_bonus_additional-experiments/gpt_download.py80except requests.exceptions.RequestException:CODE
HIGHch06/03_bonus_imdb-classification/gpt_download.py80except requests.exceptions.RequestException:CODE
HIGHappendix-E/01_main-chapter-code/gpt_download.py80except requests.exceptions.RequestException:CODE
HIGHch05/01_main-chapter-code/gpt_download.py81except requests.exceptions.RequestException:CODE
HIGHch05/17_gemma4/tests/test_gemma4_nb.py77except Exception:CODE
HIGHpkg/llms_from_scratch/ch05.py313except requests.exceptions.RequestException:CODE
HIGHpkg/llms_from_scratch/tests/test_qwen3.py77except Exception:CODE
Cross-File Repetition8 hits · 40 pts
SeverityFileLineSnippetContext
HIGHch06/01_main-chapter-code/gpt_download.py0def download_file(url, destination): # send a get request to download the file in streaming mode response = requests.getSTRING
HIGHch06/02_bonus_additional-experiments/gpt_download.py0def download_file(url, destination): # send a get request to download the file in streaming mode response = requests.getSTRING
HIGHch06/03_bonus_imdb-classification/gpt_download.py0def download_file(url, destination): # send a get request to download the file in streaming mode response = requests.getSTRING
HIGHappendix-E/01_main-chapter-code/gpt_download.py0def download_file(url, destination): # send a get request to download the file in streaming mode response = requests.getSTRING
HIGHch05/01_main-chapter-code/gpt_download.py0def download_file(url, destination): # send a get request to download the file in streaming mode response = requests.getSTRING
HIGHch05/10_llm-training-speed/02_opt_multi_gpu_ddp.py0arguments: rank: a unique process id world_size: total number of processes in the groupSTRING
HIGHappendix-A/01_main-chapter-code/DDP-script.py0arguments: rank: a unique process id world_size: total number of processes in the groupSTRING
HIGHappendix-A/01_main-chapter-code/DDP-script-torchrun.py0arguments: rank: a unique process id world_size: total number of processes in the groupSTRING
Decorative Section Separators10 hits · 39 pts
SeverityFileLineSnippetContext
MEDIUM⚡…qwen3-chat-interface/qwen3-chat-interface-multiturn.py22# ============================================================COMMENT
MEDIUM⚡…qwen3-chat-interface/qwen3-chat-interface-multiturn.py24# ============================================================COMMENT
MEDIUM⚡…qwen3-chat-interface/qwen3-chat-interface-multiturn.py30# ============================================================COMMENT
MEDIUM⚡…/11_qwen3/qwen3-chat-interface/qwen3-chat-interface.py21# ============================================================COMMENT
MEDIUM⚡…/11_qwen3/qwen3-chat-interface/qwen3-chat-interface.py23# ============================================================COMMENT
MEDIUM⚡…/11_qwen3/qwen3-chat-interface/qwen3-chat-interface.py29# ============================================================COMMENT
MEDIUMpkg/llms_from_scratch/llama3.py208# ==============================================================================COMMENT
MEDIUMpkg/llms_from_scratch/llama3.py257# ==============================================================================COMMENT
MEDIUMpkg/llms_from_scratch/qwen3.py332# ==============================================================================COMMENT
MEDIUMpkg/llms_from_scratch/qwen3.py381# ==============================================================================COMMENT
Excessive Try-Catch Wrapping31 hits · 38 pts
SeverityFileLineSnippetContext
LOWch07/01_main-chapter-code/gpt_download.py91 except Exception as e:CODE
LOWch06/01_main-chapter-code/gpt_download.py91 except Exception as e:CODE
LOWch06/02_bonus_additional-experiments/gpt_download.py91 except Exception as e:CODE
LOWch06/03_bonus_imdb-classification/gpt_download.py91 except Exception as e:CODE
LOW…nstalling-python-libraries/python_environment_check.py90 except Exception as e:CODE
LOWappendix-E/01_main-chapter-code/gpt_download.py91 except Exception as e:CODE
LOWch04/06_swa/plot_memory_estimates_swa.py38 except Exception:CODE
LOWch04/06_swa/memory_estimator_swa.py37 except Exception:CODE
LOWch05/16_qwen3.5/tests/qwen3_5_layer_debugger.py20 except Exception:CODE
LOWch05/16_qwen3.5/tests/qwen3_5_layer_debugger.py39except Exception:CODE
MEDIUMch05/16_qwen3.5/tests/qwen3_5_layer_debugger.py14def _import_qwen3_5_classes():CODE
LOWch05/16_qwen3.5/tests/test_qwen3_5_nb.py22 except Exception:CODE
LOWch05/16_qwen3.5/tests/test_qwen3_5_nb.py43 except Exception:CODE
MEDIUMch05/16_qwen3.5/tests/test_qwen3_5_nb.py16def _import_qwen3_5_classes():CODE
LOWch05/01_main-chapter-code/gpt_download.py91 except Exception as e:CODE
LOWch05/17_gemma4/tests/test_gemma4_nb.py77 except Exception:CODE
MEDIUMch05/17_gemma4/tests/test_gemma4_nb.py71def gemma4_transformers_module():CODE
LOW…/17_gemma4/tests/test_e4b/gemma4_e4b_layer_debugger.py20 except Exception:CODE
LOW…/17_gemma4/tests/test_e4b/gemma4_e4b_layer_debugger.py42except Exception:CODE
MEDIUM…/17_gemma4/tests/test_e4b/gemma4_e4b_layer_debugger.py15def _import_gemma4_classes():CODE
LOW…/17_gemma4/tests/test_e2b/gemma4_e2b_layer_debugger.py20 except Exception:CODE
LOW…/17_gemma4/tests/test_e2b/gemma4_e2b_layer_debugger.py42except Exception:CODE
MEDIUM…/17_gemma4/tests/test_e2b/gemma4_e2b_layer_debugger.py15def _import_gemma4_classes():CODE
LOW.github/scripts/check_double_quotes.py111 except Exception as e:CODE
MEDIUM.github/scripts/check_double_quotes.py104def check_file(path):CODE
LOW.github/ISSUE_TEMPLATE/bug-report.yaml83 except Exception:CODE
MEDIUM.github/ISSUE_TEMPLATE/bug-report.yaml63def machine_model():CODE
LOWpkg/llms_from_scratch/utils.py171 except Exception as e:CODE
LOWpkg/llms_from_scratch/ch05.py323 except Exception as e:CODE
LOWpkg/llms_from_scratch/tests/test_qwen3.py77 except Exception:CODE
LOWpkg/llms_from_scratch/tests/test_qwen3.py654 except Exception:CODE
Redundant / Tautological Comments28 hits · 30 pts
SeverityFileLineSnippetContext
LOWch07/01_main-chapter-code/previous_chapters.py301 model.train() # Set model to training modeCODE
LOWch07/01_main-chapter-code/gpt_download.py55 # Check if file exists and has same sizeCOMMENT
LOWch07/04_preference-tuning-with-dpo/previous_chapters.py302 model.train() # Set model to training modeCODE
LOWch06/01_main-chapter-code/gpt_class_finetune.py190 model.train() # Set model to training modeCODE
LOWch06/01_main-chapter-code/gpt_download.py54 # Check if file exists and has same sizeCOMMENT
LOWch06/01_main-chapter-code/gpt_download.py104 # Check if file exists and has the same sizeSTRING
LOWch06/02_bonus_additional-experiments/gpt_download.py54 # Check if file exists and has same sizeCOMMENT
LOWch06/02_bonus_additional-experiments/gpt_download.py104 # Check if file exists and has the same sizeSTRING
LOW…bonus_additional-experiments/additional_experiments.py338 model.train() # Set model to training modeCODE
LOWch06/03_bonus_imdb-classification/train_bert_hf_spam.py237 model.train() # Set model to training modeCODE
LOWch06/03_bonus_imdb-classification/train_gpt.py184 model.train() # Set model to training modeCODE
LOWch06/03_bonus_imdb-classification/gpt_download.py54 # Check if file exists and has same sizeCOMMENT
LOWch06/03_bonus_imdb-classification/gpt_download.py104 # Check if file exists and has the same sizeSTRING
LOWch06/03_bonus_imdb-classification/train_gpt_muon.py219 model.train() # Set model to training modeCODE
LOWch06/03_bonus_imdb-classification/train_bert_hf.py140 model.train() # Set model to training modeCODE
LOW…nal-aws-sagemaker-notebook/cloudformation-template.yml119 # Check if setup is still running or not startedCOMMENT
LOWappendix-E/01_main-chapter-code/previous_chapters.py500 model.train() # Set model to training modeCODE
LOWappendix-E/01_main-chapter-code/gpt_download.py54 # Check if file exists and has same sizeCOMMENT
LOWappendix-E/01_main-chapter-code/gpt_download.py104 # Check if file exists and has the same sizeSTRING
LOWch05/01_main-chapter-code/gpt_train.py84 model.train() # Set model to training modeCODE
LOWch05/01_main-chapter-code/gpt_download.py55 # Check if file exists and has same sizeCOMMENT
LOWch05/01_main-chapter-code/gpt_download.py104 # Check if file exists and has the same sizeSTRING
LOWch05/01_main-chapter-code/gpt_generate.py70 # Check if file exists and has the same sizeCOMMENT
LOWch05/18_muon/gpt_train_muon.py120 model.train() # Set model to training modeCODE
LOWch05/18_muon/gpt_train.py84 model.train() # Set model to training modeCODE
LOWpkg/llms_from_scratch/ch06.py185 model.train() # Set model to training modeCODE
LOWpkg/llms_from_scratch/ch05.py70 model.train() # Set model to training modeCODE
LOWpkg/llms_from_scratch/ch05.py287 # Check if file exists and has same sizeCOMMENT
Unused Imports28 hits · 28 pts
SeverityFileLineSnippetContext
LOW.github/scripts/test_check_links.py3CODE
LOW.github/scripts/check_links.py14CODE
LOWpkg/llms_from_scratch/kv_cache/gpt2.py6CODE
LOWpkg/llms_from_scratch/kv_cache/generate.py8CODE
LOWpkg/llms_from_scratch/kv_cache/llama3.py6CODE
LOWpkg/llms_from_scratch/kv_cache/qwen3.py6CODE
LOWpkg/llms_from_scratch/kv_cache/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache_batched/generate.py6CODE
LOWpkg/llms_from_scratch/kv_cache_batched/qwen3.py6CODE
LOWpkg/llms_from_scratch/kv_cache_batched/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache_batched/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache_batched/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache_batched/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache_batched/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache_batched/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache_batched/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache_batched/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache_batched/qwen3.py7CODE
LOWpkg/llms_from_scratch/kv_cache_batched/qwen3.py7CODE
Over-Commented Block24 hits · 24 pts
SeverityFileLineSnippetContext
LOWch06/01_main-chapter-code/previous_chapters.py1# Copyright (c) Sebastian Raschka under Apache License 2.0 (see LICENSE.txt).COMMENT
LOW…6/02_bonus_additional-experiments/previous_chapters.py1# Copyright (c) Sebastian Raschka under Apache License 2.0 (see LICENSE.txt).COMMENT
LOWch06/03_bonus_imdb-classification/previous_chapters.py1# Copyright (c) Sebastian Raschka under Apache License 2.0 (see LICENSE.txt).COMMENT
LOWch04/07_moe/gpt_with_kv_ffn.py141 torch.sqrt(torch.tensor(2.0 / torch.pi)) *COMMENT
LOWch04/09_dsa/gpt_with_kv_dsa.py1# Copyright (c) Sebastian Raschka under Apache License 2.0 (see LICENSE.txt).COMMENT
LOWch04/09_dsa/gpt_with_kv_dsa.py21COMMENT
LOWch04/05_mla/gpt_with_kv_mla.py1# Copyright (c) Sebastian Raschka under Apache License 2.0 (see LICENSE.txt).COMMENT
LOWch02/02_bonus_bytepair-encoder/bpe_openai_gpt2.py1# Source: https://github.com/openai/gpt-2/blob/master/src/encoder.pyCOMMENT
LOWch05/01_main-chapter-code/previous_chapters.py1# Copyright (c) Sebastian Raschka under Apache License 2.0 (see LICENSE.txt).COMMENT
LOWch05/07_gpt_to_llama/previous_chapters.py1# Copyright (c) Sebastian Raschka under Apache License 2.0 (see LICENSE.txt).COMMENT
LOWch05/10_llm-training-speed/01_opt_single_gpu.py501 epochs_tensor = torch.linspace(0, OTHER_SETTINGS["num_epochs"], len(train_losses))COMMENT
LOWch05/10_llm-training-speed/00_orig.py521 ###########################COMMENT
LOWch05/10_llm-training-speed/02_opt_multi_gpu_ddp.py601 # Save and load modelCOMMENT
LOWch05/18_muon/previous_chapters.py1# Copyright (c) Sebastian Raschka under Apache License 2.0 (see LICENSE.txt).COMMENT
LOW.github/scripts/check_links.py1#!/usr/bin/env -S uv run --scriptCOMMENT
LOWpkg/llms_from_scratch/ch07.py41# if not os.path.exists(file_path):COMMENT
LOWpkg/llms_from_scratch/__init__.py1# Copyright (c) Sebastian Raschka under Apache License 2.0 (see LICENSE.txt).COMMENT
LOWpkg/llms_from_scratch/llama3.py201 # Combine heads, where self.d_out = self.num_heads * self.head_dimCOMMENT
LOWpkg/llms_from_scratch/llama3.py221# │ │ │ │ │ │ │ │COMMENT
LOWpkg/llms_from_scratch/llama3.py241# [ x0 x1 x2 x3 x4 x5 x6 x7 ]COMMENT
LOWpkg/llms_from_scratch/qwen3.py341#COMMENT
LOWpkg/llms_from_scratch/qwen3.py361# 2) Interleaved (even/odd) style (original paper, Llama repo):COMMENT
LOWpkg/llms_from_scratch/kv_cache/__init__.py1# Copyright (c) Sebastian Raschka under Apache License 2.0 (see LICENSE.txt).COMMENT
LOWpkg/llms_from_scratch/kv_cache_batched/__init__.py1# Copyright (c) Sebastian Raschka under Apache License 2.0 (see LICENSE.txt).COMMENT
Structural Annotation Overuse11 hits · 16 pts
SeverityFileLineSnippetContext
LOWch07/06_user_interface/README.md16## Step 1: Install dependenciesCOMMENT
LOWch07/06_user_interface/README.md27## Step 2: Run `app` codeCOMMENT
LOWch06/03_bonus_imdb-classification/README.md29## Step 1: Install DependenciesCOMMENT
LOWch06/03_bonus_imdb-classification/README.md38## Step 2: Download DatasetCOMMENT
LOWch06/03_bonus_imdb-classification/README.md50## Step 3: Run ModelsCOMMENT
LOWch06/04_user_interface/README.md16## Step 1: Install dependenciesCOMMENT
LOWch06/04_user_interface/README.md27## Step 2: Run `app` codeCOMMENT
LOWch05/06_user_interface/README.md16## Step 1: Install dependenciesCOMMENT
LOWch05/06_user_interface/README.md27## Step 2: Run `app` codeCOMMENT
LOWch05/11_qwen3/qwen3-chat-interface/README.md16## Step 1: Install dependenciesCOMMENT
LOWch05/11_qwen3/qwen3-chat-interface/README.md34## Step 2: Run `app` codeCOMMENT
AI Slop Vocabulary1 hit · 3 pts
SeverityFileLineSnippetContext
MEDIUMpkg/llms_from_scratch/ch07.py33# The `requests` version above is more robustCOMMENT
Slop Phrases1 hit · 2 pts
SeverityFileLineSnippetContext
MEDIUM…-tuning-with-dpo/instruction-data-with-preference.json3520 "chosen": "It's worth noting that the most popular vegetable in the world is actually the potato.",CODE
AI Structural Patterns2 hits · 2 pts
SeverityFileLineSnippetContext
LOWch05/16_qwen3.5/qwen3_5_transformers.py93CODE
LOWch05/16_qwen3.5/qwen3_5_transformers.py411CODE