MiniCPM5: SOTA on-device LLMs, small yet powerful.
This report summarizes scanner evidence for OpenBMB/MiniCPM, a Jupyter Notebook project with 11,772 GitHub stars. SynthScan examined 46,766 lines of code across 154 source files, recording 128 pattern matches distributed across 11 syntactic categories. The legacy adjusted pattern signal is 3.9 (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? 90 finding(s).
Are imports declared and package/API names verified? 17 finding(s).
Are wrappers, guards, and repeated structures necessary? 32 finding(s).
Which changes need focused human review? 128 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 128 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 |
|---|---|---|---|---|
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 67 | "content": "Certainly, measuring the results of a marketing strategy and making adjustments based on those metri | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 394 | "content": "Using Unreal's Gameplay Ability System (GAS) in conjunction with interpolation and prediction can pr | CODE |
| LOW⚡ | …ma_factory_example/llama_factory_data/kto_en_demo.json | 903 | "content": "I apologize for the confusion. The `unique_id` parameter in the `momepy.Tessellation` function expec | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 2012 | "content": "Two-factor authentication (2FA) adds an extra layer of security by requiring users to provide two fo | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 2114 | "content": "To adapt the program to handle in-place modification or the creation of new objects based on a boole | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 2449 | "content": "I'm not sure where you've heard that information, but as an AI language model, I can share some fact | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 2790 | "content": "To derive the original matrix from the rotated one, you would need to perform a 90 degrees counter-c | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 3013 | "content": "The genetic factors that contribute to the intricate design of the peacock's tail feathers are quite | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 3585 | "content": "As an AI language model,I cannot determine the sentiment of the product review without further conte | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 3611 | "content": "I'm unable to provide you with a real-time percentage of population living in poverty in Marlborough | CODE |
| LOW | …ma_factory_example/llama_factory_data/kto_en_demo.json | 3690 | "content": "Firstly, as a fitness trainer, I highly recommend consulting with a healthcare professional before e | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 3850 | "content": "Since each medium-sized box measures 2 feet on all sides, its volume will be: 2*2*2 = 8 cubic feet. | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 4774 | "content": "In Feng Shui, the five elements—wood, fire, earth, metal, and water—are believed to interact in cert | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 4897 | "content": "Sure, I understand the problem. However, I'm a large language model, I cannot provide a correct answ | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 4923 | "content": "As an AI language model, I am not able to provide program codes or algorithms. However, I can provid | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/sft_zh_demo.json | 4470 | "output": "As an AI language model I am capable of analyzing text and identifying emotions, however, the sentence pr | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 67 | "content": "Certainly, measuring the results of a marketing strategy and making adjustments based on those metri | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 394 | "content": "Using Unreal's Gameplay Ability System (GAS) in conjunction with interpolation and prediction can pr | CODE |
| LOW⚡ | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 903 | "content": "I apologize for the confusion. The `unique_id` parameter in the `momepy.Tessellation` function expec | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 2012 | "content": "Two-factor authentication (2FA) adds an extra layer of security by requiring users to provide two fo | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 2114 | "content": "To adapt the program to handle in-place modification or the creation of new objects based on a boole | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 2449 | "content": "I'm not sure where you've heard that information, but as an AI language model, I can share some fact | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 2790 | "content": "To derive the original matrix from the rotated one, you would need to perform a 90 degrees counter-c | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 3013 | "content": "The genetic factors that contribute to the intricate design of the peacock's tail feathers are quite | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 3585 | "content": "As an AI language model,I cannot determine the sentiment of the product review without further conte | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 3611 | "content": "I'm unable to provide you with a real-time percentage of population living in poverty in Marlborough | CODE |
| LOW | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 3690 | "content": "Firstly, as a fitness trainer, I highly recommend consulting with a healthcare professional before e | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 3850 | "content": "Since each medium-sized box measures 2 feet on all sides, its volume will be: 2*2*2 = 8 cubic feet. | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 4774 | "content": "In Feng Shui, the five elements—wood, fire, earth, metal, and water—are believed to interact in cert | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 4897 | "content": "Sure, I understand the problem. However, I'm a large language model, I cannot provide a correct answ | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 4923 | "content": "As an AI language model, I am not able to provide program codes or algorithms. However, I can provid | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/sft_zh_demo.json | 4470 | "output": "As an AI language model I am capable of analyzing text and identifying emotions, however, the sentence pr | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | demo/minicpm3/code_interpreter/code_interpreter.py | 105 | # Create a SamplingParams object | STRING |
| MEDIUM | demo/minicpm3/code_interpreter/code_interpreter.py | 135 | # Define a regular expression pattern to match Python code blocks | COMMENT |
| MEDIUM⚡ | …ma_factory_example/llama_factory_data/kto_en_demo.json | 887 | "content": "To smoothen the output polygons without creating gaps or overlaps, you can use a combination of libr | CODE |
| MEDIUM⚡ | …ma_factory_example/llama_factory_data/kto_en_demo.json | 895 | "content": "I apologize for the confusion. Let's try a different approach using the `TopologicalPreserveSimplifi | CODE |
| MEDIUM⚡ | …ma_factory_example/llama_factory_data/kto_en_demo.json | 907 | "content": "I have the following code:\n#%% Generate geoTiffs with index values based on one large geotiff with | CODE |
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 919 | "content": "To smoothen the output polygons without creating gaps or overlays between the polygons, you can use | CODE |
| MEDIUM⚡ | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 887 | "content": "To smoothen the output polygons without creating gaps or overlaps, you can use a combination of libr | CODE |
| MEDIUM⚡ | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 895 | "content": "I apologize for the confusion. Let's try a different approach using the `TopologicalPreserveSimplifi | CODE |
| MEDIUM⚡ | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 907 | "content": "I have the following code:\n#%% Generate geoTiffs with index values based on one large geotiff with | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 919 | "content": "To smoothen the output polygons without creating gaps or overlays between the polygons, you can use | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | demo/minicpm4/MCP/generate_example.py | 63 | except Exception as e: | CODE |
| LOW | demo/minicpm4/MCP/eval_scripts.py | 83 | except Exception as e: | CODE |
| LOW | …o/minicpm4/SurveyGeneration/src/retriever/retriever.py | 163 | except Exception as e: | CODE |
| MEDIUM | …o/minicpm4/SurveyGeneration/src/retriever/retriever.py | 164 | print(f"Error in call_search_engine: {e}") | CODE |
| MEDIUM | …o/minicpm4/SurveyGeneration/src/retriever/retriever.py | 133 | def call_search_engine(tool_call, topk=10): | CODE |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/run.py | 51 | except Exception as e: | CODE |
| MEDIUM | demo/minicpm4/SurveyGeneration/src/generation/run.py | 52 | print(f"Error sending to WebSocket: {e}") | CODE |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/run.py | 210 | except Exception as e: | CODE |
| MEDIUM | demo/minicpm4/SurveyGeneration/src/generation/run.py | 211 | print(f"Error posting to frontend: {e}") | CODE |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/run.py | 310 | except Exception as e: | CODE |
| MEDIUM | demo/minicpm4/SurveyGeneration/src/generation/run.py | 311 | print(f"Error generating survey: {e}") | CODE |
| LOW | demo/minicpm3/function_call/minicpm_tool_parser.py | 205 | except Exception as e: | CODE |
| LOW | demo/minicpm3/function_call/minicpm_tool_parser.py | 277 | except Exception as e: | CODE |
| LOW | demo/minicpm3/code_interpreter/code_interpreter.py | 76 | except Exception as e: | STRING |
| LOW | tool_parsers/minicpm5xml_tool_parser.py | 40 | except Exception: # pragma: no cover | CODE |
| LOW | tool_parsers/minicpm5xml_tool_parser.py | 108 | except Exception: | CODE |
| LOW | tool_parsers/minicpm5xml_tool_parser.py | 226 | except Exception: | CODE |
| LOW | tool_parsers/minicpm5xml_tool_parser.py | 260 | except Exception: | CODE |
| LOW | tool_parsers/minicpm5xml_tool_parser.py | 402 | except Exception as e: | CODE |
| LOW | tool_parsers/minicpm5xml_tool_parser.py | 645 | except Exception: | CODE |
| LOW | finetune/mlx_finetune.py | 441 | except Exception as e: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | demo/minicpm4/MCP/generate_example.py | 25 | CODE | |
| LOW | demo/minicpm4/MCP/generate_example.py | 71 | CODE | |
| LOW | demo/minicpm4/MCP/eval_scripts.py | 21 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/run.py | 93 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/run.py | 227 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/run.py | 255 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 36 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 75 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 149 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 210 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 408 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 462 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 510 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 556 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 612 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 639 | CODE | |
| LOW | demo/minicpm3/function_call/minicpm_tool_parser.py | 150 | CODE | |
| LOW | demo/minicpm3/function_call/minicpm_tool_parser.py | 239 | CODE | |
| LOW | demo/minicpm3/function_call/minicpm_tool_parser.py | 75 | CODE | |
| LOW | tool_parsers/minicpm5xml_tool_parser.py | 161 | CODE | |
| LOW | finetune/finetune.py | 78 | CODE | |
| LOW | finetune/sft_dpo_trainer/finetune_dpo_trainer.py | 85 | CODE | |
| LOW | finetune/sft_dpo_trainer/finetune_dpo_trainer.py | 184 | CODE | |
| LOW | finetune/sft_dpo_trainer/finetune_dpo_trainer.py | 228 | CODE | |
| LOW | minicpm_sala/finetune/trainer/finetune.py | 78 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | demo/minicpm/langchain_demo.py | 35 | CODE | |
| LOW | demo/minicpm/langchain_demo.py | 40 | CODE | |
| LOW | demo/minicpm4/MCP/eval_scripts.py | 1 | CODE | |
| LOW | …inicpm4/SurveyGeneration/src/preprocess/build_index.py | 6 | CODE | |
| LOW | …inicpm4/SurveyGeneration/src/preprocess/build_index.py | 8 | CODE | |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 276 | CODE | |
| LOW | demo/minicpm3/code_interpreter/code_interpreter.py | 3 | CODE | |
| LOW | demo/minicpm3/code_interpreter/code_interpreter.py | 4 | CODE | |
| LOW | demo/minicpm3/code_interpreter/code_interpreter.py | 6 | CODE | |
| LOW | demo/minicpm3/code_interpreter/code_interpreter.py | 7 | CODE | |
| LOW | tool_parsers/minicpm5xml_tool_parser.py | 6 | CODE | |
| LOW | quantize/awq_quantize.py | 4 | CODE | |
| LOW | quantize/quantize_eval.py | 5 | CODE | |
| LOW | finetune/mlx_finetune.py | 46 | CODE | |
| LOW | finetune/sft_dpo_trainer/finetune_dpo_trainer.py | 5 | CODE | |
| LOW | finetune/sft_dpo_trainer/finetune_dpo_trainer.py | 5 | CODE | |
| LOW | finetune/sft_dpo_trainer/finetune_dpo_trainer.py | 19 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 75 | def convert_survey_dict_to_str(current_survey): | CODE |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 149 | def convert_survey_dict_to_abbr_str(current_survey): | CODE |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 408 | def _build_user_prompt_force_correct(query, current_survey, trajs): | CODE |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 510 | def build_prompt_for_generator(self): | CODE |
| LOW | demo/minicpm3/function_call/minicpm_tool_parser.py | 75 | def extract_tool_calls_streaming( | CODE |
| LOW | tool_parsers/minicpm5xml_tool_parser.py | 464 | def _process_complete_block_streaming( | CODE |
| LOW | tool_parsers/minicpm5xml_tool_parser.py | 526 | def _process_partial_block_streaming( | CODE |
| LOW | tool_parsers/minicpm5xml_tool_parser.py | 565 | def extract_tool_calls_streaming( | CODE |
| LOW | quantize/quantize_data/alpaca_data_cleaned.json | 730 | "output": "Here's a Python implementation of the function:\n\n```\ndef uppercase_unless_rejected(string):\n if st | CODE |
| LOW | finetune/sft_dpo_trainer/finetune_dpo_trainer.py | 228 | def encode_conversation_with_labels(self, messages, response): | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | demo/minicpm3/code_interpreter/code_interpreter.py | 165 | # Check if the response contains the termination keyword | COMMENT |
| LOW | finetune/mlx_finetune.py | 487 | # Check if any sequence is longer than 2048 tokens | COMMENT |
| LOW | …ma_factory_example/llama_factory_data/sft_zh_demo.json | 275 | "output": "def calculate_sum(numbers):\n if not isinstance(numbers, list): # Check if input is a list\n r | CODE |
| LOW | …tune/llama_factory/llama_factory_data/sft_zh_demo.json | 275 | "output": "def calculate_sum(numbers):\n if not isinstance(numbers, list): # Check if input is a list\n r | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | README.md | 183 | During **post-training**, we proceed in three steps: **SFT**, **RL**, and **OPD**. We first use **400B tokens of deep-th | CODE |
| MEDIUM | README.md | 189 | **RL + OPD** is a key part of MiniCPM5-2B post-training. During the **RL** stage, we adopted the critic-based algorithm | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | …/SurveyGeneration/frontend/minicpm4-survey/src/App.jsx | 181 | }; | COMMENT |
| LOW | demo/minicpm4/SurveyGeneration/src/generation/buffer.py | 1 | COMMENT | |
| LOW | demo/minicpm3/function_call/function_calling.py | 41 | # "tool_calls": [ | COMMENT |
| LOW | demo/minicpm3/function_call/function_calling.py | 61 | # { | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | …ma_factory_example/llama_factory_data/kto_en_demo.json | 2769 | "content": " As an Azure Cloud Engineer working with Microsoft Azure, you can indeed utilize Azure Active Direct | CODE |
| MEDIUM | …tune/llama_factory/llama_factory_data/kto_en_demo.json | 2769 | "content": " As an Azure Cloud Engineer working with Microsoft Azure, you can indeed utilize Azure Active Direct | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | …o/minicpm4/SurveyGeneration/src/retriever/retriever.py | 131 | CODE |