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 15,398 GitHub stars. SynthScan v2.0 examined 183,374 lines of code across 1333 source files, recording 2545 pattern matches distributed across 23 syntactic categories. The overall adjusted score of 15.9 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 2545 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 | 52 | 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/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 | |
| LOW | swift/__init__.py | 20 | CODE | |
| 895 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_dataset_source.py | 11 | def test_dataset_syntax_parses_explicit_hub_prefixes(self): | CODE |
| LOW | tests/general/test_dataset_source.py | 15 | def test_explicit_ms_source_overrides_global_hf_default(self): | CODE |
| LOW | tests/general/test_qwen3_5_fp32_weights.py | 219 | def test_serializes_overlapping_policy_contexts(self): | CODE |
| LOW | tests/general/test_moss_vl.py | 48 | def test_template_state_and_unsupported_modes(self): | CODE |
| LOW | tests/general/test_moss_vl.py | 64 | def test_video_pixel_limits_are_routed_to_video_processor(self): | CODE |
| LOW | tests/general/test_moss_vl.py | 104 | def test_video_environment_limits_are_supported(self): | CODE |
| LOW | tests/general/test_moss_vl.py | 137 | def test_truncation_preserves_media_contract(self): | CODE |
| LOW | tests/general/test_moss_vl.py | 163 | def test_cross_attention_masks_are_padded(self): | CODE |
| LOW | tests/general/test_moss_vl.py | 195 | def test_inference_cross_attention_masks_are_left_padded(self): | CODE |
| LOW | tests/general/test_moss_vl.py | 228 | def test_media_metadata_is_collated(self): | CODE |
| LOW | tests/general/test_moss_vl.py | 253 | def test_mixed_media_and_text_only_batch_contract(self): | CODE |
| LOW | tests/general/test_moss_vl.py | 299 | def test_non_module_aligner_parameter_is_not_scanned_for_lora(self): | CODE |
| LOW | tests/general/test_moss_vl.py | 314 | def test_bare_aligner_parameter_name_is_matched(self): | CODE |
| LOW | tests/general/test_moss_vl.py | 322 | def test_separator_token_bc_property(self): | CODE |
| LOW | tests/general/test_minicpmo_template.py | 37 | def test_vllm_data_uri_video_uses_temporary_file(self): | CODE |
| LOW | tests/general/test_minicpmo_template.py | 42 | def get_video_frame_audio_segments(video_path, *, use_audio, stack_frames): | CODE |
| LOW | tests/general/test_minicpmo_template.py | 64 | def test_vllm_multiple_videos_are_not_skipped(self): | CODE |
| LOW | tests/general/test_minicpmo_template.py | 67 | def get_video_frame_audio_segments(video_path, **kwargs): | CODE |
| LOW | tests/general/test_minicpmo_template.py | 83 | def test_transformers_preserves_source_video(self): | CODE |
| LOW | tests/general/test_minicpmo_template.py | 86 | def get_video_frame_audio_segments(video_path, **kwargs): | CODE |
| LOW | tests/general/test_minicpmo_template.py | 98 | def test_lmdeploy_consumes_source_video(self): | CODE |
| LOW | tests/general/test_minicpmo_template.py | 101 | def get_video_frame_audio_segments(video_path, **kwargs): | CODE |
| LOW | tests/general/test_minicpmo_template.py | 115 | def test_audio_placeholder_matches_backend(self): | CODE |
| LOW | tests/general/test_minicpmo_template.py | 128 | def test_data_uri_video_cleans_up_temporary_file_on_error(self): | CODE |
| LOW | tests/general/test_minicpmo_template.py | 132 | def get_video_frame_audio_segments(video_path, **kwargs): | CODE |
| LOW | tests/general/test_minicpmo_template.py | 146 | def test_local_video_path_preserves_local_file(self): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 105 | def make_inputs_require_grads(module, args, output): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 111 | def _stashed_deepspeed_initialize(*args, **kwargs): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 118 | def test_default_keeps_platform_default_when_nothing_initialized(self): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 128 | def test_default_switches_to_spawn_when_cuda_initialized(self): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 134 | def test_default_switches_to_spawn_when_dist_initialized(self): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 141 | def test_cuda_probe_exception_is_swallowed(self): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 149 | def test_explicit_spawn_is_respected(self): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 153 | def test_explicit_forkserver_is_respected(self): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 157 | def test_explicit_fork_is_respected(self): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 165 | def test_model_and_dummy_are_dropped_other_attrs_kept(self): | CODE |
| LOW | tests/general/test_packing_multiprocessing_context.py | 176 | def test_hook_bookkeeping_is_dropped_so_no_model_is_reachable(self): | CODE |
| LOW | tests/general/test_packing_multiprocessing_context.py | 193 | def test_the_live_template_keeps_its_hooks(self): | CODE |
| LOW | tests/general/test_packing_multiprocessing_context.py | 208 | def test_stashed_deepspeed_initialize_is_dropped(self): | CODE |
| LOW | tests/general/test_packing_multiprocessing_context.py | 230 | def test_spawn_workers_starts_all(self): | CODE |
| LOW | tests/general/test_packing_multiprocessing_context.py | 237 | def test_spawn_workers_reraises_on_start_failure(self): | CODE |
| LOW | tests/general/test_packing_multiprocessing_context.py | 335 | def test_unpicklable_template_raises_under_spawn(self): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 352 | def test_not_injected_by_default(self): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 355 | def test_not_injected_when_no_workers(self): | CODE |
| LOW⚡ | tests/general/test_packing_multiprocessing_context.py | 358 | def test_injected_when_set_with_workers(self): | CODE |
| LOW | tests/general/test_gemma3_template.py | 10 | def test_text_only_encode_has_token_type_ids(self): | CODE |
| LOW | tests/general/test_moss_vl_align.py | 51 | def _assert_processor_outputs_equal(reference, encoded): | CODE |
| LOW⚡ | tests/general/test_sampler_engine_kwargs.py | 10 | def test_engine_kwargs_torch_dtype_no_crash(): | CODE |
| LOW⚡ | tests/general/test_sampler_engine_kwargs.py | 19 | def test_engine_kwargs_passthrough(): | CODE |
| LOW⚡ | tests/general/test_sampler_engine_kwargs.py | 25 | def test_duplicate_torch_dtype_would_raise(): | CODE |
| LOW | tests/general/test_optional_template_dependencies.py | 9 | def test_template_import_without_qwen_vl_utils(self): | CODE |
| LOW | tests/general/test_optional_template_dependencies.py | 16 | def import_without_qwen_vl_utils(name, *args, **kwargs): | 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 | 55 | def test_truncation_max_length(self): | CODE |
| 610 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_qwen3_5_fp32_weights.py | 24 | CODE | |
| LOW | tests/general/test_qwen3_5_fp32_weights.py | 219 | CODE | |
| LOW | tests/general/test_qwen3_5_fp32_weights.py | 291 | CODE | |
| LOW | tests/general/test_arch.py | 1 | CODE | |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 49 | CODE | |
| LOW | tests/test_align/test_rlhf_loss.py | 229 | CODE | |
| LOW | tests/test_align/test_rlhf_loss.py | 256 | CODE | |
| LOW | tests/megatron/test_muon_lr.py | 365 | 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 | 590 | CODE | |
| LOW | swift/dataset/dataset_meta.py | 120 | CODE | |
| LOW | swift/dataset/packing.py | 90 | 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 | 175 | CODE | |
| LOW | swift/dataset/preprocessor/core.py | 498 | CODE | |
| 292 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 | 1816 | # ============================================================================ | COMMENT |
| MEDIUM⚡ | swift/rlhf_trainers/utils.py | 1818 | # ============================================================================ | COMMENT |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 471 | # -------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 473 | # -------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 506 | # -------------------------------------------------- | COMMENT |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 508 | # -------------------------------------------------- | COMMENT |
| MEDIUM | swift/pipelines/infer/rollout.py | 315 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM | swift/pipelines/infer/rollout.py | 317 | # ------------------------------------------------------------------ | COMMENT |
| MEDIUM | swift/pipelines/infer/rollout.py | 437 | # ── Step 1: receive + rebuild IPC handle (with reuse) ──────── | COMMENT |
| MEDIUM | swift/pipelines/infer/rollout.py | 475 | # ── 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 | 210 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM⚡ | swift/model/npu_patch/model.py | 212 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM⚡ | swift/model/npu_patch/model.py | 220 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM⚡ | swift/model/npu_patch/model.py | 222 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/model/npu_patch/model.py | 19 | # --------------------------------------------------------------------------- | COMMENT |
| MEDIUM | swift/model/npu_patch/model.py | 21 | # --------------------------------------------------------------------------- | COMMENT |
| 25 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 | 387 | except Exception: | CODE |
| LOW | tests/megatron/test_ray_gkd.py | 400 | except Exception as e: # noqa | CODE |
| LOW | tests/megatron/test_muon_lr.py | 16 | except Exception as e: | CODE |
| LOW | tests/megatron/test_checkpoint_symlink.py | 14 | except Exception as e: | 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 | 28 | except Exception: | CODE |
| LOW | swift/dataset/packing.py | 232 | 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 | 197 | 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 | 1622 | def infer_task(): | CODE |
| MEDIUM | swift/rlhf_trainers/rollout_mixin.py | 1632 | def done(future): | CODE |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 1626 | except Exception as e: | CODE |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 1636 | except Exception as e: | CODE |
| LOW | swift/rlhf_trainers/reward_trainer.py | 102 | except Exception as e: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1105 | except Exception: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1139 | except Exception: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1153 | except Exception as e: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1191 | except Exception: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1212 | except Exception: | CODE |
| 158 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_8-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_8-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 | 535 | Split model parameters into batches for synchronized weight transfer. This method divides model parameters into | STRING |
| HIGH | swift/rlhf_trainers/rollout_mixin.py | 1773 | 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 | 21 | 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 | 29 | 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/register.py | 555 | 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 | 1285 | 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 | 1902 | # Create a copy to avoid modifying the original table used by other loggers. | COMMENT |
| MEDIUM | swift/template/base.py | 527 | # This function is only used to handle scenarios where the model needs | COMMENT |
| MEDIUM⚡ | swift/template/base.py | 1685 | """This function is important for multi-modal training, as it registers the post_encode method | STRING |
| MEDIUM | swift/pipelines/train/tuner.py | 155 | """This function is only useful on the vera tuner""" | STRING |
| MEDIUM | swift/pipelines/infer/rollout.py | 147 | # 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 | 881 | if __name__ == '__main__': | COMMENT |
| LOW | tests/test_align/test_template/test_agent.py | 901 | # test_deepseek_v3_1() | COMMENT |
| LOW | tests/test_align/test_template/test_llm.py | 781 | if __name__ == '__main__': | COMMENT |
| LOW | tests/test_align/test_template/test_llm.py | 801 | # test_skywork_o1() | COMMENT |
| LOW | tests/test_align/test_template/test_llm.py | 821 | # test_minicpm() | COMMENT |
| LOW | tests/test_align/test_template/test_video.py | 401 | logger = get_logger() | COMMENT |
| LOW | …sts/test_align/test_template/test_deepseek_v4_flash.py | 1 | import os | COMMENT |
| LOW | tests/test_align/test_template/test_vision.py | 1321 | COMMENT | |
| LOW | tests/test_align/test_template/test_vision.py | 1341 | # test_deepseek_janus() | COMMENT |
| LOW | tests/test_align/test_template/test_vision.py | 1361 | # test_mplug_owl3() | COMMENT |
| LOW | tests/test_align/test_template/test_vision.py | 1381 | # test_gemma3n() | COMMENT |
| LOW | tests/test_align/test_template/test_vision.py | 1401 | # test_sensenova_si() | 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/rlhf_trainers/grpo_trainer.py | 2501 | # log_ppl_diff = mean_log_prob_rollout - mean_log_prob_training | COMMENT |
| LOW | swift/pipelines/infer/rollout.py | 321 | # NCCL broadcast hop of ``update_flattened_params`` and reuses the | 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 | 194 | '### Step 1: Recall the formula\n\n' | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 196 | '### Step 2: Use the given terms\n\n' | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 201 | '### 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 | 451 | # Step 1: Base encode — produces input_ids with -100 for images | COMMENT |
| LOW | swift/template/templates/minicpm.py | 465 | # Step 2: Process images — replace -100 tokens with image placeholders | COMMENT |
| LOW | swift/template/templates/minicpm.py | 479 | # Step 3: Process audios — expand audio_start/audio_end pairs with <unk> tokens | COMMENT |
| LOW⚡ | swift/template/templates/minicpm.py | 517 | # Step 4: Compute image_bound using start/end token boundaries | COMMENT |
| LOW | swift/template/templates/minicpm.py | 542 | # Step 5: Compute audio_bounds | COMMENT |
| LOW⚡ | swift/sequence_parallel/sequence_parallel.py | 435 | # Step 1: Gather from all sequence parallel ranks | COMMENT |
| LOW⚡ | swift/sequence_parallel/sequence_parallel.py | 443 | # 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 | 308 | # Step 2: Compute KL from logps if kl_in_reward is enabled | COMMENT |
| LOW⚡ | swift/megatron/trainers/grpo_trainer.py | 313 | # Step 3: Compute the per-sequence base advantage (with ref-KL penalty if kl_in_reward). | COMMENT |
| LOW⚡ | swift/megatron/trainers/grpo_trainer.py | 317 | # Step 4: Write the advantage onto each batch, expanding the per-sequence base advantage to | COMMENT |
| LOW | swift/megatron/trainers/grpo_trainer.py | 279 | # Step 1: Encode batches and compute logps first (unified flow like GRPOTrainer) | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | tests/utils/test_rewards.py | 194 | '### Step 1: Recall the formula\n\n' | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 196 | '### Step 2: Use the given terms\n\n' | CODE |
| LOW⚡ | tests/utils/test_rewards.py | 201 | '### 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 | 451 | # Step 1: Base encode — produces input_ids with -100 for images | COMMENT |
| LOW | swift/template/templates/minicpm.py | 465 | # Step 2: Process images — replace -100 tokens with image placeholders | COMMENT |
| LOW | swift/template/templates/minicpm.py | 479 | # Step 3: Process audios — expand audio_start/audio_end pairs with <unk> tokens | COMMENT |
| LOW⚡ | swift/template/templates/minicpm.py | 517 | # Step 4: Compute image_bound using start/end token boundaries | COMMENT |
| LOW | swift/template/templates/minicpm.py | 542 | # Step 5: Compute audio_bounds | COMMENT |
| LOW⚡ | swift/sequence_parallel/sequence_parallel.py | 435 | # Step 1: Gather from all sequence parallel ranks | COMMENT |
| LOW⚡ | swift/sequence_parallel/sequence_parallel.py | 443 | # 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 | 308 | # Step 2: Compute KL from logps if kl_in_reward is enabled | COMMENT |
| LOW⚡ | swift/megatron/trainers/grpo_trainer.py | 313 | # Step 3: Compute the per-sequence base advantage (with ref-KL penalty if kl_in_reward). | COMMENT |
| LOW⚡ | swift/megatron/trainers/grpo_trainer.py | 317 | # Step 4: Write the advantage onto each batch, expanding the per-sequence base advantage to | COMMENT |
| LOW | swift/megatron/trainers/grpo_trainer.py | 279 | # 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 | 77 | 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 | 440 | CODE | |
| LOW | swift/template/register.py | 55 | CODE | |
| LOW | swift/template/base.py | 80 | CODE | |
| LOW | swift/template/base.py | 2065 | 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 | 193 | 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 | 527 | CODE | |
| LOW | swift/model/register.py | 644 | CODE | |
| LOW | swift/model/register.py | 163 | CODE | |
| LOW | swift/model/model_meta.py | 247 | CODE | |
| LOW | swift/model/model_meta.py | 250 | CODE | |
| LOW | swift/model/models/mllm.py | 235 | CODE | |
| LOW | swift/model/models/qwen.py | 1026 | CODE | |
| LOW | swift/model/models/qwen.py | 1869 | CODE | |
| LOW | swift/model/models/qwen.py | 2105 | 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 | 41 | CODE | |
| LOW | swift/infer_engine/lmdeploy_engine.py | 190 | 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 | 596 | # Check if model is wrapped with FSDP | COMMENT |
| LOW | swift/callbacks/activation_cpu_offload.py | 600 | # 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 | 1028 | # Check if already patched (idempotent). On NPU/vLLM-Ascend, sleep/wake | COMMENT |
| LOW | swift/rlhf_trainers/utils.py | 1062 | # Check if inner_model has layers attribute | COMMENT |
| LOW | swift/rlhf_trainers/grpo_trainer.py | 2234 | # 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 | 461 | # 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 | 738 | # Check if teacher_deepspeed is a predefined name | COMMENT |
| LOW | swift/megatron/utils/megatron_lm_utils.py | 577 | # 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 | 303 | # Check if env says invalid | COMMENT |
| LOW | examples/train/grpo/plugin/openenv/sudoku_scheduler.py | 308 | # Check if move targets an empty cell | COMMENT |
| 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 | 1572 | def set_default_max_tokens(_self, request_config: RequestConfig, inputs: Dict[str, Any]) -> None: | CODE |
| LOW | swift/rlhf_trainers/utils.py | 1642 | 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 | 1678 | def set_mode(self, mode: Literal['transformers', 'vllm', 'lmdeploy', 'sglang', 'train', 'rlhf', 'kto']) -> None: | CODE |
| LOW | swift/pipelines/infer/deploy.py | 168 | def _set_request_config(self, request_config) -> None: | CODE |
| LOW | swift/pipelines/infer/rollout.py | 168 | def update_named_param(self, name: str, dtype: str, shape: Sequence[int]) -> None: | CODE |
| LOW | swift/pipelines/infer/rollout.py | 200 | def update_adapter_flattened_param(self, peft_config: Dict, metadatas: list[Dict]) -> None: | CODE |
| LOW | swift/pipelines/infer/rollout.py | 229 | def update_adapter_param(self, peft_config: Dict, lora_tensors_metadata: list[Dict]) -> None: | CODE |
| LOW | swift/pipelines/infer/rollout.py | 268 | 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', 'apply_mindspeed_patches', 'patch_mindspeed_fla_gdn_implementation'] | CODE |
| LOW | swift/model/npu_patch/vllm_ascend_memory.py | 88 | __all__ = [ | CODE |
| LOW | swift/model/npu_patch/vllm_ascend.py | 93 | __all__ = [ | CODE |
| LOW | swift/model/npu_patch/__init__.py | 49 | __all__ = ['NPUCastError', 'apply_all_patches', 'apply_mindspeed_patches', 'patch_mindspeed_fla_gdn_implementation'] | CODE |
| LOW | swift/model/npu_patch/megatron_checkpoint.py | 220 | __all__ = ['load_optimizer_state_dict', 'optimizer_sharded_state_dict'] | CODE |
| LOW | swift/model/npu_patch/vllm_ascend_moe.py | 455 | __all__ = [ | CODE |
| LOW | swift/model/npu_patch/vllm_ascend_lora.py | 226 | __all__ = [ | CODE |
| LOW | swift/infer_engine/infer_engine.py | 204 | 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 | 180 | 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 | 2434 | - 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 | 1999 | 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 | 518 | # 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 |
|---|---|---|---|---|
| MEDIUM | tests/infer/test_infer_engine.py | 24 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | swift/callbacks/activation_cpu_offload.py | 480 | def my_function(*inputs): | CODE |