AI Slop Code RIsk Monitor

datawhalechina/happy-llm

📚 从零开始构建大模型

5.6 Moderate pattern signal View on GitHub

Maintenance and Governance Review

This report summarizes scanner evidence for datawhalechina/happy-llm, a Jupyter Notebook project with 34,280 GitHub stars. SynthScan examined 44,018 lines of code across 97 source files, recording 185 pattern matches distributed across 12 syntactic categories. The legacy adjusted pattern signal is 5.6 (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.

5.6
Adjusted Signal
5.6
Raw Pattern Score
100%
Time Factor
2026-08-08
Last Push
34.3K
Stars
Jupyter Notebook
Language
44.0K
Lines of Code
97
Files
185
Pattern Hits
2026-10-12
Scan Date
0.08
HC Hit Rate

Risk Review · v3

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

Cognitive Ownership Risk 13.1/100 · LOW

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

Hallucinated Dependency & Supply Chain Risk 10.2/100 · LOW

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

Agent Over-Engineering Ratio 6.0/100 · LOW

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

PR Review Velocity Impact 27.0/100 · MEDIUM

Which changes need focused human review? 185 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 8MEDIUM 26LOW 151

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

Unused Imports77 hits · 77 pts
SeverityFileLineSnippetContext
LOWdocs/chapter8/opd/02-demo-async.py17CODE
LOWdocs/chapter8/opd/01-demo-sync.py17CODE
LOWdocs/chapter8/search-r1/analyse.py11CODE
LOWdocs/chapter8/retool/analysis.py12CODE
LOWdocs/chapter8/retool/sandbox.py43CODE
LOWdocs/chapter8/retool/eval.py24CODE
LOWdocs/chapter6/code/download_dataset.py2CODE
LOWdocs/chapter6/code/download_dataset.py3CODE
LOWdocs/chapter6/code/pretrain.py6CODE
LOWdocs/chapter6/code/pretrain.py12CODE
LOWdocs/chapter6/code/pretrain.py16CODE
LOWdocs/chapter6/code/pretrain.py17CODE
LOWdocs/chapter6/code/pretrain.py30CODE
LOWdocs/chapter6/code/pretrain.py31CODE
LOWdocs/chapter6/code/finetune.py6CODE
LOWdocs/chapter6/code/finetune.py11CODE
LOWdocs/chapter6/code/finetune.py12CODE
LOWdocs/chapter6/code/finetune.py13CODE
LOWdocs/chapter6/code/finetune.py19CODE
LOWdocs/chapter6/code/finetune.py21CODE
LOWdocs/chapter6/code/finetune.py23CODE
LOWdocs/chapter6/code/finetune.py23CODE
LOWdocs/chapter6/code/finetune.py33CODE
LOWdocs/chapter6/code/finetune.py34CODE
LOWdocs/chapter7/Agent/demo.py2CODE
LOWdocs/chapter7/Agent/demo.py2CODE
LOWdocs/chapter7/Agent/demo.py2CODE
LOWdocs/chapter7/Agent/web_demo.py3CODE
LOWdocs/chapter7/Agent/web_demo.py3CODE
LOWdocs/chapter7/Agent/web_demo.py3CODE
LOWdocs/chapter7/Agent/src/core.py5CODE
LOWdocs/chapter7/Agent/src/core.py5CODE
LOWdocs/chapter7/Agent/src/core.py5CODE
LOWdocs/chapter7/Agent/src/core.py5CODE
LOWdocs/chapter7/Agent/src/core.py5CODE
LOWdocs/chapter7/Agent/src/core.py5CODE
LOWdocs/chapter7/Agent/src/core.py7CODE
LOWdocs/chapter7/Agent/src/utils.py2CODE
LOWdocs/chapter7/Agent/src/utils.py3CODE
LOWdocs/chapter7/RAG/VectorBase.py12CODE
LOWdocs/chapter7/RAG/VectorBase.py12CODE
LOWdocs/chapter7/RAG/VectorBase.py12CODE
LOWdocs/chapter7/RAG/VectorBase.py12CODE
LOWdocs/chapter7/RAG/VectorBase.py14CODE
LOWdocs/chapter7/RAG/LLM.py11CODE
LOWdocs/chapter7/RAG/LLM.py11CODE
LOWdocs/chapter7/RAG/LLM.py11CODE
LOWdocs/chapter7/RAG/LLM.py11CODE
LOWdocs/chapter7/RAG/Embeddings.py12CODE
LOWdocs/chapter7/RAG/Embeddings.py13CODE
LOWdocs/chapter7/RAG/Embeddings.py13CODE
LOWdocs/chapter7/RAG/Embeddings.py13CODE
LOWdocs/chapter7/RAG/Embeddings.py13CODE
LOWdocs/chapter7/RAG/utils.py12CODE
LOWdocs/chapter7/RAG/utils.py12CODE
LOWdocs/chapter7/RAG/utils.py12CODE
LOWdocs/chapter7/RAG/utils.py12CODE
LOWdocs/chapter7/RAG/utils.py12CODE
LOWdocs/chapter7/RAG/utils.py17CODE
LOWdocs/chapter5/code/ddp_pretrain.py3CODE
17 more matches not shown…
Modern AI Meta-Vocabulary19 hits · 44 pts
SeverityFileLineSnippetContext
MEDIUMREADME.md66> 第八章聚焦 GRPO、OPD、Search-R1 与 ReTool。更多 Agentic RL 算法、训练代码与实验实践,可以前往作者持续维护的另一个仓库 [agentic-rl-lab](https://github.com/KMnOCODE
MEDIUMREADME_en.md58> Chapter 8 focuses on GRPO, OPD, Search-R1, and ReTool. For more Agentic RL algorithms, training code, and hands-on expCODE
MEDIUMdocs/学习与环境准备.md96正文重点讲解 GRPO 与 OPD 的同步版,异步版保留相同算法和数据对齐方式;Search-R1 与 ReTool 按数据、协议、环境、rollout、训练和评测拆成多文件工程。想继续学习更多 Agentic RL 算法与实验,可以阅读作CODE
MEDIUMdocs/chapter8/第八章 大模型强化学习.md40> **扩展阅读:** 如果你希望继续了解更多 Agentic RL 算法与可运行实践,可以阅读作者维护的另一个开源项目 [agentic-rl-lab](https://github.com/KMnO4-zx/agentic-rl-labCODE
MEDIUMdocs/chapter8/第八章 大模型强化学习.md46> **代码来源:** 本节依据作者开源仓库 [agentic-rl-lab/01-grpo](https://github.com/KMnO4-zx/agentic-rl-lab/tree/main/01-grpo) 中的 `01-demCODE
MEDIUMdocs/chapter8/第八章 大模型强化学习.md539> **代码来源:** 本节依据作者开源仓库 [agentic-rl-lab/02-opd/general-opd](https://github.com/KMnO4-zx/agentic-rl-lab/tree/main/02-opd/gCODE
MEDIUMdocs/chapter8/第八章 大模型强化学习.md1063> **代码来源:** 本节依据作者开源仓库 [agentic-rl-lab/03-search-r1](https://github.com/KMnO4-zx/agentic-rl-lab/tree/main/03-search-r1) CODE
MEDIUMdocs/chapter8/第八章 大模型强化学习.md2242> **代码来源:** 本节依据作者开源仓库 [agentic-rl-lab/05-retool](https://github.com/KMnO4-zx/agentic-rl-lab/tree/main/05-retool) 中的完整多文CODE
MEDIUMdocs/chapter8/第八章 大模型强化学习.md3152> **继续学习:** 受篇幅和章节定位限制,本章集中介绍了 GRPO、OPD、Search-R1 与 ReTool,仍有许多 Agentic RL 方法和交互环境无法逐一展开。如果你希望继续学习 OPSD、DAPO、GSPO、ALFWorCODE
MEDIUMdocs/chapter8/第八章 大模型强化学习.md316510. Agentic-RL Lab (不要葱姜蒜). [agentic-rl-lab](https://github.com/KMnO4-zx/agentic-rl-lab).CODE
MEDIUMdocs/chapter8/opd/README.md3> **代码来源:** 本目录代码引用并整理自本章作者维护的 [agentic-rl-lab](https://github.com/KMnO4-zx/agentic-rl-lab) 中的 [02-opd](https://github.cCODE
MEDIUMdocs/chapter8/search-r1/README.md3> **代码来源:** 本目录代码引用并整理自本章作者维护的 [agentic-rl-lab](https://github.com/KMnO4-zx/agentic-rl-lab) 中的 [03-search-r1](https://giCODE
MEDIUMdocs/chapter8/search-r1/search.py28 "(https://github.com/KMnO4-zx/agentic-rl-lab)"CODE
MEDIUMdocs/chapter8/grpo/README.md3> **代码来源:** 本目录代码引用并整理自本章作者维护的 [agentic-rl-lab](https://github.com/KMnO4-zx/agentic-rl-lab) 中的 [01-grpo](https://github.CODE
MEDIUMdocs/chapter8/retool/README.md3> **代码来源:** 本目录代码引用并整理自本章作者维护的 [agentic-rl-lab](https://github.com/KMnO4-zx/agentic-rl-lab) 中的 [05-retool](https://githuCODE
MEDIUM⚡docs/chapter7/第七章 大模型应用.md93## 7.2 RAGCOMMENT
MEDIUM⚡docs/chapter7/第七章 大模型应用.md95### 7.2.1 RAG 的基本原理COMMENT
MEDIUM⚡docs/chapter7/第七章 大模型应用.md103### 7.2.2 搭建一个 RAG 框架COMMENT
MEDIUMdocs/chapter7/第七章 大模型应用.md440#### Step 6: Tiny-RAG DemoSTRING
Structural Annotation Overuse19 hits · 26 pts
SeverityFileLineSnippetContext
LOW⚡docs/chapter7/第七章 大模型应用.md107#### Step 1: RAG流程介绍COMMENT
LOWdocs/chapter7/第七章 大模型应用.md139#### Step 2: 文档加载和切分COMMENT
LOWdocs/chapter7/第七章 大模型应用.md237#### Step 3: 向量化COMMENT
LOWdocs/chapter7/第七章 大模型应用.md337#### Step 4: 数据库与向量检索COMMENT
LOWdocs/chapter7/第七章 大模型应用.md381#### Step 5: 大模型模块COMMENT
LOWdocs/chapter7/第七章 大模型应用.md440#### Step 6: Tiny-RAG DemoSTRING
LOW⚡docs/chapter7/第七章 大模型应用.md546#### Step 1 : 初始化客户端和模型STRING
LOW⚡docs/chapter7/第七章 大模型应用.md565#### Step 2: 定义工具函数STRING
LOWdocs/chapter7/第七章 大模型应用.md640#### Step 3: 构造 Agent 类STRING
LOWdocs/chapter7/第七章 大模型应用.md738#### Step 4: 运行 AgentSTRING
LOWdocs/chapter5/第五章 动手搭建大模型.md748#### Step 1: 安装和导入依赖库COMMENT
LOWdocs/chapter5/第五章 动手搭建大模型.md774#### Step 2: 加载训练数据COMMENT
LOWdocs/chapter5/第五章 动手搭建大模型.md798#### Step 3: 创建配置文件COMMENT
LOWdocs/chapter5/第五章 动手搭建大模型.md848#### Step 4: 训练 BPE TokenizerCOMMENT
LOW⚡docs/chapter5/第五章 动手搭建大模型.md908#### Step 5: 使用训练好的 TokenizerCOMMENT
LOW…r/s1-vllm-thinking-budget/output/output_1754208752.txt1969### Step 1: Understanding the Critical PointsCOMMENT
LOW…r/s1-vllm-thinking-budget/output/output_1754208752.txt1995### Step 2: Behavior of the PolynomialCOMMENT
LOW…r/s1-vllm-thinking-budget/output/output_1754208752.txt2009### Step 3: Symmetry and RootsCOMMENT
LOW…r/s1-vllm-thinking-budget/output/output_1754208752.txt2029### Step 4: Final CalculationCOMMENT
Excessive Try-Catch Wrapping14 hits · 22 pts
SeverityFileLineSnippetContext
LOWdocs/chapter8/第八章 大模型强化学习.md2543 except Exception:CODE
LOWdocs/chapter8/retool/reward.py48 except Exception: # math_verify 对怪异输入可能抛异常,一律按不等价处理CODE
MEDIUMdocs/chapter5/第五章 动手搭建大模型.md791 print(f"Error decoding JSON in line {line_num}")CODE
LOW⚡docs/chapter5/第五章 动手搭建大模型.md917 except Exception as e:CODE
MEDIUM⚡docs/chapter5/第五章 动手搭建大模型.md918 print(f"Error loading tokenizer: {e}")CODE
MEDIUMdocs/chapter5/第五章 动手搭建大模型.md1099 print(f"Error decoding JSON in line {line_num}")CODE
LOWdocs/chapter5/第五章 动手搭建大模型.md1204 except Exception as e:CODE
MEDIUMdocs/chapter5/第五章 动手搭建大模型.md1205 print(f"Error loading tokenizer: {e}")CODE
MEDIUMdocs/chapter5/code/train_tokenizer.py27 print(f"Error decoding JSON in line {line_num}")CODE
LOWdocs/chapter5/code/train_tokenizer.py132 except Exception as e:CODE
MEDIUMdocs/chapter5/code/train_tokenizer.py133 print(f"Error loading tokenizer: {e}")CODE
LOWExtra-Chapter/CDDRS/readme.md160 except Exception as e:CODE
MEDIUMExtra-Chapter/CDDRS/readme.md161 print(f"Error reading {file_path}: {e}")CODE
LOWExtra-Chapter/generation-method/llm_generation.py149 except Exception as e:CODE
Deep Nesting18 hits · 18 pts
SeverityFileLineSnippetContext
LOWdocs/chapter8/opd/01-demo-sync.py256CODE
LOWdocs/chapter8/search-r1/rollout.py320CODE
LOWdocs/chapter8/search-r1/train.py484CODE
LOWdocs/chapter8/search-r1/search.py137CODE
LOWdocs/chapter8/search-r1/search.py230CODE
LOWdocs/chapter8/search-r1/search.py424CODE
LOWdocs/chapter8/search-r1/eval.py222CODE
LOWdocs/chapter8/grpo/02-demo-async.py434CODE
LOWdocs/chapter8/grpo/01-demo-sync.py386CODE
LOWdocs/chapter8/retool/rollout.py346CODE
LOWdocs/chapter8/retool/train.py457CODE
LOWdocs/chapter8/retool/eval.py141CODE
LOWdocs/chapter8/retool/reward.py26CODE
LOWdocs/chapter6/code/finetune.py87CODE
LOWdocs/chapter7/RAG/utils.py34CODE
LOWdocs/chapter7/RAG/utils.py61CODE
LOWdocs/chapter5/code/dataset.py65CODE
LOWdocs/chapter5/code/train_tokenizer.py17CODE
Magic Placeholder Names5 hits · 18 pts
SeverityFileLineSnippetContext
HIGH⚡docs/chapter7/第七章 大模型应用.md555 api_key="YOUR_API_KEY", # 替换为你的 API KeySTRING
HIGH⚡docs/chapter7/第七章 大模型应用.md563> **注意:** 你需要将 `YOUR_API_KEY` 替换为你从 [SiliconFlow](https://cloud.siliconflow.cn/i/ybUFvmqK) 或其他服务商获取的有效 API Key。STRING
HIGHdocs/chapter7/第七章 大模型应用.md746 api_key="YOUR_API_KEY", # 替换为你的 API KeySTRING
HIGHExtra-Chapter/CDDRS/readme.md80 api_key="your-api-key-here",CODE
HIGHExtra-Chapter/CDDRS/readme.md786 api_key='your-api-key',STRING
Hyper-Verbose Identifiers17 hits · 16 pts
SeverityFileLineSnippetContext
LOWdocs/chapter8/第八章 大模型强化学习.md612def completion_teacher_logprobs(CODE
LOWdocs/chapter8/第八章 大模型强化学习.md779def completion_teacher_logprobs(CODE
LOWdocs/chapter8/opd/02-demo-async.py194async def completion_teacher_logprobs_async(CODE
LOWdocs/chapter8/opd/01-demo-sync.py182def completion_teacher_logprobs(teacher_client, prompt_ids: list[int], completion_ids: list[int]):CODE
LOWdocs/chapter8/search-r1/train.py165def weight_micro_batch_for_global_mean(CODE
LOWdocs/chapter8/search-r1/search.py563def resolve_search_concurrency(backend: str, value: int | None) -> int:CODE
LOWdocs/chapter8/retool/train.py164def weight_micro_batch_for_global_mean(CODE
LOWdocs/chapter8/retool/eval.py193async def evaluate_problem_text_only(CODE
LOWdocs/chapter5/code/k_model.py378 def _left_pad_by_attention_mask(CODE
LOWExtra-Chapter/CDDRS/readme.md246 def _compute_semantic_discrepancy(self, embeddings: np.ndarray) -> List[float]:CODE
LOWExtra-Chapter/CDDRS/readme.md283 def _enforce_length_constraints(self, chunks: List[str]) -> List[str]:CODE
LOWExtra-Chapter/CDDRS/readme.md423def compute_document_length_factor(chunk_length: int, avg_length: int = 100) -> float:STRING
LOWExtra-Chapter/CDDRS/readme.md437def compute_term_significance(term_freq: int, doc_length_factor: float) -> float:STRING
LOWExtra-Chapter/CDDRS/readme.md559 def _compute_knowledge_scores(self, key_info: Dict[str, Tuple[str, float]]) -> List[float]:STRING
LOWExtra-Chapter/text-data-processing/readme.md932def test_simple_bpe_tokenizer():CODE
LOWExtra-Chapter/s1-vllm-thinking-budget/s1.py28def run_thinking_budget_sample(llm_model, tokenizer, user_input, thinking_budget):CODE
LOWExtra-Chapter/s1-vllm-thinking-budget/readme.md41def run_thinking_budget_sample(llm_model, tokenizer, user_input, thinking_budget):CODE
Docstring Block Structure2 hits · 10 pts
SeverityFileLineSnippetContext
HIGHdocs/chapter7/第七章 大模型应用.md259 获取文本的嵌入向量表示 Args: text (str): 输入文本 model (str): 使用的模型名称 Returns: STRING
HIGHdocs/chapter7/RAG/Embeddings.py36 获取文本的嵌入向量表示 Args: text (str): 输入文本 model (str): 使用的模型名称 Returns: STRING
AI Structural Patterns8 hits · 8 pts
SeverityFileLineSnippetContext
LOWdocs/chapter6/code/pretrain.py180CODE
LOWdocs/chapter5/code/k_model.py16CODE
LOWdocs/chapter5/code/k_model.py248CODE
LOWdocs/chapter5/code/k_model.py307CODE
LOWdocs/chapter5/code/k_model.py677CODE
LOWdocs/chapter2/code/transformer.py98CODE
LOWdocs/chapter2/code/transformer.py151CODE
LOWdocs/chapter2/code/transformer.py192CODE
Empty Error Handlers1 hit · 5 pts
SeverityFileLineSnippetContext
HIGHdocs/chapter7/Agent/src/tools.py74except (CODE
Modern Structural Boilerplate3 hits · 3 pts
SeverityFileLineSnippetContext
LOWdocs/chapter8/search-r1/eval.py293 def update_progress(completed: int) -> None:CODE
LOWdocs/chapter6/code/pretrain.py36logger = logging.getLogger(__name__)CODE
LOWdocs/chapter6/code/finetune.py40logger = logging.getLogger(__name__)CODE
Over-Commented Block2 hits · 2 pts
SeverityFileLineSnippetContext
LOWdocs/chapter5/code/k_model.py61 def forward(self, x):COMMENT
LOWdocs/chapter2/第二章 Transformer架构.md301 # 注意力计算COMMENT