Repository Analysis

datawhalechina/happy-llm

📚 从零开始构建大模型

5.5 Low AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of datawhalechina/happy-llm, a Jupyter Notebook project with 33,329 GitHub stars. SynthScan v2.0 examined 44,018 lines of code across 97 source files, recording 184 pattern matches distributed across 11 syntactic categories. The overall adjusted score of 5.5 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).

5.5
Adjusted Score
5.5
Raw Score
100%
Time Factor
2026-08-08
Last Push
33.3K
Stars
Jupyter Notebook
Language
44.0K
Lines of Code
97
Files
184
Pattern Hits
2026-08-29
Scan Date
0.07
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

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

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 7MEDIUM 26LOW 151

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 184 distinct pattern matches across 11 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 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
MEDIUMdocs/chapter7/第七章 大模型应用.md93## 7.2 RAGCOMMENT
MEDIUMdocs/chapter7/第七章 大模型应用.md95### 7.2.1 RAG 的基本原理COMMENT
MEDIUMdocs/chapter7/第七章 大模型应用.md103### 7.2.2 搭建一个 RAG 框架COMMENT
MEDIUMdocs/chapter7/第七章 大模型应用.md440#### Step 6: Tiny-RAG DemoSTRING
Structural Annotation Overuse19 hits · 26 pts
SeverityFileLineSnippetContext
LOWdocs/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
LOWdocs/chapter7/第七章 大模型应用.md546#### Step 1 : 初始化客户端和模型STRING
LOWdocs/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
LOWdocs/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
LOWdocs/chapter5/第五章 动手搭建大模型.md917 except Exception as e:CODE
MEDIUMdocs/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
HIGHdocs/chapter7/第七章 大模型应用.md555 api_key="YOUR_API_KEY", # 替换为你的 API KeySTRING
HIGHdocs/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
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