Use PEFT or Full-parameter to CPT/SFT/DPO/GRPO 600+ LLMs (Qwen3.6, DeepSeek-V4, GLM-5.1, InternLM3, Llama4, ...) and 300+ MLLMs (Qwen3-VL, Qwen3-Omni, InternVL3.5, Ovis2.5, GLM4.5v, Gemma4, Llava, Phi4, ...) (AAAI 2025).
This report presents the forensic synthetic code analysis of modelscope/ms-swift, a Python project with 14,801 GitHub stars. SynthScan v2.0 examined 174,376 lines of code across 1294 source files, recording 2296 pattern matches distributed across 23 syntactic categories. The overall adjusted score of 15.3 places this repository in the Moderate 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).
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.
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.
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.
The scanner identified 2296 distinct pattern matches across 23 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.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | setup.py | 7 | CODE | |
| LOW | tests/run.py | 37 | CODE | |
| LOW | tests/llm/test_template.py | 50 | CODE | |
| LOW | tests/models/test_mllm.py | 8 | CODE | |
| LOW | tests/models/test_mllm.py | 8 | CODE | |
| LOW | tests/train/test_resume_from_checkpoint.py | 29 | CODE | |
| LOW | tests/train/test_resume_from_checkpoint.py | 29 | CODE | |
| LOW | tests/train/test_freeze.py | 18 | CODE | |
| LOW | tests/train/test_freeze.py | 18 | CODE | |
| LOW | tests/train/test_freeze.py | 36 | CODE | |
| LOW | tests/train/test_freeze.py | 36 | CODE | |
| LOW | tests/train/test_freeze.py | 54 | CODE | |
| LOW | tests/train/test_freeze.py | 54 | CODE | |
| LOW | tests/train/test_freeze.py | 72 | CODE | |
| LOW | tests/train/test_freeze.py | 72 | CODE | |
| LOW | tests/test_align/test_padding_side.py | 51 | CODE | |
| LOW | tests/hub/test_check_model.py | 17 | CODE | |
| LOW | tests/megatron/test_megatron_args.py | 22 | CODE | |
| LOW | tests/megatron/test_megatron_args.py | 22 | CODE | |
| LOW | swift/__init__.py | 7 | CODE | |
| LOW | swift/__init__.py | 7 | CODE | |
| LOW | swift/__init__.py | 8 | CODE | |
| LOW | swift/__init__.py | 8 | CODE | |
| LOW | swift/__init__.py | 8 | CODE | |
| LOW | swift/__init__.py | 8 | CODE | |
| LOW | swift/__init__.py | 8 | CODE | |
| LOW | swift/__init__.py | 8 | CODE | |
| LOW | swift/__init__.py | 8 | CODE | |
| LOW | swift/__init__.py | 8 | CODE | |
| LOW | swift/__init__.py | 8 | CODE | |
| LOW | swift/__init__.py | 8 | CODE | |
| LOW | swift/__init__.py | 8 | CODE | |
| LOW | swift/__init__.py | 11 | CODE | |
| LOW | swift/__init__.py | 11 | CODE | |
| LOW | swift/__init__.py | 12 | CODE | |
| LOW | swift/__init__.py | 12 | CODE | |
| LOW | swift/__init__.py | 13 | CODE | |
| LOW | swift/__init__.py | 13 | CODE | |
| LOW | swift/__init__.py | 13 | CODE | |
| LOW | swift/__init__.py | 13 | CODE | |
| LOW | swift/__init__.py | 13 | CODE | |
| LOW | swift/__init__.py | 13 | CODE | |
| LOW | swift/__init__.py | 13 | CODE | |
| LOW | swift/__init__.py | 13 | CODE | |
| LOW | swift/__init__.py | 13 | CODE | |
| LOW | swift/__init__.py | 13 | CODE | |
| LOW | swift/__init__.py | 15 | CODE | |
| LOW | swift/__init__.py | 15 | CODE | |
| LOW | swift/__init__.py | 16 | CODE | |
| LOW | swift/__init__.py | 16 | CODE | |
| LOW | swift/__init__.py | 16 | CODE | |
| LOW | swift/__init__.py | 16 | CODE | |
| LOW | swift/__init__.py | 16 | CODE | |
| LOW | swift/__init__.py | 17 | CODE | |
| LOW | swift/__init__.py | 17 | CODE | |
| LOW | swift/__init__.py | 17 | CODE | |
| LOW | swift/__init__.py | 18 | CODE | |
| LOW | swift/__init__.py | 18 | CODE | |
| LOW | swift/__init__.py | 19 | CODE | |
| LOW | swift/__init__.py | 19 | CODE | |
| 877 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/test_utils.py | 74 | def create_dummy_test_dataset(feat, label, num): | CODE |
| LOW⚡ | tests/run.py | 27 | def deduplicate_preserve_order(items): | CODE |
| LOW⚡ | tests/run.py | 31 | def get_available_npu_devices(visible_npus): | CODE |
| LOW | tests/run.py | 102 | def gather_test_suites_in_files(test_dir, case_file_list, list_tests): | CODE |
| LOW | tests/run.py | 157 | def async_run_command_with_popen(cmd, device_id): | CODE |
| LOW | tests/run.py | 347 | def run_non_parallelizable_test_suites(suites, result_dir): | CODE |
| LOW | tests/general/test_template_meta.py | 5 | def test_replace_system_preserves_non_string_elements(): | CODE |
| LOW | tests/general/test_data_preprocess.py | 50 | def test_truncation_max_length(self): | CODE |
| LOW | tests/general/test_data_preprocess.py | 58 | def test_data_collator_padding(self): | CODE |
| LOW | tests/general/test_data_preprocess.py | 153 | def test_empty_rejected_messages_does_not_crash(self): | CODE |
| LOW | tests/general/test_data_preprocess.py | 179 | def test_valid_rejected_messages_preserved(self): | CODE |
| LOW | tests/general/test_template.py | 75 | def test_save_pil_image_dimension_collision(): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 58 | def test_parse_empty_json_list(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 71 | def test_parse_multi_empty_tags_rejected(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 86 | def test_parse_overlapping_tags_rejected(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 101 | def test_parse_non_dict_entry_rejected(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 106 | def test_parse_tags_coerced_to_str(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 125 | def test_route_single_teacher_all_samples(self): | CODE |
| LOW⚡ | tests/utils/test_multi_teacher.py | 142 | def test_route_unmatched_fails_fast(self): | CODE |
| LOW⚡ | tests/utils/test_multi_teacher.py | 151 | def test_get_tag_reads_tag_key(self): | CODE |
| LOW⚡ | tests/utils/test_multi_teacher.py | 158 | def test_get_tag_no_tag_returns_none(self): | CODE |
| LOW⚡ | tests/utils/test_multi_teacher.py | 164 | def test_multi_teacher_scatter_back(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 182 | def test_single_teacher_one_fetch(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 197 | def test_empty_subset_teacher_still_visited(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 217 | def test_phase_split_concurrent_scatter(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 247 | def test_phase_split_non_main_no_infer(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 305 | def test_zero_coef_no_injection(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 346 | def test_streaming_injected_tags_route_correctly(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 360 | def test_streaming_fetch_by_routing(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 378 | def test_streaming_routing_matches_non_streaming(self): | CODE |
| LOW | tests/utils/test_multi_teacher.py | 390 | def test_streaming_interleave_preserves_per_dataset_tags(self): | CODE |
| LOW | tests/utils/test_async_rewards.py | 17 | def test_start_and_shutdown_event_loop_in_daemon(self): | CODE |
| LOW | tests/utils/test_async_rewards.py | 38 | def test_run_async_function_in_daemon_loop(self): | CODE |
| LOW | tests/utils/test_async_rewards.py | 57 | def test_async_orm_base_class(self): | CODE |
| LOW | tests/utils/test_async_rewards.py | 80 | def test_async_reward_is_detected(self): | CODE |
| LOW | tests/utils/test_async_rewards.py | 106 | def test_parallel_async_execution(self): | CODE |
| LOW | tests/utils/test_async_rewards.py | 153 | def test_async_reward_function_batch_performance(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 73 | def test_answer_tag_with_plain_number(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 82 | def test_answer_tag_with_latex(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 91 | def test_long_text_with_answer_tag(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 106 | def test_answer_tag_with_complex_expression(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 115 | def test_solution_with_answer_tag(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 124 | def test_answer_tag_wrong_answer(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 133 | def test_mixed_batch_with_and_without_tags(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 170 | def test_answer_tag_with_extra_whitespace(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 179 | def test_multiple_answer_tags(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 188 | def test_real_world_example_from_user(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 212 | def test_equivalent_fractions(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 221 | def test_different_forms_same_answer(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 230 | def test_latex_inline_math_delimiters(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 240 | def test_latex_display_math_delimiters(self): | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 249 | def test_mixed_latex_delimiters(self): | CODE |
| LOW | tests/utils/test_rewards.py | 38 | def test_multiple_steps_with_boxed(self): | CODE |
| LOW | tests/utils/test_rewards.py | 62 | def test_batch_processing_no_tag(self): | CODE |
| LOW | tests/tuners/test_swift_device_map.py | 25 | def test_swift_multiple_adapters(self): | CODE |
| LOW | tests/tuners/test_swift_base.py | 73 | def test_swift_adapter_forward(self): | CODE |
| LOW | tests/tuners/test_swift_base.py | 93 | def test_swift_prompt_forward(self): | CODE |
| LOW | tests/tuners/test_swift_base.py | 110 | def test_swift_restuner_forward(self): | CODE |
| LOW | tests/tuners/test_swift_base.py | 133 | def lora_injection_with_dtype(self, dtype=torch.float32): | CODE |
| LOW | tests/tuners/test_swift_base.py | 185 | def test_swift_lora_injection(self): | CODE |
| 421 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | setup.py | 24 | CODE | |
| LOW | setup.py | 44 | CODE | |
| LOW | setup.py | 78 | CODE | |
| LOW | setup.py | 96 | CODE | |
| LOW | tests/test_utils.py | 124 | CODE | |
| LOW | tests/run.py | 58 | CODE | |
| LOW | tests/run.py | 102 | CODE | |
| LOW | tests/run.py | 217 | CODE | |
| LOW | tests/run.py | 236 | CODE | |
| LOW | tests/run.py | 375 | CODE | |
| LOW | tests/run.py | 489 | CODE | |
| LOW | tests/general/test_arch.py | 1 | CODE | |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 49 | CODE | |
| LOW | swift/ui/base.py | 268 | CODE | |
| LOW | swift/ui/base.py | 314 | CODE | |
| LOW | swift/ui/llm_export/llm_export.py | 101 | CODE | |
| LOW | swift/ui/llm_grpo/llm_grpo.py | 216 | CODE | |
| LOW | swift/ui/llm_grpo/external_rollout.py | 145 | CODE | |
| LOW | swift/ui/llm_grpo/tuner.py | 18 | CODE | |
| LOW | swift/ui/llm_rlhf/llm_rlhf.py | 232 | CODE | |
| LOW | swift/ui/llm_rlhf/tuner.py | 18 | CODE | |
| LOW | swift/ui/llm_sample/llm_sample.py | 166 | CODE | |
| LOW | swift/ui/llm_eval/llm_eval.py | 104 | CODE | |
| LOW | swift/ui/llm_infer/runtime.py | 133 | CODE | |
| LOW | swift/ui/llm_infer/runtime.py | 265 | CODE | |
| LOW | swift/ui/llm_infer/llm_infer.py | 124 | CODE | |
| LOW | swift/ui/llm_infer/llm_infer.py | 189 | CODE | |
| LOW | swift/ui/llm_train/task.py | 64 | CODE | |
| LOW | swift/ui/llm_train/runtime.py | 295 | CODE | |
| LOW | swift/ui/llm_train/runtime.py | 374 | CODE | |
| LOW | swift/ui/llm_train/runtime.py | 407 | CODE | |
| LOW | swift/ui/llm_train/runtime.py | 542 | CODE | |
| LOW | swift/ui/llm_train/runtime.py | 600 | CODE | |
| LOW | swift/ui/llm_train/llm_train.py | 242 | CODE | |
| LOW | swift/ui/llm_train/llm_train.py | 325 | CODE | |
| LOW | swift/ui/llm_train/llm_train.py | 551 | CODE | |
| LOW | swift/ui/llm_train/optimizer.py | 121 | CODE | |
| LOW | swift/ui/llm_train/tuner.py | 290 | CODE | |
| LOW | swift/loss/embedding.py | 88 | CODE | |
| LOW | swift/loss/embedding.py | 115 | CODE | |
| LOW | swift/callbacks/activation_cpu_offload.py | 320 | CODE | |
| LOW | swift/callbacks/activation_cpu_offload.py | 587 | CODE | |
| LOW | swift/dataset/dataset_meta.py | 120 | CODE | |
| LOW | swift/dataset/packing.py | 53 | CODE | |
| LOW | swift/dataset/loader.py | 71 | CODE | |
| LOW | swift/dataset/dataset/mllm.py | 568 | CODE | |
| LOW | swift/dataset/dataset/mllm.py | 240 | CODE | |
| LOW | swift/dataset/dataset/mllm.py | 716 | CODE | |
| LOW | swift/dataset/dataset/mllm.py | 792 | CODE | |
| LOW | swift/dataset/dataset/mllm.py | 953 | CODE | |
| LOW | swift/dataset/dataset/mllm.py | 1234 | CODE | |
| LOW | swift/dataset/dataset/llm.py | 764 | CODE | |
| LOW | swift/dataset/preprocessor/core.py | 173 | CODE | |
| LOW | swift/dataset/preprocessor/core.py | 494 | CODE | |
| LOW | swift/rewards/orm.py | 238 | CODE | |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 198 | CODE | |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 370 | CODE | |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 521 | CODE | |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 658 | CODE | |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 892 | CODE | |
| 275 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | tests/utils/test_assemble_teacher_topk_logprobs.py | 10 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/utils/test_assemble_teacher_topk_logprobs.py | 12 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/utils/test_assemble_teacher_topk_logprobs.py | 30 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/utils/test_assemble_teacher_topk_logprobs.py | 32 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/utils/test_assemble_teacher_topk_logprobs.py | 76 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/utils/test_assemble_teacher_topk_logprobs.py | 78 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 41 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 43 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 196 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 198 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 229 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 231 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 262 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 264 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 295 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 297 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 361 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 363 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 457 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_align/test_mm_processor_align.py | 459 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/gkd_loss.py | 9 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/gkd_loss.py | 11 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM⚡ | swift/rlhf_trainers/gkd_loss.py | 71 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM⚡ | swift/rlhf_trainers/gkd_loss.py | 73 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM⚡ | swift/rlhf_trainers/gkd_loss.py | 89 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM⚡ | swift/rlhf_trainers/gkd_loss.py | 91 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/gkd_loss.py | 151 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/gkd_loss.py | 153 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/gkd_loss.py | 170 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/gkd_loss.py | 172 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/gkd_loss.py | 219 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/gkd_loss.py | 221 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM⚡ | swift/rlhf_trainers/utils.py | 1775 | # ============================================================================ | COMMENT |
| MEDIUM⚡ | swift/rlhf_trainers/utils.py | 1777 | # ============================================================================ | COMMENT |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 445 | # -------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 447 | # -------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 480 | # -------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 482 | # -------------------------------------------------- | COMMENT |
| MEDIUM | swift/pipelines/infer/rollout.py | 318 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM | swift/pipelines/infer/rollout.py | 320 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM | swift/pipelines/infer/rollout.py | 440 | # ── Step 1: receive + rebuild IPC handle (with reuse) ──────── | COMMENT |
| MEDIUM | swift/pipelines/infer/rollout.py | 478 | # ── Step 2: stream buckets and load_weights per bucket ────── | COMMENT |
| MEDIUM⚡ | swift/rollout/multi_turn.py | 755 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM⚡ | swift/rollout/multi_turn.py | 757 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM⚡ | swift/rollout/multi_turn.py | 807 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM⚡ | swift/rollout/multi_turn.py | 809 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM⚡ | swift/rollout/multi_turn.py | 819 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM⚡ | swift/rollout/multi_turn.py | 821 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM | swift/rollout/multi_turn.py | 33 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM | swift/rollout/multi_turn.py | 42 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM | swift/rollout/openenv_wrapper.py | 38 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM | swift/rollout/openenv_wrapper.py | 40 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM⚡ | swift/rollout/openenv_wrapper.py | 80 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM⚡ | swift/rollout/openenv_wrapper.py | 83 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM | swift/model/npu_patch/model.py | 18 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/model/npu_patch/model.py | 20 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/model/npu_patch/model.py | 177 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/model/npu_patch/model.py | 179 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/model/npu_patch/model.py | 209 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/model/npu_patch/model.py | 211 | # --------------------------------------------------------------------------- | COMMENT |
| 23 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | tests/run.py | 39 | except Exception as e: | CODE |
| LOW | tests/run.py | 383 | except Exception: | CODE |
| LOW | tests/model_tag.py | 66 | except Exception as e: | CODE |
| LOW | tests/model_tag.py | 94 | except Exception as e: | CODE |
| LOW | tests/model_tag.py | 115 | except Exception as e: | CODE |
| LOW | tests/model_tag.py | 131 | except Exception as e: | CODE |
| MEDIUM | tests/model_tag.py | 53 | def _post_request(self, url, param): | CODE |
| MEDIUM | tests/model_tag.py | 72 | def batch_commit_result(self): | CODE |
| MEDIUM | tests/model_tag.py | 100 | def batch_refresh_stage(self): | CODE |
| MEDIUM | tests/model_tag.py | 121 | def query_model_stage(self): | CODE |
| LOW | tests/general/test_arch.py | 18 | except Exception: | CODE |
| LOW | tests/deploy/test_dataset.py | 12 | except Exception: | CODE |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 477 | except Exception as e: | CODE |
| LOW | tests/test_align/test_mm_processor_align.py | 560 | except Exception: | CODE |
| LOW | tests/megatron/test_ray_gkd.py | 195 | except Exception as e: # noqa: megatron-core not installed in this env | CODE |
| LOW | tests/megatron/test_ray_gkd.py | 385 | except Exception: | CODE |
| LOW | tests/megatron/test_ray_gkd.py | 398 | except Exception as e: # noqa | CODE |
| LOW | docs/source/BestPractices/GRPO.md | 78 | except Exception as e: | STRING |
| LOW | docs/source/BestPractices/GRPO-Multi-Modal-Training.md | 79 | except Exception: | CODE |
| LOW | docs/source/BestPractices/GRPO-Multi-Modal-Training.md | 96 | except Exception: | CODE |
| LOW | …source/Instruction/GRPO/DeveloperGuide/reward_model.md | 118 | except Exception as e: | STRING |
| LOW | docs/source_en/BestPractices/GRPO.md | 82 | except Exception as e: | STRING |
| LOW | …s/source_en/BestPractices/GRPO-Multi-Modal-Training.md | 85 | except Exception: | CODE |
| LOW | …s/source_en/BestPractices/GRPO-Multi-Modal-Training.md | 102 | except Exception: | CODE |
| LOW | …rce_en/Instruction/GRPO/DeveloperGuide/reward_model.md | 117 | except Exception as e: | CODE |
| LOW | swift/ui/base.py | 347 | except Exception as e: | CODE |
| LOW | swift/ui/base.py | 368 | except Exception: | CODE |
| LOW | swift/ui/llm_grpo/external_runtime.py | 135 | except Exception as e: | CODE |
| LOW | swift/ui/llm_eval/eval.py | 103 | except Exception as e: | CODE |
| LOW | swift/ui/llm_infer/runtime.py | 259 | except Exception as e: | CODE |
| LOW | swift/ui/llm_train/runtime.py | 590 | except Exception as e: | CODE |
| LOW | swift/ui/llm_train/llm_train.py | 406 | except Exception as e: | CODE |
| LOW | swift/ui/llm_train/llm_train.py | 530 | except Exception as err: | CODE |
| LOW | swift/dataset/utils.py | 95 | except Exception as e: | CODE |
| LOW | swift/dataset/packing.py | 177 | except Exception as e: | CODE |
| LOW | swift/dataset/loader.py | 117 | except Exception as e: | CODE |
| LOW | swift/dataset/dataset/mllm.py | 797 | except Exception: | CODE |
| LOW | swift/dataset/preprocessor/core.py | 195 | except Exception as e: | CODE |
| LOW | swift/rewards/prm.py | 90 | except Exception: | STRING |
| LOW | swift/rewards/prm.py | 148 | except Exception: | STRING |
| LOW | swift/rewards/orm.py | 114 | except Exception: | CODE |
| LOW | swift/rewards/orm.py | 251 | except Exception: | CODE |
| LOW | swift/rewards/orm.py | 258 | except Exception: | CODE |
| LOW | swift/rewards/orm.py | 300 | except Exception: | CODE |
| LOW | swift/rewards/orm.py | 374 | except Exception: | CODE |
| LOW | swift/rewards/orm.py | 419 | except Exception: | CODE |
| LOW | swift/rewards/rm_plugin.py | 224 | except Exception as e: | STRING |
| MEDIUM | swift/rlhf_trainers/rollout_mixin.py | 1573 | def infer_task(): | CODE |
| MEDIUM | swift/rlhf_trainers/rollout_mixin.py | 1583 | def done(future): | CODE |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 1577 | except Exception as e: | CODE |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 1587 | except Exception as e: | CODE |
| LOW | swift/rlhf_trainers/reward_trainer.py | 102 | except Exception as e: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1109 | except Exception: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1136 | except Exception: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1150 | except Exception as e: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1182 | except Exception: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1198 | except Exception: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1285 | except Exception as e: | CODE |
| MEDIUM | swift/rlhf_trainers/vllm_client.py | 130 | def process_chunk(i, chunk): | CODE |
| MEDIUM | swift/rlhf_trainers/vllm_client.py | 237 | def _update_single_server(i): | CODE |
| 136 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | tests/llm/test_custom.py | 0 | task: based on the given two sentences, provide a similarity score between 0.0 and 1.0. sentence 1: {text1} sentence 2: | STRING |
| HIGH | examples/custom/dataset.py | 0 | task: based on the given two sentences, provide a similarity score between 0.0 and 1.0. sentence 1: {text1} sentence 2: | STRING |
| HIGH | swift/dataset/dataset/llm.py | 0 | task: based on the given two sentences, provide a similarity score between 0.0 and 1.0. sentence 1: {text1} sentence 2: | STRING |
| HIGH | docs/source/BestPractices/GRPO.md | 0 | evaluates completions based on mathematical correctness of the answer args: completions (list[str]): generated outputs t | STRING |
| HIGH | docs/source_en/BestPractices/GRPO.md | 0 | evaluates completions based on mathematical correctness of the answer args: completions (list[str]): generated outputs t | STRING |
| HIGH | examples/train/grpo/plugin/plugin.py | 0 | evaluates completions based on mathematical correctness of the answer args: completions (list[str]): generated outputs t | STRING |
| HIGH | docs/source/BestPractices/GRPO-Multi-Modal-Training.md | 0 | reward function that checks if the completion is correct. args: completions (list[str]): generated outputs solution (lis | STRING |
| HIGH | …s/source_en/BestPractices/GRPO-Multi-Modal-Training.md | 0 | reward function that checks if the completion is correct. args: completions (list[str]): generated outputs solution (lis | STRING |
| HIGH | examples/train/grpo/plugin/plugin.py | 0 | reward function that checks if the completion is correct. args: completions (list[str]): generated outputs solution (lis | STRING |
| HIGH | docs/source/BestPractices/AMD-support.md | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. | STRING |
| HIGH | docs/source/BestPractices/Qwen3_5-Best-Practice.md | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. | STRING |
| HIGH | docs/source_en/BestPractices/AMD-support.md | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. | STRING |
| HIGH | docs/source_en/BestPractices/Qwen3_5-Best-Practice.md | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. | STRING |
| HIGH | examples/models/qwen3_5/mcore_grpo_moe.sh | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. | STRING |
| HIGH | examples/train/grpo/opd_rl.sh | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. | STRING |
| HIGH | examples/train/grpo/plugin/gsm8k/gsm8k.sh | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. | STRING |
| HIGH | examples/train/grpo/internal/fipo.sh | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. | STRING |
| HIGH | examples/train/grpo/internal/real.sh | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. | STRING |
| HIGH | examples/megatron/grpo/opd_rl.sh | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. | STRING |
| HIGH | examples/megatron/grpo/real.sh | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | docs/README.md | 18 | Load data from json/yaml/pickle files. This method provides a unified api for loading data from serialized file | STRING |
| HIGH | swift/dataset/loader.py | 247 | Load and preprocess datasets. This function provides a unified interface to load datasets from various sources (Hug | STRING |
| HIGH | swift/rewards/rm_plugin.py | 123 | Extract the reward score from the model's output. Args: model_output (str): The model's ou | STRING |
| HIGH | swift/rlhf_trainers/rollout_mixin.py | 522 | Split model parameters into batches for synchronized weight transfer. This method divides model parameters into | STRING |
| HIGH | swift/rlhf_trainers/rollout_mixin.py | 1723 | Attempt to encode each input using the template. If encoding fails, resample from a backup iterator unt | STRING |
| HIGH | swift/template/register.py | 81 | Get or create a template instance for model input/output formatting. This function retrieves the appropriate templa | STRING |
| HIGH | swift/loss_scale/mapping.py | 20 | Factory function to create a loss scale object from a string specification. The loss_scale string supports the foll | STRING |
| HIGH | swift/utils/hub_utils.py | 27 | Download model snapshot safely with DDP context protection. This function attempts to download a model from Hugging | STRING |
| HIGH | swift/utils/torch_utils.py | 269 | Get the last valid (non-padding) token position indices for each sample. This function correctly handles seque | STRING |
| HIGH | swift/rollout/multi_turn.py | 72 | Perform asynchronous batched inference for multiple rollout requests. This method serves as the main e | STRING |
| HIGH | swift/rollout/multi_turn.py | 225 | Execute multi-turn conversation rollout with built-in turn management logic. This implements the default multi- | STRING |
| HIGH | swift/rl_core/resample.py | 27 | Replace samples whose encode fails with fresh ones from ``data_iterator``. Caps the TOTAL encode attempts (fail-fas | STRING |
| HIGH | swift/model/chunk_gated_delta_rule.py | 256 | Args: q (torch.Tensor): queries of shape `[B, T, H, K]`. k (torch.Tensor): | STRING |
| HIGH | swift/model/register.py | 544 | Load a pretrained model and its processor from a model hub or local path. Args: model_id_or_path: The model | STRING |
| HIGH | swift/megatron/trainers/grpo_trainer.py | 1276 | Attempt to encode each input using the template. If encoding fails, resample from a backup iterator unt | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | tests/megatron/test_ray_gkd.py | 262 | # Create a minimal mock trainer instance (bypass __init__) | COMMENT |
| MEDIUM | tests/megatron/test_ray_gkd.py | 327 | # Create a minimal mock trainer | COMMENT |
| MEDIUM | swift/callbacks/perf_log.py | 128 | # This function is never used. | COMMENT |
| MEDIUM | swift/rewards/rm_plugin.py | 3 | # This module provides plugins for integrating external reward models, | COMMENT |
| MEDIUM | swift/rewards/rm_plugin.py | 169 | # Define a mapping for role capitalization if needed | STRING |
| MEDIUM | swift/rlhf_trainers/utils.py | 328 | # Create a DeepSpeedPlugin with the processed config | COMMENT |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 1856 | # Create a copy to avoid modifying the original table used by other loggers. | COMMENT |
| MEDIUM | swift/template/base.py | 473 | # This function is only used to handle scenarios where the model needs | COMMENT |
| MEDIUM⚡ | swift/template/base.py | 1629 | """This function is important for multi-modal training, as it registers the post_encode method | STRING |
| MEDIUM | swift/pipelines/train/tuner.py | 127 | """This function is only useful on the vera tuner""" | STRING |
| MEDIUM | swift/pipelines/infer/rollout.py | 150 | # Create a stateless process group to manage communication between training processes and vLLM workers. | COMMENT |
| MEDIUM | swift/pipelines/eval/utils.py | 140 | # Create a future to receive the result asynchronously | COMMENT |
| MEDIUM | swift/utils/hf_config.py | 13 | """This class is used to read config from config.json(maybe params.json also)""" | STRING |
| MEDIUM | swift/tuners/peft.py | 110 | # Create a 1-element tensor then expand with stride-0: no real memory alloc | COMMENT |
| MEDIUM | swift/rollout/multi_turn.py | 526 | # Create a RolloutOutput for the current round | COMMENT |
| MEDIUM | swift/rollout/multi_turn.py | 591 | # Create a mock inputs object to use the template's _swift_prepare_inputs method | COMMENT |
| MEDIUM | examples/models/qwen3_tts/prepare_data.py | 1 | # This file is used to generate `audio_codes` in the dataset. | COMMENT |
| MEDIUM⚡ | examples/train/grpo/plugin/plugin.py | 72 | # Define a regex pattern that only allows numbers, operators, parentheses, and whitespace | COMMENT |
| MEDIUM⚡ | examples/train/grpo/plugin/plugin.py | 219 | # Create the sandbox by hand, currently there's no context manager for this version | COMMENT |
| MEDIUM⚡ | examples/train/grpo/plugin/plugin.py | 225 | # Create a list of tasks for running scripts concurrently | COMMENT |
| MEDIUM | examples/train/grpo/plugin/plugin.py | 204 | # Create a new event loop and set it | COMMENT |
| MEDIUM | examples/train/think_model/qwen3_demo1.sh | 3 | # This method is also applicable to the Deepseek-R1 series of models. | COMMENT |
| MEDIUM | examples/custom/my_qwen2_5_omni/my_register.py | 306 | """This function is typically used to solve the zero2/zero3 hanging issue in mixed model training, | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/general/test_dataset.py | 21 | 'AI-ModelScope/LongAlpaca-12k#1000' | COMMENT |
| LOW | tests/general/test_dataset.py | 81 | COMMENT | |
| LOW | tests/train/test_sft.py | 481 | # test_mllm_streaming_mp_ddp() | COMMENT |
| LOW | tests/test_align/test_vllm_vlm.py | 201 | # test_qwen2_5_omni() | COMMENT |
| LOW | tests/test_align/test_template/test_agent.py | 721 | print(f'labels: {template.safe_decode(encoded2["labels"])}') | COMMENT |
| LOW | tests/test_align/test_template/test_agent.py | 741 | # test_glm4_5() | COMMENT |
| LOW | tests/test_align/test_template/test_llm.py | 741 | logger = get_logger() | COMMENT |
| LOW | tests/test_align/test_template/test_llm.py | 761 | # test_qwen2_5_math() | COMMENT |
| LOW | tests/test_align/test_template/test_llm.py | 781 | # test_hunyuan() | COMMENT |
| LOW | tests/test_align/test_template/test_video.py | 401 | logger = get_logger() | COMMENT |
| LOW | tests/test_align/test_template/test_vision.py | 1281 | # test_qwen2_5_vl_batch_infer() | COMMENT |
| LOW | tests/test_align/test_template/test_vision.py | 1301 | # test_got_ocr() | COMMENT |
| LOW | tests/test_align/test_template/test_vision.py | 1321 | # test_doc_owl2() | COMMENT |
| LOW | tests/test_align/test_template/test_vision.py | 1341 | test_minicpmv4_6() | COMMENT |
| LOW | tests/test_align/test_template/test_vision.py | 1361 | # test_paddle_ocr_1_5() | COMMENT |
| LOW | tests/test_align/test_template/test_template.py | 161 | COMMENT | |
| LOW | tests/eval/test_eval.py | 61 | test_eval_llm() | COMMENT |
| LOW | tests/export/test_quant.py | 101 | # test_bert() | COMMENT |
| LOW | docs/source/conf.py | 1 | # Configuration file for the Sphinx documentation builder. | COMMENT |
| LOW | docs/source/conf.py | 81 | COMMENT | |
| LOW | docs/source_en/conf.py | 1 | # Configuration file for the Sphinx documentation builder. | COMMENT |
| LOW | docs/source_en/conf.py | 81 | COMMENT | |
| LOW | docs/source_en/Megatron-SWIFT/LoRA-Training.md | 141 | # swift export | COMMENT |
| LOW | swift/rlhf_trainers/grpo_trainer.py | 181 | repeat_count=self.num_iterations * self.args.steps_per_generation * sequence_parallel.world_size, | COMMENT |
| LOW | swift/pipelines/infer/rollout.py | 321 | # | COMMENT |
| LOW | examples/ascend/activation_cpu_offload/train.sh | 41 | # {'train_runtime': 79.7064, 'train_samples_per_second': 6.311, 'train_steps_per_second': 0.201, 'train_loss': 1.9164841 | COMMENT |
| LOW | examples/deploy/vllm_dp.sh | 1 | CUDA_VISIBLE_DEVICES=0,1 swift deploy \ | COMMENT |
| LOW | examples/deploy/vllm_dp.sh | 21 | # "temperature": 0 | COMMENT |
| LOW | examples/deploy/vllm.sh | 1 | CUDA_VISIBLE_DEVICES=0 swift deploy \ | COMMENT |
| LOW | examples/models/gpt_oss/internvl3_5_gpt.sh | 41 | --padding_free false \ | COMMENT |
| LOW | examples/models/qwen3_next/mtp.sh | 41 | --sequence_parallel true \ | COMMENT |
| LOW | examples/models/gemma4/gemma4_unified.sh | 41 | --group_by_length true \ | COMMENT |
| LOW | examples/models/qwen3_5/mcore.sh | 61 | # CUDA_VISIBLE_DEVICES=0,1,2,3 \ | COMMENT |
| LOW | examples/models/qwen3_5/transformers.sh | 41 | # IMAGE_MAX_TOKEN_NUM=1024 \ | COMMENT |
| LOW | examples/models/qwen3_5/fp8.sh | 61 | # swift infer \ | COMMENT |
| LOW | examples/train/on_policy_distillation.sh | 1 | # On-Policy Distillation https://thinkingmachines.ai/blog/on-policy-distillation/ | COMMENT |
| LOW | …mples/train/multimodal/lora_llm_full_vit/merge_lora.sh | 1 | CUDA_VISIBLE_DEVICES=0 \ | COMMENT |
| LOW | …s/train/sequence_parallel/sequence_parallel_qwen3_5.sh | 21 | --logging_steps 1 \ | COMMENT |
| LOW | examples/train/rlhf/opsd/opsd.sh | 1 | # OPSD Training Script | COMMENT |
| LOW | examples/train/grpo/plugin/run_external_scheduler.sh | 1 | # This script require main branch ms-swift | COMMENT |
| LOW | …es/train/grpo/plugin/openenv/run_grpo_sudoku_server.sh | 1 | # ============================================================ | COMMENT |
| LOW | …es/train/grpo/plugin/openenv/run_grpo_sudoku_server.sh | 21 | # | COMMENT |
| LOW | examples/train/grpo/plugin/openenv/run_grpo_sudoku.sh | 1 | # ============================================================ | COMMENT |
| LOW | examples/train/grpo/plugin/deepeyes/deepeyes.sh | 1 | # 8 * 80G | COMMENT |
| LOW | examples/train/grpo/internal/full_lmdeploy.sh | 1 | # The LMDeploy backend in GRPO has been deprecated in Swift 3.5. | COMMENT |
| LOW | examples/train/grpo/external/vllm_multi_turn.sh | 1 | # Exp: https://github.com/modelscope/ms-swift/pull/5307#issuecomment-3219803922 | COMMENT |
| LOW | examples/megatron/mcore_bridge/full/dense.sh | 41 | # VIDEO_MAX_TOKEN_NUM=128 \ | COMMENT |
| LOW | examples/megatron/mcore_bridge/lora/seq_cls.sh | 41 | --no_save_rng true \ | COMMENT |
| LOW | examples/megatron/multimodal/lora_llm_vit_full/sft.sh | 61 | # IMAGE_MAX_TOKEN_NUM=1024 \ | COMMENT |
| LOW | examples/megatron/grpo/dense_server.sh | 1 | # MAX_PIXELS=602112 \ | COMMENT |
| LOW | examples/megatron/lora/mtp.sh | 41 | --dataloader_num_workers 8 \ | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | tests/utils/test_rewards.py | 193 | '### Step 1: Recall the formula\n\n' | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 195 | '### Step 2: Use the given terms\n\n' | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 200 | '### Step 3: Find $a_9$\n\n' | CODE |
| LOW | …s/source/Instruction/GRPO/DeveloperGuide/multi_turn.md | 118 | 'solution': "To solve the problem, we need to evaluate the expression \\(\\sqrt{36 \\times \\sqrt{16}}\\).\n\nWe | STRING |
| LOW | docs/source_en/Instruction/Distillation.md | 253 | # Step 1: Deploy teacher model (max_logprobs must be >= gkd_logits_topk) | COMMENT |
| LOW | docs/source_en/Instruction/Distillation.md | 260 | # Step 2: Start GKD training | COMMENT |
| LOW | …ource_en/Instruction/GRPO/DeveloperGuide/multi_turn.md | 121 | 'solution': "To solve the problem, we need to evaluate the expression \\(\\sqrt{36 \\times \\sqrt{16}}\\).\n\nWe | STRING |
| LOW⚡ | swift/metrics/reranker.py | 61 | # Step 1: Find all positive sample indices (query boundaries) | COMMENT |
| LOW⚡ | swift/metrics/reranker.py | 67 | # Step 2: Split into groups (queries) | COMMENT |
| LOW | swift/metrics/reranker.py | 85 | # Step 3: Calculate metrics for each query independently | COMMENT |
| LOW | swift/metrics/reranker.py | 135 | # Step 4: Calculate mean metrics across all valid queries | COMMENT |
| LOW | swift/template/templates/minicpm.py | 431 | # Step 1: Base encode — produces input_ids with -100 for images | COMMENT |
| LOW | swift/template/templates/minicpm.py | 445 | # Step 2: Process images — replace -100 tokens with image placeholders | COMMENT |
| LOW | swift/template/templates/minicpm.py | 459 | # Step 3: Process audios — expand audio_start/audio_end pairs with <unk> tokens | COMMENT |
| LOW⚡ | swift/template/templates/minicpm.py | 497 | # Step 4: Compute image_bound using start/end token boundaries | COMMENT |
| LOW | swift/template/templates/minicpm.py | 522 | # Step 5: Compute audio_bounds | COMMENT |
| LOW⚡ | swift/sequence_parallel/sequence_parallel.py | 427 | # Step 1: Gather from all sequence parallel ranks | COMMENT |
| LOW⚡ | swift/sequence_parallel/sequence_parallel.py | 435 | # Step 2: Gather all rp chunks | COMMENT |
| LOW⚡ | swift/megatron/trainers/vocab_parallel_utils.py | 41 | # Step 1: Find global max for numerical stability | COMMENT |
| LOW⚡ | swift/megatron/trainers/vocab_parallel_utils.py | 45 | # Step 2: Compute exp(logits - max) and sum across all TP ranks | COMMENT |
| LOW⚡ | swift/megatron/trainers/vocab_parallel_utils.py | 50 | # Step 3: Compute log_softmax | COMMENT |
| LOW⚡ | swift/megatron/trainers/grpo_trainer.py | 312 | # Step 2: Compute KL from logps if kl_in_reward is enabled | COMMENT |
| LOW⚡ | swift/megatron/trainers/grpo_trainer.py | 317 | # Step 3: Compute the per-sequence base advantage (with ref-KL penalty if kl_in_reward). | COMMENT |
| LOW⚡ | swift/megatron/trainers/grpo_trainer.py | 321 | # Step 4: Write the advantage onto each batch, expanding the per-sequence base advantage to | COMMENT |
| LOW | swift/megatron/trainers/grpo_trainer.py | 283 | # Step 1: Encode batches and compute logps first (unified flow like GRPOTrainer) | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | tests/utils/test_rewards.py | 193 | '### Step 1: Recall the formula\n\n' | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 195 | '### Step 2: Use the given terms\n\n' | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 200 | '### Step 3: Find $a_9$\n\n' | CODE |
| LOW⚡ | swift/metrics/reranker.py | 61 | # Step 1: Find all positive sample indices (query boundaries) | COMMENT |
| LOW⚡ | swift/metrics/reranker.py | 67 | # Step 2: Split into groups (queries) | COMMENT |
| LOW | swift/metrics/reranker.py | 85 | # Step 3: Calculate metrics for each query independently | COMMENT |
| LOW | swift/metrics/reranker.py | 135 | # Step 4: Calculate mean metrics across all valid queries | COMMENT |
| LOW | swift/template/templates/minicpm.py | 431 | # Step 1: Base encode — produces input_ids with -100 for images | COMMENT |
| LOW | swift/template/templates/minicpm.py | 445 | # Step 2: Process images — replace -100 tokens with image placeholders | COMMENT |
| LOW | swift/template/templates/minicpm.py | 459 | # Step 3: Process audios — expand audio_start/audio_end pairs with <unk> tokens | COMMENT |
| LOW⚡ | swift/template/templates/minicpm.py | 497 | # Step 4: Compute image_bound using start/end token boundaries | COMMENT |
| LOW | swift/template/templates/minicpm.py | 522 | # Step 5: Compute audio_bounds | COMMENT |
| LOW⚡ | swift/sequence_parallel/sequence_parallel.py | 427 | # Step 1: Gather from all sequence parallel ranks | COMMENT |
| LOW⚡ | swift/sequence_parallel/sequence_parallel.py | 435 | # Step 2: Gather all rp chunks | COMMENT |
| LOW⚡ | swift/megatron/trainers/vocab_parallel_utils.py | 41 | # Step 1: Find global max for numerical stability | COMMENT |
| LOW⚡ | swift/megatron/trainers/vocab_parallel_utils.py | 45 | # Step 2: Compute exp(logits - max) and sum across all TP ranks | COMMENT |
| LOW⚡ | swift/megatron/trainers/vocab_parallel_utils.py | 50 | # Step 3: Compute log_softmax | COMMENT |
| LOW⚡ | swift/megatron/trainers/grpo_trainer.py | 312 | # Step 2: Compute KL from logps if kl_in_reward is enabled | COMMENT |
| LOW⚡ | swift/megatron/trainers/grpo_trainer.py | 317 | # Step 3: Compute the per-sequence base advantage (with ref-KL penalty if kl_in_reward). | COMMENT |
| LOW⚡ | swift/megatron/trainers/grpo_trainer.py | 321 | # Step 4: Write the advantage onto each batch, expanding the per-sequence base advantage to | COMMENT |
| LOW | swift/megatron/trainers/grpo_trainer.py | 283 | # Step 1: Encode batches and compute logps first (unified flow like GRPOTrainer) | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/run.py | 486 | CODE | |
| LOW | tests/utils/test_async_rewards.py | 75 | CODE | |
| LOW | tests/train/test_opsd.py | 44 | CODE | |
| LOW | swift/dataset/loader.py | 224 | CODE | |
| LOW | swift/dataset/loader.py | 24 | CODE | |
| LOW | swift/dataset/preprocessor/core.py | 438 | CODE | |
| LOW | swift/template/register.py | 55 | CODE | |
| LOW | swift/template/base.py | 80 | CODE | |
| LOW | swift/template/base.py | 2009 | CODE | |
| LOW | swift/template/templates/llava.py | 132 | CODE | |
| LOW | swift/utils/torch_utils.py | 312 | CODE | |
| LOW | swift/tuners/lora_layers.py | 542 | CODE | |
| LOW | swift/optimizers/muonclip.py | 192 | CODE | |
| LOW | swift/optimizers/galore/adamw8bit.py | 11 | CODE | |
| LOW | swift/optimizers/galore/adafactor.py | 96 | CODE | |
| LOW | swift/sequence_parallel/ulysses.py | 71 | CODE | |
| LOW | swift/sequence_parallel/ulysses.py | 41 | CODE | |
| LOW | swift/sequence_parallel/ulysses.py | 88 | CODE | |
| LOW | swift/sequence_parallel/zigzag_ring_attn.py | 682 | CODE | |
| LOW | swift/model/register.py | 516 | CODE | |
| LOW | swift/model/register.py | 633 | CODE | |
| LOW | swift/model/register.py | 163 | CODE | |
| LOW | swift/model/model_meta.py | 244 | CODE | |
| LOW | swift/model/model_meta.py | 247 | CODE | |
| LOW | swift/model/models/mllm.py | 234 | CODE | |
| LOW | swift/model/models/qwen.py | 989 | CODE | |
| LOW | swift/model/models/qwen.py | 1545 | CODE | |
| LOW | swift/model/models/qwen.py | 1781 | CODE | |
| LOW | swift/model/models/baichuan.py | 56 | CODE | |
| LOW | swift/model/models/gemma.py | 235 | CODE | |
| LOW | swift/infer_engine/vllm_engine.py | 123 | CODE | |
| LOW | swift/infer_engine/sglang_engine.py | 29 | CODE | |
| LOW | swift/infer_engine/lmdeploy_engine.py | 40 | CODE | |
| LOW | swift/infer_engine/lmdeploy_engine.py | 189 | CODE | |
| LOW | swift/infer_engine/transformers_engine.py | 52 | CODE | |
| LOW | swift/ray/megatron/rollout/ray_vllm_engine.py | 27 | CODE | |
| LOW | swift/ray/megatron/rollout/vllm_server.py | 82 | CODE | |
| LOW | swift/megatron/utils/convert_utils.py | 189 | CODE | |
| LOW | swift/megatron/model/utils.py | 108 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | swift/callbacks/activation_cpu_offload.py | 593 | # Check if model is wrapped with FSDP | COMMENT |
| LOW | swift/callbacks/activation_cpu_offload.py | 597 | # Check if fsdp_config is a dictionary and has activation_cpu_offload enabled | COMMENT |
| LOW | swift/callbacks/lisa.py | 43 | # Check if it's time to switch active layers, including at step 0 | COMMENT |
| LOW | swift/rlhf_trainers/utils.py | 1026 | # Check if already patched (idempotent). On NPU/vLLM-Ascend, sleep/wake | COMMENT |
| LOW | swift/rlhf_trainers/utils.py | 1060 | # Check if inner_model has layers attribute | COMMENT |
| LOW | swift/rlhf_trainers/grpo_trainer.py | 2157 | # Set max_length to None to disable truncation, as the input length has already been truncated earlier. | COMMENT |
| LOW | swift/pipelines/eval/utils.py | 168 | # Check if we've reached the desired batch size | COMMENT |
| LOW | swift/trainers/mixin.py | 453 | # Check if we should delete older checkpoint(s) | COMMENT |
| LOW | swift/trainers/reranker_trainer.py | 18 | # Check if we have a custom loss function | COMMENT |
| LOW | swift/rollout/multi_turn.py | 337 | # Check if the number of logprobs matches the number of loss_mask=1 tokens | COMMENT |
| LOW | swift/infer_engine/utils.py | 533 | # Check if we have a cached last_output from the previous iteration. | COMMENT |
| LOW | swift/infer_engine/utils.py | 600 | # Check if need to run the usual non-async path | COMMENT |
| LOW⚡ | swift/hub/hub.py | 351 | # Write the file if it has changed | COMMENT |
| LOW | swift/arguments/rlhf_args.py | 641 | # Check if teacher_deepspeed is a predefined name | COMMENT |
| LOW | swift/megatron/utils/megatron_lm_utils.py | 541 | # Set bucket_size to infinity if overlap_grad_reduce is False. | COMMENT |
| LOW | swift/agent_template/minimax_m2.py | 72 | # Check if using react format | COMMENT |
| LOW⚡ | examples/train/grpo/plugin/plugin.py | 68 | # Check if all numbers are used exactly once | COMMENT |
| LOW⚡ | examples/train/grpo/plugin/plugin.py | 80 | # Check if the equation is correct and matches the ground truth | COMMENT |
| LOW | examples/train/grpo/plugin/plugin.py | 56 | # Check if the format is correct | COMMENT |
| LOW | examples/train/grpo/plugin/openenv/sudoku_scheduler.py | 301 | # Check if env says invalid | COMMENT |
| LOW | examples/train/grpo/plugin/openenv/sudoku_scheduler.py | 306 | # Check if move targets an empty cell | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| CRITICAL⚡ | swift/template/templates/deepseek.py | 471 | self.model.model.image_newline.data = self.model.model.image_newline.data.to(vision_device) | CODE |
| CRITICAL⚡ | swift/template/templates/deepseek.py | 472 | self.model.model.view_seperator.data = self.model.model.view_seperator.data.to(vision_device) | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | swift/rlhf_trainers/rollout_mixin.py | 198 | def _setup_teacher(self) -> None: | CODE |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 1523 | def set_default_max_tokens(_self, request_config: RequestConfig, inputs: Dict[str, Any]) -> None: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1621 | def set_expandable_segments(enable: bool) -> None: | CODE |
| LOW | swift/rlhf_trainers/vllm_client.py | 38 | logger = logging.getLogger(__name__) | CODE |
| LOW⚡ | swift/template/base.py | 1622 | def set_mode(self, mode: Literal['transformers', 'vllm', 'lmdeploy', 'sglang', 'train', 'rlhf', 'kto']) -> None: | CODE |
| LOW | swift/pipelines/infer/deploy.py | 167 | def _set_request_config(self, request_config) -> None: | CODE |
| LOW | swift/pipelines/infer/rollout.py | 171 | def update_named_param(self, name: str, dtype: str, shape: Sequence[int]) -> None: | CODE |
| LOW | swift/pipelines/infer/rollout.py | 203 | def update_adapter_flattened_param(self, peft_config: Dict, metadatas: list[Dict]) -> None: | CODE |
| LOW | swift/pipelines/infer/rollout.py | 232 | def update_adapter_param(self, peft_config: Dict, lora_tensors_metadata: list[Dict]) -> None: | CODE |
| LOW | swift/pipelines/infer/rollout.py | 271 | def update_flattened_params(self, metadatas: list[Dict]) -> None: | CODE |
| LOW | swift/sequence_parallel/utils.py | 148 | def set_epoch(self, epoch: int) -> None: | CODE |
| LOW | swift/model/npu_patcher.py | 8 | __all__ = ['NPUCastError', 'apply_all_patches', 'patch_mindspeed_te_cp_implementation'] | CODE |
| LOW | swift/model/npu_patch/vllm_ascend_memory.py | 88 | __all__ = [ | CODE |
| LOW | swift/model/npu_patch/vllm_ascend.py | 58 | __all__ = [ | CODE |
| LOW | swift/model/npu_patch/__init__.py | 49 | __all__ = ['NPUCastError', 'apply_all_patches', 'patch_mindspeed_te_cp_implementation'] | CODE |
| LOW | swift/model/npu_patch/megatron_checkpoint.py | 209 | __all__ = ['load_optimizer_state_dict', 'optimizer_sharded_state_dict'] | CODE |
| LOW | swift/model/npu_patch/vllm_ascend_moe.py | 385 | __all__ = [ | CODE |
| LOW | swift/infer_engine/infer_engine.py | 210 | def set_default_max_tokens(self, request_config: RequestConfig, inputs: Dict[str, Any]) -> None: | CODE |
| LOW | swift/ray/megatron/base_trainer.py | 42 | def set_data_info(self, data_info: Dict[str, Any]) -> None: | CODE |
| LOW | swift/ray/megatron/rollout/adapter.py | 11 | logger = logging.getLogger(__name__) | CODE |
| LOW | swift/ray/megatron/checkpoint_engine/__init__.py | 8 | __all__ = [ | CODE |
| LOW | swift/megatron/trainers/rollout_mixin.py | 159 | def _setup_teacher(self) -> None: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH⚡ | swift/rlhf_trainers/gkd_loss.py | 81 | """KL(target || input), returns per-position scalar [N].""" | STRING |
| HIGH | swift/rlhf_trainers/grpo_trainer.py | 2357 | - kl: Direct KL divergence estimator KL(π_rollout || π_training) | STRING |
| HIGH⚡ | swift/hub/hub.py | 357 | repo.push(commit_message) | CODE |
| HIGH | swift/megatron/trainers/vocab_parallel_utils.py | 108 | KL(target || input) = sum(target_prob * (target_log_prob - input_log_prob)) | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | docs/source/Instruction/GRPO/DeveloperGuide/gym_env.md | 358 | - https://github.com/alibaba/ROLL/tree/main/roll/pipeline/agentic/env/frozen_lake | CODE |
| MEDIUM | docs/source_en/Instruction/Evaluation.md | 165 | ├── example_dev.csv # (Optional) The filename should follow the format `{subset_name}_dev.csv` for few-shot evaluation | CODE |
| MEDIUM | …cs/source_en/Instruction/GRPO/AdvancedResearch/FIPO.md | 5 | [FIPO](https://arxiv.org/abs/2603.19835) is a value-free RL method for eliciting longer and deeper reasoning. It keeps t | CODE |
| MEDIUM | …s/source_en/Instruction/GRPO/DeveloperGuide/gym_env.md | 205 | - https://github.com/alibaba/ROLL/tree/main/roll/pipeline/agentic/env/frozen_lake | CODE |
| MEDIUM | swift/template/templates/llm.py | 345 | # reasoning_effort: "no_think", "low", "high" (deep chain-of-thought) | COMMENT |
| MEDIUM | swift/sequence_parallel/zigzag_ring_attn.py | 691 | window_size=(-1, -1), # -1 means infinite context window | CODE |
| MEDIUM | examples/megatron/grpo/multi_turn/frozen_lake_plugin.py | 12 | # code borrowed from ROLL/roll/pipeline/agentic/env/frozen_lake | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | examples/megatron/fp8/vlm.sh | 2 | # In this example, FP8 training does not provide any speedup. | COMMENT |
| HIGH | examples/megatron/fp8/llm.sh | 3 | # In this example, FP8 training does not provide any speedup. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | swift/model/models/qwen.py | 1675 | loss.device) # make sure to reside in the same device | CODE |
| MEDIUM | examples/train/multi-gpu/fsdp2_lora/train.sh | 2 | # NOTE: for swift>=3.12, you can use --fsdp fsdp2 instead of accelerate launch | COMMENT |
| MEDIUM | examples/train/multi-gpu/fsdp_qlora/train.sh | 2 | # NOTE: for swift>=3.12, you can use --fsdp fsdp2 instead of accelerate launch | COMMENT |
| MEDIUM | examples/megatron/fp8/lora.sh | 3 | # However, you can use BF16 weights to perform Merge-LoRA. | COMMENT |
| MEDIUM | examples/megatron/fp8/lora.sh | 64 | # Alternatively, you can use BF16 base model + BF16 LoRA for inference | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | docs/source/Instruction/Sample.md | 80 | OPENAI_API_KEY="your_api_key" \ | CODE |
| HIGH | docs/source_en/Instruction/Sample.md | 84 | OPENAI_API_KEY="your_api_key" \ | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 20 | # In testing, just return the tensor as-is | COMMENT |
| MEDIUM⚡ | swift/template/templates/minicpm.py | 498 | # This is more robust than finding consecutive <unk> tokens, especially | COMMENT |
| LOW | examples/megatron/export/lora.sh | 3 | # simply set `--merge_lora true` | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | …s/source_en/BestPractices/GRPO-Multi-Modal-Training.md | 278 | This task is based on the experiments in [open-r1-multimodal](https://github.com/EvolvingLMMs-Lab/open-r1-multimodal.git | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | swift/callbacks/activation_cpu_offload.py | 480 | def my_function(*inputs): | CODE |