Repository Analysis

modelscope/ms-swift

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).

15.9 Moderate AI signal View on GitHub

Analysis Overview

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).

15.9
Adjusted Score
15.9
Raw Score
100%
Time Factor
2026-08-28
Last Push
15.4K
Stars
Python
Language
183.4K
Lines of Code
1.3K
Files
2.5K
Pattern Hits
2026-08-29
Scan Date
0.03
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

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

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 0HIGH 43MEDIUM 148LOW 2354

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 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.

Unused Imports955 hits · 822 pts
SeverityFileLineSnippetContext
LOWsetup.py7CODE
LOWtests/run.py37CODE
LOWtests/llm/test_template.py52CODE
LOWtests/models/test_mllm.py8CODE
LOWtests/models/test_mllm.py8CODE
LOWtests/train/test_resume_from_checkpoint.py29CODE
LOWtests/train/test_resume_from_checkpoint.py29CODE
LOWtests/train/test_freeze.py18CODE
LOWtests/train/test_freeze.py18CODE
LOWtests/train/test_freeze.py36CODE
LOWtests/train/test_freeze.py36CODE
LOWtests/train/test_freeze.py54CODE
LOWtests/train/test_freeze.py54CODE
LOWtests/train/test_freeze.py72CODE
LOWtests/train/test_freeze.py72CODE
LOWtests/test_align/test_padding_side.py51CODE
LOWtests/megatron/test_megatron_args.py22CODE
LOWtests/megatron/test_megatron_args.py22CODE
LOWswift/__init__.py7CODE
LOWswift/__init__.py7CODE
LOWswift/__init__.py8CODE
LOWswift/__init__.py8CODE
LOWswift/__init__.py8CODE
LOWswift/__init__.py8CODE
LOWswift/__init__.py8CODE
LOWswift/__init__.py8CODE
LOWswift/__init__.py8CODE
LOWswift/__init__.py8CODE
LOWswift/__init__.py8CODE
LOWswift/__init__.py8CODE
LOWswift/__init__.py8CODE
LOWswift/__init__.py11CODE
LOWswift/__init__.py11CODE
LOWswift/__init__.py12CODE
LOWswift/__init__.py12CODE
LOWswift/__init__.py13CODE
LOWswift/__init__.py13CODE
LOWswift/__init__.py13CODE
LOWswift/__init__.py13CODE
LOWswift/__init__.py13CODE
LOWswift/__init__.py13CODE
LOWswift/__init__.py13CODE
LOWswift/__init__.py13CODE
LOWswift/__init__.py13CODE
LOWswift/__init__.py13CODE
LOWswift/__init__.py15CODE
LOWswift/__init__.py15CODE
LOWswift/__init__.py16CODE
LOWswift/__init__.py16CODE
LOWswift/__init__.py16CODE
LOWswift/__init__.py16CODE
LOWswift/__init__.py16CODE
LOWswift/__init__.py17CODE
LOWswift/__init__.py17CODE
LOWswift/__init__.py17CODE
LOWswift/__init__.py18CODE
LOWswift/__init__.py18CODE
LOWswift/__init__.py19CODE
LOWswift/__init__.py19CODE
LOWswift/__init__.py20CODE
895 more matches not shown…
Hyper-Verbose Identifiers670 hits · 695 pts
SeverityFileLineSnippetContext
LOWtests/test_utils.py74def create_dummy_test_dataset(feat, label, num):CODE
LOWtests/run.py27def deduplicate_preserve_order(items):CODE
LOWtests/run.py31def get_available_npu_devices(visible_npus):CODE
LOWtests/run.py102def gather_test_suites_in_files(test_dir, case_file_list, list_tests):CODE
LOWtests/run.py157def async_run_command_with_popen(cmd, device_id):CODE
LOWtests/run.py347def run_non_parallelizable_test_suites(suites, result_dir):CODE
LOWtests/general/test_dataset_source.py11 def test_dataset_syntax_parses_explicit_hub_prefixes(self):CODE
LOWtests/general/test_dataset_source.py15 def test_explicit_ms_source_overrides_global_hf_default(self):CODE
LOWtests/general/test_qwen3_5_fp32_weights.py219 def test_serializes_overlapping_policy_contexts(self):CODE
LOWtests/general/test_moss_vl.py48 def test_template_state_and_unsupported_modes(self):CODE
LOWtests/general/test_moss_vl.py64 def test_video_pixel_limits_are_routed_to_video_processor(self):CODE
LOWtests/general/test_moss_vl.py104 def test_video_environment_limits_are_supported(self):CODE
LOWtests/general/test_moss_vl.py137 def test_truncation_preserves_media_contract(self):CODE
LOWtests/general/test_moss_vl.py163 def test_cross_attention_masks_are_padded(self):CODE
LOWtests/general/test_moss_vl.py195 def test_inference_cross_attention_masks_are_left_padded(self):CODE
LOWtests/general/test_moss_vl.py228 def test_media_metadata_is_collated(self):CODE
LOWtests/general/test_moss_vl.py253 def test_mixed_media_and_text_only_batch_contract(self):CODE
LOWtests/general/test_moss_vl.py299 def test_non_module_aligner_parameter_is_not_scanned_for_lora(self):CODE
LOWtests/general/test_moss_vl.py314 def test_bare_aligner_parameter_name_is_matched(self):CODE
LOWtests/general/test_moss_vl.py322 def test_separator_token_bc_property(self):CODE
LOWtests/general/test_minicpmo_template.py37 def test_vllm_data_uri_video_uses_temporary_file(self):CODE
LOWtests/general/test_minicpmo_template.py42 def get_video_frame_audio_segments(video_path, *, use_audio, stack_frames):CODE
LOWtests/general/test_minicpmo_template.py64 def test_vllm_multiple_videos_are_not_skipped(self):CODE
LOWtests/general/test_minicpmo_template.py67 def get_video_frame_audio_segments(video_path, **kwargs):CODE
LOWtests/general/test_minicpmo_template.py83 def test_transformers_preserves_source_video(self):CODE
LOWtests/general/test_minicpmo_template.py86 def get_video_frame_audio_segments(video_path, **kwargs):CODE
LOWtests/general/test_minicpmo_template.py98 def test_lmdeploy_consumes_source_video(self):CODE
LOWtests/general/test_minicpmo_template.py101 def get_video_frame_audio_segments(video_path, **kwargs):CODE
LOWtests/general/test_minicpmo_template.py115 def test_audio_placeholder_matches_backend(self):CODE
LOWtests/general/test_minicpmo_template.py128 def test_data_uri_video_cleans_up_temporary_file_on_error(self):CODE
LOWtests/general/test_minicpmo_template.py132 def get_video_frame_audio_segments(video_path, **kwargs):CODE
LOWtests/general/test_minicpmo_template.py146 def test_local_video_path_preserves_local_file(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py105 def make_inputs_require_grads(module, args, output):CODE
LOWtests/general/test_packing_multiprocessing_context.py111def _stashed_deepspeed_initialize(*args, **kwargs):CODE
LOWtests/general/test_packing_multiprocessing_context.py118 def test_default_keeps_platform_default_when_nothing_initialized(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py128 def test_default_switches_to_spawn_when_cuda_initialized(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py134 def test_default_switches_to_spawn_when_dist_initialized(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py141 def test_cuda_probe_exception_is_swallowed(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py149 def test_explicit_spawn_is_respected(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py153 def test_explicit_forkserver_is_respected(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py157 def test_explicit_fork_is_respected(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py165 def test_model_and_dummy_are_dropped_other_attrs_kept(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py176 def test_hook_bookkeeping_is_dropped_so_no_model_is_reachable(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py193 def test_the_live_template_keeps_its_hooks(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py208 def test_stashed_deepspeed_initialize_is_dropped(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py230 def test_spawn_workers_starts_all(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py237 def test_spawn_workers_reraises_on_start_failure(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py335 def test_unpicklable_template_raises_under_spawn(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py352 def test_not_injected_by_default(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py355 def test_not_injected_when_no_workers(self):CODE
LOWtests/general/test_packing_multiprocessing_context.py358 def test_injected_when_set_with_workers(self):CODE
LOWtests/general/test_gemma3_template.py10 def test_text_only_encode_has_token_type_ids(self):CODE
LOWtests/general/test_moss_vl_align.py51def _assert_processor_outputs_equal(reference, encoded):CODE
LOWtests/general/test_sampler_engine_kwargs.py10def test_engine_kwargs_torch_dtype_no_crash():CODE
LOWtests/general/test_sampler_engine_kwargs.py19def test_engine_kwargs_passthrough():CODE
LOWtests/general/test_sampler_engine_kwargs.py25def test_duplicate_torch_dtype_would_raise():CODE
LOWtests/general/test_optional_template_dependencies.py9 def test_template_import_without_qwen_vl_utils(self):CODE
LOWtests/general/test_optional_template_dependencies.py16def import_without_qwen_vl_utils(name, *args, **kwargs):CODE
LOWtests/general/test_template_meta.py5def test_replace_system_preserves_non_string_elements():CODE
LOWtests/general/test_data_preprocess.py55 def test_truncation_max_length(self):CODE
610 more matches not shown…
Deep Nesting352 hits · 322 pts
SeverityFileLineSnippetContext
LOWsetup.py24CODE
LOWsetup.py44CODE
LOWsetup.py78CODE
LOWsetup.py96CODE
LOWtests/test_utils.py124CODE
LOWtests/run.py58CODE
LOWtests/run.py102CODE
LOWtests/run.py217CODE
LOWtests/run.py236CODE
LOWtests/run.py375CODE
LOWtests/run.py489CODE
LOWtests/general/test_qwen3_5_fp32_weights.py24CODE
LOWtests/general/test_qwen3_5_fp32_weights.py219CODE
LOWtests/general/test_qwen3_5_fp32_weights.py291CODE
LOWtests/general/test_arch.py1CODE
LOWtests/train/test_vllm_importance_sampling_basic.py49CODE
LOWtests/test_align/test_rlhf_loss.py229CODE
LOWtests/test_align/test_rlhf_loss.py256CODE
LOWtests/megatron/test_muon_lr.py365CODE
LOWswift/ui/base.py268CODE
LOWswift/ui/base.py314CODE
LOWswift/ui/llm_export/llm_export.py101CODE
LOWswift/ui/llm_grpo/llm_grpo.py216CODE
LOWswift/ui/llm_grpo/external_rollout.py145CODE
LOWswift/ui/llm_grpo/tuner.py18CODE
LOWswift/ui/llm_rlhf/llm_rlhf.py232CODE
LOWswift/ui/llm_rlhf/tuner.py18CODE
LOWswift/ui/llm_sample/llm_sample.py166CODE
LOWswift/ui/llm_eval/llm_eval.py104CODE
LOWswift/ui/llm_infer/runtime.py133CODE
LOWswift/ui/llm_infer/runtime.py265CODE
LOWswift/ui/llm_infer/llm_infer.py124CODE
LOWswift/ui/llm_infer/llm_infer.py189CODE
LOWswift/ui/llm_train/task.py64CODE
LOWswift/ui/llm_train/runtime.py295CODE
LOWswift/ui/llm_train/runtime.py374CODE
LOWswift/ui/llm_train/runtime.py407CODE
LOWswift/ui/llm_train/runtime.py542CODE
LOWswift/ui/llm_train/runtime.py600CODE
LOWswift/ui/llm_train/llm_train.py242CODE
LOWswift/ui/llm_train/llm_train.py325CODE
LOWswift/ui/llm_train/llm_train.py551CODE
LOWswift/ui/llm_train/optimizer.py121CODE
LOWswift/ui/llm_train/tuner.py290CODE
LOWswift/loss/embedding.py88CODE
LOWswift/loss/embedding.py115CODE
LOWswift/callbacks/activation_cpu_offload.py320CODE
LOWswift/callbacks/activation_cpu_offload.py590CODE
LOWswift/dataset/dataset_meta.py120CODE
LOWswift/dataset/packing.py90CODE
LOWswift/dataset/loader.py71CODE
LOWswift/dataset/dataset/mllm.py568CODE
LOWswift/dataset/dataset/mllm.py240CODE
LOWswift/dataset/dataset/mllm.py716CODE
LOWswift/dataset/dataset/mllm.py792CODE
LOWswift/dataset/dataset/mllm.py953CODE
LOWswift/dataset/dataset/mllm.py1234CODE
LOWswift/dataset/dataset/llm.py764CODE
LOWswift/dataset/preprocessor/core.py175CODE
LOWswift/dataset/preprocessor/core.py498CODE
292 more matches not shown…
Decorative Section Separators85 hits · 282 pts
SeverityFileLineSnippetContext
MEDIUMtests/utils/test_assemble_teacher_topk_logprobs.py10# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/utils/test_assemble_teacher_topk_logprobs.py12# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/utils/test_assemble_teacher_topk_logprobs.py30# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/utils/test_assemble_teacher_topk_logprobs.py32# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/utils/test_assemble_teacher_topk_logprobs.py76# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/utils/test_assemble_teacher_topk_logprobs.py78# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py41# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py43# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py196# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py198# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py229# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py231# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py262# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py264# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py295# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py297# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py361# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py363# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py457# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_align/test_mm_processor_align.py459# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/gkd_loss.py9# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/gkd_loss.py11# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/gkd_loss.py71# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/gkd_loss.py73# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/gkd_loss.py89# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/gkd_loss.py91# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/gkd_loss.py151# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/gkd_loss.py153# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/gkd_loss.py170# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/gkd_loss.py172# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/gkd_loss.py219# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/gkd_loss.py221# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/utils.py1816# ============================================================================COMMENT
MEDIUMswift/rlhf_trainers/utils.py1818# ============================================================================COMMENT
MEDIUMswift/rlhf_trainers/grpo_trainer.py471 # --------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/grpo_trainer.py473 # --------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/grpo_trainer.py506 # --------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/grpo_trainer.py508 # --------------------------------------------------COMMENT
MEDIUMswift/pipelines/infer/rollout.py315 # ------------------------------------------------------------------COMMENT
MEDIUMswift/pipelines/infer/rollout.py317 # ------------------------------------------------------------------COMMENT
MEDIUMswift/pipelines/infer/rollout.py437 # ── Step 1: receive + rebuild IPC handle (with reuse) ────────COMMENT
MEDIUMswift/pipelines/infer/rollout.py475 # ── Step 2: stream buckets and load_weights per bucket ──────COMMENT
MEDIUMswift/rollout/multi_turn.py755 # ------------------------------------------------------------------COMMENT
MEDIUMswift/rollout/multi_turn.py757 # ------------------------------------------------------------------COMMENT
MEDIUMswift/rollout/multi_turn.py807 # ------------------------------------------------------------------COMMENT
MEDIUMswift/rollout/multi_turn.py809 # ------------------------------------------------------------------COMMENT
MEDIUMswift/rollout/multi_turn.py819 # ------------------------------------------------------------------COMMENT
MEDIUMswift/rollout/multi_turn.py821 # ------------------------------------------------------------------COMMENT
MEDIUMswift/rollout/multi_turn.py33 # ------------------------------------------------------------------COMMENT
MEDIUMswift/rollout/multi_turn.py42 # ------------------------------------------------------------------COMMENT
MEDIUMswift/rollout/openenv_wrapper.py38 # ------------------------------------------------------------------COMMENT
MEDIUMswift/rollout/openenv_wrapper.py40 # ------------------------------------------------------------------COMMENT
MEDIUMswift/rollout/openenv_wrapper.py80 # ------------------------------------------------------------------COMMENT
MEDIUMswift/rollout/openenv_wrapper.py83 # ------------------------------------------------------------------COMMENT
MEDIUMswift/model/npu_patch/model.py210# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/model/npu_patch/model.py212# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/model/npu_patch/model.py220# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/model/npu_patch/model.py222# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/model/npu_patch/model.py19# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/model/npu_patch/model.py21# ---------------------------------------------------------------------------COMMENT
25 more matches not shown…
Excessive Try-Catch Wrapping218 hits · 245 pts
SeverityFileLineSnippetContext
LOWtests/run.py39 except Exception as e:CODE
LOWtests/run.py383 except Exception:CODE
LOWtests/model_tag.py66 except Exception as e:CODE
LOWtests/model_tag.py94 except Exception as e:CODE
LOWtests/model_tag.py115 except Exception as e:CODE
LOWtests/model_tag.py131 except Exception as e:CODE
MEDIUMtests/model_tag.py53def _post_request(self, url, param):CODE
MEDIUMtests/model_tag.py72def batch_commit_result(self):CODE
MEDIUMtests/model_tag.py100def batch_refresh_stage(self):CODE
MEDIUMtests/model_tag.py121def query_model_stage(self):CODE
LOWtests/general/test_arch.py18 except Exception:CODE
LOWtests/deploy/test_dataset.py12 except Exception:CODE
LOWtests/train/test_vllm_importance_sampling_basic.py477 except Exception as e:CODE
LOWtests/test_align/test_mm_processor_align.py560 except Exception:CODE
LOWtests/megatron/test_ray_gkd.py195 except Exception as e: # noqa: megatron-core not installed in this envCODE
LOWtests/megatron/test_ray_gkd.py387 except Exception:CODE
LOWtests/megatron/test_ray_gkd.py400 except Exception as e: # noqaCODE
LOWtests/megatron/test_muon_lr.py16except Exception as e:CODE
LOWtests/megatron/test_checkpoint_symlink.py14except Exception as e:CODE
LOWdocs/source/BestPractices/GRPO.md78 except Exception as e:STRING
LOWdocs/source/BestPractices/GRPO-Multi-Modal-Training.md79 except Exception:CODE
LOWdocs/source/BestPractices/GRPO-Multi-Modal-Training.md96 except Exception:CODE
LOW…source/Instruction/GRPO/DeveloperGuide/reward_model.md118 except Exception as e:STRING
LOWdocs/source_en/BestPractices/GRPO.md82 except Exception as e:STRING
LOW…s/source_en/BestPractices/GRPO-Multi-Modal-Training.md85 except Exception:CODE
LOW…s/source_en/BestPractices/GRPO-Multi-Modal-Training.md102 except Exception:CODE
LOW…rce_en/Instruction/GRPO/DeveloperGuide/reward_model.md117 except Exception as e:CODE
LOWswift/ui/base.py347 except Exception as e:CODE
LOWswift/ui/base.py368 except Exception:CODE
LOWswift/ui/llm_grpo/external_runtime.py135 except Exception as e:CODE
LOWswift/ui/llm_eval/eval.py103 except Exception as e:CODE
LOWswift/ui/llm_infer/runtime.py259 except Exception as e:CODE
LOWswift/ui/llm_train/runtime.py590 except Exception as e:CODE
LOWswift/ui/llm_train/llm_train.py406 except Exception as e:CODE
LOWswift/ui/llm_train/llm_train.py530 except Exception as err:CODE
LOWswift/dataset/utils.py95 except Exception as e:CODE
LOWswift/dataset/packing.py28 except Exception:CODE
LOWswift/dataset/packing.py232 except Exception as e:CODE
LOWswift/dataset/loader.py117 except Exception as e:CODE
LOWswift/dataset/dataset/mllm.py797 except Exception:CODE
LOWswift/dataset/preprocessor/core.py197 except Exception as e:CODE
LOWswift/rewards/prm.py90 except Exception:STRING
LOWswift/rewards/prm.py148 except Exception:STRING
LOWswift/rewards/orm.py114 except Exception:CODE
LOWswift/rewards/orm.py251 except Exception:CODE
LOWswift/rewards/orm.py258 except Exception:CODE
LOWswift/rewards/orm.py300 except Exception:CODE
LOWswift/rewards/orm.py374 except Exception:CODE
LOWswift/rewards/orm.py419 except Exception:CODE
LOWswift/rewards/rm_plugin.py224 except Exception as e:STRING
MEDIUMswift/rlhf_trainers/rollout_mixin.py1622def infer_task():CODE
MEDIUMswift/rlhf_trainers/rollout_mixin.py1632def done(future):CODE
LOWswift/rlhf_trainers/rollout_mixin.py1626 except Exception as e:CODE
LOWswift/rlhf_trainers/rollout_mixin.py1636 except Exception as e:CODE
LOWswift/rlhf_trainers/reward_trainer.py102 except Exception as e:CODE
LOWswift/rlhf_trainers/utils.py1105 except Exception:CODE
LOWswift/rlhf_trainers/utils.py1139 except Exception:CODE
LOWswift/rlhf_trainers/utils.py1153 except Exception as e:CODE
LOWswift/rlhf_trainers/utils.py1191 except Exception:CODE
LOWswift/rlhf_trainers/utils.py1212 except Exception:CODE
158 more matches not shown…
Cross-File Repetition20 hits · 100 pts
SeverityFileLineSnippetContext
HIGHtests/llm/test_custom.py0task: based on the given two sentences, provide a similarity score between 0.0 and 1.0. sentence 1: {text1} sentence 2: STRING
HIGHexamples/custom/dataset.py0task: based on the given two sentences, provide a similarity score between 0.0 and 1.0. sentence 1: {text1} sentence 2: STRING
HIGHswift/dataset/dataset/llm.py0task: based on the given two sentences, provide a similarity score between 0.0 and 1.0. sentence 1: {text1} sentence 2: STRING
HIGHdocs/source/BestPractices/GRPO.md0evaluates completions based on mathematical correctness of the answer args: completions (list[str]): generated outputs tSTRING
HIGHdocs/source_en/BestPractices/GRPO.md0evaluates completions based on mathematical correctness of the answer args: completions (list[str]): generated outputs tSTRING
HIGHexamples/train/grpo/plugin/plugin.py0evaluates completions based on mathematical correctness of the answer args: completions (list[str]): generated outputs tSTRING
HIGHdocs/source/BestPractices/GRPO-Multi-Modal-Training.md0reward function that checks if the completion is correct. args: completions (list[str]): generated outputs solution (lisSTRING
HIGH…s/source_en/BestPractices/GRPO-Multi-Modal-Training.md0reward function that checks if the completion is correct. args: completions (list[str]): generated outputs solution (lisSTRING
HIGHexamples/train/grpo/plugin/plugin.py0reward function that checks if the completion is correct. args: completions (list[str]): generated outputs solution (lisSTRING
HIGHdocs/source/BestPractices/AMD-support.md0you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}.STRING
HIGHdocs/source/BestPractices/Qwen3_8-Best-Practice.md0you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}.STRING
HIGHdocs/source_en/BestPractices/AMD-support.md0you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}.STRING
HIGHdocs/source_en/BestPractices/Qwen3_8-Best-Practice.md0you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}.STRING
HIGHexamples/models/qwen3_5/mcore_grpo_moe.sh0you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}.STRING
HIGHexamples/train/grpo/opd_rl.sh0you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}.STRING
HIGHexamples/train/grpo/plugin/gsm8k/gsm8k.sh0you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}.STRING
HIGHexamples/train/grpo/internal/fipo.sh0you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}.STRING
HIGHexamples/train/grpo/internal/real.sh0you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}.STRING
HIGHexamples/megatron/grpo/opd_rl.sh0you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}.STRING
HIGHexamples/megatron/grpo/real.sh0you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}.STRING
Docstring Block Structure14 hits · 70 pts
SeverityFileLineSnippetContext
HIGHdocs/README.md18Load data from json/yaml/pickle files. This method provides a unified api for loading data from serialized fileSTRING
HIGHswift/dataset/loader.py247Load and preprocess datasets. This function provides a unified interface to load datasets from various sources (HugSTRING
HIGHswift/rewards/rm_plugin.py123 Extract the reward score from the model's output. Args: model_output (str): The model's ouSTRING
HIGHswift/rlhf_trainers/rollout_mixin.py535Split model parameters into batches for synchronized weight transfer. This method divides model parameters intoSTRING
HIGHswift/rlhf_trainers/rollout_mixin.py1773 Attempt to encode each input using the template. If encoding fails, resample from a backup iterator untSTRING
HIGHswift/template/register.py81Get or create a template instance for model input/output formatting. This function retrieves the appropriate templaSTRING
HIGHswift/loss_scale/mapping.py21Factory function to create a loss scale object from a string specification. The loss_scale string supports the follSTRING
HIGHswift/utils/hub_utils.py29Download model snapshot safely with DDP context protection. This function attempts to download a model from HuggingSTRING
HIGHswift/utils/torch_utils.py269 Get the last valid (non-padding) token position indices for each sample. This function correctly handles sequeSTRING
HIGHswift/rollout/multi_turn.py72 Perform asynchronous batched inference for multiple rollout requests. This method serves as the main eSTRING
HIGHswift/rollout/multi_turn.py225Execute multi-turn conversation rollout with built-in turn management logic. This implements the default multi-STRING
HIGHswift/rl_core/resample.py27Replace samples whose encode fails with fresh ones from ``data_iterator``. Caps the TOTAL encode attempts (fail-fasSTRING
HIGHswift/model/register.py555Load a pretrained model and its processor from a model hub or local path. Args: model_id_or_path: The modelSTRING
HIGHswift/megatron/trainers/grpo_trainer.py1285 Attempt to encode each input using the template. If encoding fails, resample from a backup iterator untSTRING
Self-Referential Comments23 hits · 64 pts
SeverityFileLineSnippetContext
MEDIUMtests/megatron/test_ray_gkd.py262 # Create a minimal mock trainer instance (bypass __init__)COMMENT
MEDIUMtests/megatron/test_ray_gkd.py327 # Create a minimal mock trainerCOMMENT
MEDIUMswift/callbacks/perf_log.py128 # This function is never used.COMMENT
MEDIUMswift/rewards/rm_plugin.py3# This module provides plugins for integrating external reward models,COMMENT
MEDIUMswift/rewards/rm_plugin.py169 # Define a mapping for role capitalization if neededSTRING
MEDIUMswift/rlhf_trainers/utils.py328 # Create a DeepSpeedPlugin with the processed configCOMMENT
MEDIUMswift/rlhf_trainers/grpo_trainer.py1902 # Create a copy to avoid modifying the original table used by other loggers.COMMENT
MEDIUMswift/template/base.py527 # This function is only used to handle scenarios where the model needsCOMMENT
MEDIUMswift/template/base.py1685 """This function is important for multi-modal training, as it registers the post_encode methodSTRING
MEDIUMswift/pipelines/train/tuner.py155 """This function is only useful on the vera tuner"""STRING
MEDIUMswift/pipelines/infer/rollout.py147 # Create a stateless process group to manage communication between training processes and vLLM workers.COMMENT
MEDIUMswift/pipelines/eval/utils.py140 # Create a future to receive the result asynchronouslyCOMMENT
MEDIUMswift/utils/hf_config.py13 """This class is used to read config from config.json(maybe params.json also)"""STRING
MEDIUMswift/tuners/peft.py110 # Create a 1-element tensor then expand with stride-0: no real memory allocCOMMENT
MEDIUMswift/rollout/multi_turn.py526 # Create a RolloutOutput for the current roundCOMMENT
MEDIUMswift/rollout/multi_turn.py591 # Create a mock inputs object to use the template's _swift_prepare_inputs methodCOMMENT
MEDIUMexamples/models/qwen3_tts/prepare_data.py1# This file is used to generate `audio_codes` in the dataset.COMMENT
MEDIUMexamples/train/grpo/plugin/plugin.py72 # Define a regex pattern that only allows numbers, operators, parentheses, and whitespaceCOMMENT
MEDIUMexamples/train/grpo/plugin/plugin.py219 # Create the sandbox by hand, currently there's no context manager for this versionCOMMENT
MEDIUMexamples/train/grpo/plugin/plugin.py225 # Create a list of tasks for running scripts concurrentlyCOMMENT
MEDIUMexamples/train/grpo/plugin/plugin.py204 # Create a new event loop and set itCOMMENT
MEDIUMexamples/train/think_model/qwen3_demo1.sh3# This method is also applicable to the Deepseek-R1 series of models.COMMENT
MEDIUMexamples/custom/my_qwen2_5_omni/my_register.py306 """This function is typically used to solve the zero2/zero3 hanging issue in mixed model training,STRING
Over-Commented Block53 hits · 52 pts
SeverityFileLineSnippetContext
LOWtests/general/test_dataset.py21 'AI-ModelScope/LongAlpaca-12k#1000'COMMENT
LOWtests/general/test_dataset.py81COMMENT
LOWtests/train/test_sft.py481 # test_mllm_streaming_mp_ddp()COMMENT
LOWtests/test_align/test_vllm_vlm.py201 # test_qwen2_5_omni()COMMENT
LOWtests/test_align/test_template/test_agent.py881if __name__ == '__main__':COMMENT
LOWtests/test_align/test_template/test_agent.py901 # test_deepseek_v3_1()COMMENT
LOWtests/test_align/test_template/test_llm.py781if __name__ == '__main__':COMMENT
LOWtests/test_align/test_template/test_llm.py801 # test_skywork_o1()COMMENT
LOWtests/test_align/test_template/test_llm.py821 # test_minicpm()COMMENT
LOWtests/test_align/test_template/test_video.py401 logger = get_logger()COMMENT
LOW…sts/test_align/test_template/test_deepseek_v4_flash.py1import osCOMMENT
LOWtests/test_align/test_template/test_vision.py1321COMMENT
LOWtests/test_align/test_template/test_vision.py1341 # test_deepseek_janus()COMMENT
LOWtests/test_align/test_template/test_vision.py1361 # test_mplug_owl3()COMMENT
LOWtests/test_align/test_template/test_vision.py1381 # test_gemma3n()COMMENT
LOWtests/test_align/test_template/test_vision.py1401 # test_sensenova_si()COMMENT
LOWtests/test_align/test_template/test_template.py161COMMENT
LOWtests/eval/test_eval.py61 test_eval_llm()COMMENT
LOWtests/export/test_quant.py101 # test_bert()COMMENT
LOWdocs/source/conf.py1# Configuration file for the Sphinx documentation builder.COMMENT
LOWdocs/source/conf.py81COMMENT
LOWdocs/source_en/conf.py1# Configuration file for the Sphinx documentation builder.COMMENT
LOWdocs/source_en/conf.py81COMMENT
LOWdocs/source_en/Megatron-SWIFT/LoRA-Training.md141# swift exportCOMMENT
LOWswift/rlhf_trainers/grpo_trainer.py181 repeat_count=self.num_iterations * self.args.steps_per_generation * sequence_parallel.world_size,COMMENT
LOWswift/rlhf_trainers/grpo_trainer.py2501 # log_ppl_diff = mean_log_prob_rollout - mean_log_prob_trainingCOMMENT
LOWswift/pipelines/infer/rollout.py321 # NCCL broadcast hop of ``update_flattened_params`` and reuses theCOMMENT
LOWexamples/ascend/activation_cpu_offload/train.sh41# {'train_runtime': 79.7064, 'train_samples_per_second': 6.311, 'train_steps_per_second': 0.201, 'train_loss': 1.9164841COMMENT
LOWexamples/deploy/vllm_dp.sh1CUDA_VISIBLE_DEVICES=0,1 swift deploy \COMMENT
LOWexamples/deploy/vllm_dp.sh21# "temperature": 0COMMENT
LOWexamples/deploy/vllm.sh1CUDA_VISIBLE_DEVICES=0 swift deploy \COMMENT
LOWexamples/models/gpt_oss/internvl3_5_gpt.sh41 --padding_free false \COMMENT
LOWexamples/models/qwen3_next/mtp.sh41 --sequence_parallel true \COMMENT
LOWexamples/models/gemma4/gemma4_unified.sh41 --group_by_length true \COMMENT
LOWexamples/models/qwen3_5/mcore.sh61# CUDA_VISIBLE_DEVICES=0,1,2,3 \COMMENT
LOWexamples/models/qwen3_5/transformers.sh41# IMAGE_MAX_TOKEN_NUM=1024 \COMMENT
LOWexamples/models/qwen3_5/fp8.sh61# swift infer \COMMENT
LOWexamples/train/on_policy_distillation.sh1# On-Policy Distillation https://thinkingmachines.ai/blog/on-policy-distillation/COMMENT
LOW…mples/train/multimodal/lora_llm_full_vit/merge_lora.sh1CUDA_VISIBLE_DEVICES=0 \COMMENT
LOW…s/train/sequence_parallel/sequence_parallel_qwen3_5.sh21 --logging_steps 1 \COMMENT
LOWexamples/train/rlhf/opsd/opsd.sh1# OPSD Training ScriptCOMMENT
LOWexamples/train/grpo/plugin/run_external_scheduler.sh1# This script require main branch ms-swiftCOMMENT
LOW…es/train/grpo/plugin/openenv/run_grpo_sudoku_server.sh1# ============================================================COMMENT
LOW…es/train/grpo/plugin/openenv/run_grpo_sudoku_server.sh21#COMMENT
LOWexamples/train/grpo/plugin/openenv/run_grpo_sudoku.sh1# ============================================================COMMENT
LOWexamples/train/grpo/plugin/deepeyes/deepeyes.sh1# 8 * 80GCOMMENT
LOWexamples/train/grpo/internal/full_lmdeploy.sh1# The LMDeploy backend in GRPO has been deprecated in Swift 3.5.COMMENT
LOWexamples/train/grpo/external/vllm_multi_turn.sh1# Exp: https://github.com/modelscope/ms-swift/pull/5307#issuecomment-3219803922COMMENT
LOWexamples/megatron/mcore_bridge/full/dense.sh41# VIDEO_MAX_TOKEN_NUM=128 \COMMENT
LOWexamples/megatron/mcore_bridge/lora/seq_cls.sh41 --no_save_rng true \COMMENT
LOWexamples/megatron/multimodal/lora_llm_vit_full/sft.sh61# IMAGE_MAX_TOKEN_NUM=1024 \COMMENT
LOWexamples/megatron/grpo/dense_server.sh1# MAX_PIXELS=602112 \COMMENT
LOWexamples/megatron/lora/mtp.sh41 --dataloader_num_workers 8 \COMMENT
Structural Annotation Overuse25 hits · 44 pts
SeverityFileLineSnippetContext
LOWtests/utils/test_rewards.py194 '### Step 1: Recall the formula\n\n'CODE
LOWtests/utils/test_rewards.py196 '### Step 2: Use the given terms\n\n'CODE
LOWtests/utils/test_rewards.py201 '### Step 3: Find $a_9$\n\n'CODE
LOW…s/source/Instruction/GRPO/DeveloperGuide/multi_turn.md118 'solution': "To solve the problem, we need to evaluate the expression \\(\\sqrt{36 \\times \\sqrt{16}}\\).\n\nWeSTRING
LOWdocs/source_en/Instruction/Distillation.md253# Step 1: Deploy teacher model (max_logprobs must be >= gkd_logits_topk)COMMENT
LOWdocs/source_en/Instruction/Distillation.md260# Step 2: Start GKD trainingCOMMENT
LOW…ource_en/Instruction/GRPO/DeveloperGuide/multi_turn.md121 'solution': "To solve the problem, we need to evaluate the expression \\(\\sqrt{36 \\times \\sqrt{16}}\\).\n\nWeSTRING
LOWswift/metrics/reranker.py61 # Step 1: Find all positive sample indices (query boundaries)COMMENT
LOWswift/metrics/reranker.py67 # Step 2: Split into groups (queries)COMMENT
LOWswift/metrics/reranker.py85 # Step 3: Calculate metrics for each query independentlyCOMMENT
LOWswift/metrics/reranker.py135 # Step 4: Calculate mean metrics across all valid queriesCOMMENT
LOWswift/template/templates/minicpm.py451 # Step 1: Base encode — produces input_ids with -100 for imagesCOMMENT
LOWswift/template/templates/minicpm.py465 # Step 2: Process images — replace -100 tokens with image placeholdersCOMMENT
LOWswift/template/templates/minicpm.py479 # Step 3: Process audios — expand audio_start/audio_end pairs with <unk> tokensCOMMENT
LOWswift/template/templates/minicpm.py517 # Step 4: Compute image_bound using start/end token boundariesCOMMENT
LOWswift/template/templates/minicpm.py542 # Step 5: Compute audio_boundsCOMMENT
LOWswift/sequence_parallel/sequence_parallel.py435 # Step 1: Gather from all sequence parallel ranksCOMMENT
LOWswift/sequence_parallel/sequence_parallel.py443 # Step 2: Gather all rp chunksCOMMENT
LOWswift/megatron/trainers/vocab_parallel_utils.py41 # Step 1: Find global max for numerical stabilityCOMMENT
LOWswift/megatron/trainers/vocab_parallel_utils.py45 # Step 2: Compute exp(logits - max) and sum across all TP ranksCOMMENT
LOWswift/megatron/trainers/vocab_parallel_utils.py50 # Step 3: Compute log_softmaxCOMMENT
LOWswift/megatron/trainers/grpo_trainer.py308 # Step 2: Compute KL from logps if kl_in_reward is enabledCOMMENT
LOWswift/megatron/trainers/grpo_trainer.py313 # Step 3: Compute the per-sequence base advantage (with ref-KL penalty if kl_in_reward).COMMENT
LOWswift/megatron/trainers/grpo_trainer.py317 # Step 4: Write the advantage onto each batch, expanding the per-sequence base advantage toCOMMENT
LOWswift/megatron/trainers/grpo_trainer.py279 # Step 1: Encode batches and compute logps first (unified flow like GRPOTrainer)COMMENT
Verbosity Indicators21 hits · 40 pts
SeverityFileLineSnippetContext
LOWtests/utils/test_rewards.py194 '### Step 1: Recall the formula\n\n'CODE
LOWtests/utils/test_rewards.py196 '### Step 2: Use the given terms\n\n'CODE
LOWtests/utils/test_rewards.py201 '### Step 3: Find $a_9$\n\n'CODE
LOWswift/metrics/reranker.py61 # Step 1: Find all positive sample indices (query boundaries)COMMENT
LOWswift/metrics/reranker.py67 # Step 2: Split into groups (queries)COMMENT
LOWswift/metrics/reranker.py85 # Step 3: Calculate metrics for each query independentlyCOMMENT
LOWswift/metrics/reranker.py135 # Step 4: Calculate mean metrics across all valid queriesCOMMENT
LOWswift/template/templates/minicpm.py451 # Step 1: Base encode — produces input_ids with -100 for imagesCOMMENT
LOWswift/template/templates/minicpm.py465 # Step 2: Process images — replace -100 tokens with image placeholdersCOMMENT
LOWswift/template/templates/minicpm.py479 # Step 3: Process audios — expand audio_start/audio_end pairs with <unk> tokensCOMMENT
LOWswift/template/templates/minicpm.py517 # Step 4: Compute image_bound using start/end token boundariesCOMMENT
LOWswift/template/templates/minicpm.py542 # Step 5: Compute audio_boundsCOMMENT
LOWswift/sequence_parallel/sequence_parallel.py435 # Step 1: Gather from all sequence parallel ranksCOMMENT
LOWswift/sequence_parallel/sequence_parallel.py443 # Step 2: Gather all rp chunksCOMMENT
LOWswift/megatron/trainers/vocab_parallel_utils.py41 # Step 1: Find global max for numerical stabilityCOMMENT
LOWswift/megatron/trainers/vocab_parallel_utils.py45 # Step 2: Compute exp(logits - max) and sum across all TP ranksCOMMENT
LOWswift/megatron/trainers/vocab_parallel_utils.py50 # Step 3: Compute log_softmaxCOMMENT
LOWswift/megatron/trainers/grpo_trainer.py308 # Step 2: Compute KL from logps if kl_in_reward is enabledCOMMENT
LOWswift/megatron/trainers/grpo_trainer.py313 # Step 3: Compute the per-sequence base advantage (with ref-KL penalty if kl_in_reward).COMMENT
LOWswift/megatron/trainers/grpo_trainer.py317 # Step 4: Write the advantage onto each batch, expanding the per-sequence base advantage toCOMMENT
LOWswift/megatron/trainers/grpo_trainer.py279 # Step 1: Encode batches and compute logps first (unified flow like GRPOTrainer)COMMENT
AI Structural Patterns39 hits · 38 pts
SeverityFileLineSnippetContext
LOWtests/run.py486CODE
LOWtests/utils/test_async_rewards.py77CODE
LOWtests/train/test_opsd.py44CODE
LOWswift/dataset/loader.py224CODE
LOWswift/dataset/loader.py24CODE
LOWswift/dataset/preprocessor/core.py440CODE
LOWswift/template/register.py55CODE
LOWswift/template/base.py80CODE
LOWswift/template/base.py2065CODE
LOWswift/template/templates/llava.py132CODE
LOWswift/utils/torch_utils.py312CODE
LOWswift/tuners/lora_layers.py542CODE
LOWswift/optimizers/muonclip.py193CODE
LOWswift/optimizers/galore/adamw8bit.py11CODE
LOWswift/optimizers/galore/adafactor.py96CODE
LOWswift/sequence_parallel/ulysses.py71CODE
LOWswift/sequence_parallel/ulysses.py41CODE
LOWswift/sequence_parallel/ulysses.py88CODE
LOWswift/sequence_parallel/zigzag_ring_attn.py682CODE
LOWswift/model/register.py527CODE
LOWswift/model/register.py644CODE
LOWswift/model/register.py163CODE
LOWswift/model/model_meta.py247CODE
LOWswift/model/model_meta.py250CODE
LOWswift/model/models/mllm.py235CODE
LOWswift/model/models/qwen.py1026CODE
LOWswift/model/models/qwen.py1869CODE
LOWswift/model/models/qwen.py2105CODE
LOWswift/model/models/baichuan.py56CODE
LOWswift/model/models/gemma.py235CODE
LOWswift/infer_engine/vllm_engine.py123CODE
LOWswift/infer_engine/sglang_engine.py29CODE
LOWswift/infer_engine/lmdeploy_engine.py41CODE
LOWswift/infer_engine/lmdeploy_engine.py190CODE
LOWswift/infer_engine/transformers_engine.py52CODE
LOWswift/ray/megatron/rollout/ray_vllm_engine.py27CODE
LOWswift/ray/megatron/rollout/vllm_server.py82CODE
LOWswift/megatron/utils/convert_utils.py189CODE
LOWswift/megatron/model/utils.py108CODE
Redundant / Tautological Comments21 hits · 34 pts
SeverityFileLineSnippetContext
LOWswift/callbacks/activation_cpu_offload.py596 # Check if model is wrapped with FSDPCOMMENT
LOWswift/callbacks/activation_cpu_offload.py600 # Check if fsdp_config is a dictionary and has activation_cpu_offload enabledCOMMENT
LOWswift/callbacks/lisa.py43 # Check if it's time to switch active layers, including at step 0COMMENT
LOWswift/rlhf_trainers/utils.py1028 # Check if already patched (idempotent). On NPU/vLLM-Ascend, sleep/wakeCOMMENT
LOWswift/rlhf_trainers/utils.py1062 # Check if inner_model has layers attributeCOMMENT
LOWswift/rlhf_trainers/grpo_trainer.py2234 # Set max_length to None to disable truncation, as the input length has already been truncated earlier.COMMENT
LOWswift/pipelines/eval/utils.py168 # Check if we've reached the desired batch sizeCOMMENT
LOWswift/trainers/mixin.py461 # Check if we should delete older checkpoint(s)COMMENT
LOWswift/trainers/reranker_trainer.py18 # Check if we have a custom loss functionCOMMENT
LOWswift/rollout/multi_turn.py337 # Check if the number of logprobs matches the number of loss_mask=1 tokensCOMMENT
LOWswift/infer_engine/utils.py533 # Check if we have a cached last_output from the previous iteration.COMMENT
LOWswift/infer_engine/utils.py600 # Check if need to run the usual non-async pathCOMMENT
LOWswift/hub/hub.py351 # Write the file if it has changedCOMMENT
LOWswift/arguments/rlhf_args.py738 # Check if teacher_deepspeed is a predefined nameCOMMENT
LOWswift/megatron/utils/megatron_lm_utils.py577 # Set bucket_size to infinity if overlap_grad_reduce is False.COMMENT
LOWswift/agent_template/minimax_m2.py72 # Check if using react formatCOMMENT
LOWexamples/train/grpo/plugin/plugin.py68 # Check if all numbers are used exactly onceCOMMENT
LOWexamples/train/grpo/plugin/plugin.py80 # Check if the equation is correct and matches the ground truthCOMMENT
LOWexamples/train/grpo/plugin/plugin.py56 # Check if the format is correctCOMMENT
LOWexamples/train/grpo/plugin/openenv/sudoku_scheduler.py303 # Check if env says invalidCOMMENT
LOWexamples/train/grpo/plugin/openenv/sudoku_scheduler.py308 # Check if move targets an empty cellCOMMENT
Modern Structural Boilerplate23 hits · 23 pts
SeverityFileLineSnippetContext
LOWswift/rlhf_trainers/rollout_mixin.py198 def _setup_teacher(self) -> None:CODE
LOWswift/rlhf_trainers/rollout_mixin.py1572 def set_default_max_tokens(_self, request_config: RequestConfig, inputs: Dict[str, Any]) -> None:CODE
LOWswift/rlhf_trainers/utils.py1642def set_expandable_segments(enable: bool) -> None:CODE
LOWswift/rlhf_trainers/vllm_client.py38logger = logging.getLogger(__name__)CODE
LOWswift/template/base.py1678 def set_mode(self, mode: Literal['transformers', 'vllm', 'lmdeploy', 'sglang', 'train', 'rlhf', 'kto']) -> None:CODE
LOWswift/pipelines/infer/deploy.py168 def _set_request_config(self, request_config) -> None:CODE
LOWswift/pipelines/infer/rollout.py168 def update_named_param(self, name: str, dtype: str, shape: Sequence[int]) -> None:CODE
LOWswift/pipelines/infer/rollout.py200 def update_adapter_flattened_param(self, peft_config: Dict, metadatas: list[Dict]) -> None:CODE
LOWswift/pipelines/infer/rollout.py229 def update_adapter_param(self, peft_config: Dict, lora_tensors_metadata: list[Dict]) -> None:CODE
LOWswift/pipelines/infer/rollout.py268 def update_flattened_params(self, metadatas: list[Dict]) -> None:CODE
LOWswift/sequence_parallel/utils.py148 def set_epoch(self, epoch: int) -> None:CODE
LOWswift/model/npu_patcher.py8__all__ = ['NPUCastError', 'apply_all_patches', 'apply_mindspeed_patches', 'patch_mindspeed_fla_gdn_implementation']CODE
LOWswift/model/npu_patch/vllm_ascend_memory.py88__all__ = [CODE
LOWswift/model/npu_patch/vllm_ascend.py93__all__ = [CODE
LOWswift/model/npu_patch/__init__.py49__all__ = ['NPUCastError', 'apply_all_patches', 'apply_mindspeed_patches', 'patch_mindspeed_fla_gdn_implementation']CODE
LOWswift/model/npu_patch/megatron_checkpoint.py220__all__ = ['load_optimizer_state_dict', 'optimizer_sharded_state_dict']CODE
LOWswift/model/npu_patch/vllm_ascend_moe.py455__all__ = [CODE
LOWswift/model/npu_patch/vllm_ascend_lora.py226__all__ = [CODE
LOWswift/infer_engine/infer_engine.py204 def set_default_max_tokens(self, request_config: RequestConfig, inputs: Dict[str, Any]) -> None:CODE
LOWswift/ray/megatron/base_trainer.py42 def set_data_info(self, data_info: Dict[str, Any]) -> None:CODE
LOWswift/ray/megatron/rollout/adapter.py11logger = logging.getLogger(__name__)CODE
LOWswift/ray/megatron/checkpoint_engine/__init__.py8__all__ = [CODE
LOWswift/megatron/trainers/rollout_mixin.py180 def _setup_teacher(self) -> None:CODE
Cross-Language Confusion4 hits · 16 pts
SeverityFileLineSnippetContext
HIGHswift/rlhf_trainers/gkd_loss.py81 """KL(target || input), returns per-position scalar [N]."""STRING
HIGHswift/rlhf_trainers/grpo_trainer.py2434 - kl: Direct KL divergence estimator KL(π_rollout || π_training)STRING
HIGHswift/hub/hub.py357 repo.push(commit_message)CODE
HIGHswift/megatron/trainers/vocab_parallel_utils.py108 KL(target || input) = sum(target_prob * (target_log_prob - input_log_prob))STRING
Modern AI Meta-Vocabulary7 hits · 16 pts
SeverityFileLineSnippetContext
MEDIUMdocs/source/Instruction/GRPO/DeveloperGuide/gym_env.md358- https://github.com/alibaba/ROLL/tree/main/roll/pipeline/agentic/env/frozen_lakeCODE
MEDIUMdocs/source_en/Instruction/Evaluation.md165├── example_dev.csv # (Optional) The filename should follow the format `{subset_name}_dev.csv` for few-shot evaluationCODE
MEDIUM…cs/source_en/Instruction/GRPO/AdvancedResearch/FIPO.md5[FIPO](https://arxiv.org/abs/2603.19835) is a value-free RL method for eliciting longer and deeper reasoning. It keeps tCODE
MEDIUM…s/source_en/Instruction/GRPO/DeveloperGuide/gym_env.md205- https://github.com/alibaba/ROLL/tree/main/roll/pipeline/agentic/env/frozen_lakeCODE
MEDIUMswift/template/templates/llm.py345 # reasoning_effort: "no_think", "low", "high" (deep chain-of-thought)COMMENT
MEDIUMswift/sequence_parallel/zigzag_ring_attn.py691 window_size=(-1, -1), # -1 means infinite context windowCODE
MEDIUMexamples/megatron/grpo/multi_turn/frozen_lake_plugin.py12# code borrowed from ROLL/roll/pipeline/agentic/env/frozen_lakeCOMMENT
AI Response Leakage2 hits · 15 pts
SeverityFileLineSnippetContext
HIGHexamples/megatron/fp8/vlm.sh2# In this example, FP8 training does not provide any speedup.COMMENT
HIGHexamples/megatron/fp8/llm.sh3# In this example, FP8 training does not provide any speedup.COMMENT
Slop Phrases5 hits · 13 pts
SeverityFileLineSnippetContext
LOWswift/model/models/qwen.py1999 loss.device) # make sure to reside in the same deviceCODE
MEDIUMexamples/train/multi-gpu/fsdp2_lora/train.sh2# NOTE: for swift>=3.12, you can use --fsdp fsdp2 instead of accelerate launchCOMMENT
MEDIUMexamples/train/multi-gpu/fsdp_qlora/train.sh2# NOTE: for swift>=3.12, you can use --fsdp fsdp2 instead of accelerate launchCOMMENT
MEDIUMexamples/megatron/fp8/lora.sh3# However, you can use BF16 weights to perform Merge-LoRA.COMMENT
MEDIUMexamples/megatron/fp8/lora.sh64# Alternatively, you can use BF16 base model + BF16 LoRA for inferenceCOMMENT
Magic Placeholder Names2 hits · 10 pts
SeverityFileLineSnippetContext
HIGHdocs/source/Instruction/Sample.md80OPENAI_API_KEY="your_api_key" \CODE
HIGHdocs/source_en/Instruction/Sample.md84OPENAI_API_KEY="your_api_key" \CODE
AI Slop Vocabulary3 hits · 8 pts
SeverityFileLineSnippetContext
LOWtests/train/test_vllm_importance_sampling_basic.py20 # In testing, just return the tensor as-isCOMMENT
MEDIUMswift/template/templates/minicpm.py518 # This is more robust than finding consecutive <unk> tokens, especiallyCOMMENT
LOWexamples/megatron/export/lora.sh3# simply set `--merge_lora true`COMMENT
Synthetic Comment Markers1 hit · 5 pts
SeverityFileLineSnippetContext
HIGH…s/source_en/BestPractices/GRPO-Multi-Modal-Training.md278This task is based on the experiments in [open-r1-multimodal](https://github.com/EvolvingLMMs-Lab/open-r1-multimodal.gitCODE
Dead Code1 hit · 2 pts
SeverityFileLineSnippetContext
MEDIUMtests/infer/test_infer_engine.py24CODE
Overly Generic Function Names1 hit · 1 pts
SeverityFileLineSnippetContext
LOWswift/callbacks/activation_cpu_offload.py480 def my_function(*inputs):CODE