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.3 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of modelscope/ms-swift, a Python project with 14,801 GitHub stars. SynthScan v2.0 examined 174,376 lines of code across 1294 source files, recording 2296 pattern matches distributed across 23 syntactic categories. The overall adjusted score of 15.3 places this repository in the Moderate AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

15.3
Adjusted Score
15.3
Raw Score
100%
Time Factor
2026-07-14
Last Push
14.8K
Stars
Python
Language
174.4K
Lines of Code
1.3K
Files
2.3K
Pattern Hits
2026-07-14
Scan Date
0.04
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 2HIGH 44MEDIUM 142LOW 2108

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 2296 distinct pattern matches across 23 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Unused Imports937 hits · 810 pts
SeverityFileLineSnippetContext
LOWsetup.py7CODE
LOWtests/run.py37CODE
LOWtests/llm/test_template.py50CODE
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/hub/test_check_model.py17CODE
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
877 more matches not shown…
Hyper-Verbose Identifiers481 hits · 482 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_template_meta.py5def test_replace_system_preserves_non_string_elements():CODE
LOWtests/general/test_data_preprocess.py50 def test_truncation_max_length(self):CODE
LOWtests/general/test_data_preprocess.py58 def test_data_collator_padding(self):CODE
LOWtests/general/test_data_preprocess.py153 def test_empty_rejected_messages_does_not_crash(self):CODE
LOWtests/general/test_data_preprocess.py179 def test_valid_rejected_messages_preserved(self):CODE
LOWtests/general/test_template.py75def test_save_pil_image_dimension_collision():CODE
LOWtests/utils/test_multi_teacher.py58 def test_parse_empty_json_list(self):CODE
LOWtests/utils/test_multi_teacher.py71 def test_parse_multi_empty_tags_rejected(self):CODE
LOWtests/utils/test_multi_teacher.py86 def test_parse_overlapping_tags_rejected(self):CODE
LOWtests/utils/test_multi_teacher.py101 def test_parse_non_dict_entry_rejected(self):CODE
LOWtests/utils/test_multi_teacher.py106 def test_parse_tags_coerced_to_str(self):CODE
LOWtests/utils/test_multi_teacher.py125 def test_route_single_teacher_all_samples(self):CODE
LOWtests/utils/test_multi_teacher.py142 def test_route_unmatched_fails_fast(self):CODE
LOWtests/utils/test_multi_teacher.py151 def test_get_tag_reads_tag_key(self):CODE
LOWtests/utils/test_multi_teacher.py158 def test_get_tag_no_tag_returns_none(self):CODE
LOWtests/utils/test_multi_teacher.py164 def test_multi_teacher_scatter_back(self):CODE
LOWtests/utils/test_multi_teacher.py182 def test_single_teacher_one_fetch(self):CODE
LOWtests/utils/test_multi_teacher.py197 def test_empty_subset_teacher_still_visited(self):CODE
LOWtests/utils/test_multi_teacher.py217 def test_phase_split_concurrent_scatter(self):CODE
LOWtests/utils/test_multi_teacher.py247 def test_phase_split_non_main_no_infer(self):CODE
LOWtests/utils/test_multi_teacher.py305 def test_zero_coef_no_injection(self):CODE
LOWtests/utils/test_multi_teacher.py346 def test_streaming_injected_tags_route_correctly(self):CODE
LOWtests/utils/test_multi_teacher.py360 def test_streaming_fetch_by_routing(self):CODE
LOWtests/utils/test_multi_teacher.py378 def test_streaming_routing_matches_non_streaming(self):CODE
LOWtests/utils/test_multi_teacher.py390 def test_streaming_interleave_preserves_per_dataset_tags(self):CODE
LOWtests/utils/test_async_rewards.py17 def test_start_and_shutdown_event_loop_in_daemon(self):CODE
LOWtests/utils/test_async_rewards.py38 def test_run_async_function_in_daemon_loop(self):CODE
LOWtests/utils/test_async_rewards.py57 def test_async_orm_base_class(self):CODE
LOWtests/utils/test_async_rewards.py80 def test_async_reward_is_detected(self):CODE
LOWtests/utils/test_async_rewards.py106 def test_parallel_async_execution(self):CODE
LOWtests/utils/test_async_rewards.py153 def test_async_reward_function_batch_performance(self):CODE
LOWtests/utils/test_rewards.py73 def test_answer_tag_with_plain_number(self):CODE
LOWtests/utils/test_rewards.py82 def test_answer_tag_with_latex(self):CODE
LOWtests/utils/test_rewards.py91 def test_long_text_with_answer_tag(self):CODE
LOWtests/utils/test_rewards.py106 def test_answer_tag_with_complex_expression(self):CODE
LOWtests/utils/test_rewards.py115 def test_solution_with_answer_tag(self):CODE
LOWtests/utils/test_rewards.py124 def test_answer_tag_wrong_answer(self):CODE
LOWtests/utils/test_rewards.py133 def test_mixed_batch_with_and_without_tags(self):CODE
LOWtests/utils/test_rewards.py170 def test_answer_tag_with_extra_whitespace(self):CODE
LOWtests/utils/test_rewards.py179 def test_multiple_answer_tags(self):CODE
LOWtests/utils/test_rewards.py188 def test_real_world_example_from_user(self):CODE
LOWtests/utils/test_rewards.py212 def test_equivalent_fractions(self):CODE
LOWtests/utils/test_rewards.py221 def test_different_forms_same_answer(self):CODE
LOWtests/utils/test_rewards.py230 def test_latex_inline_math_delimiters(self):CODE
LOWtests/utils/test_rewards.py240 def test_latex_display_math_delimiters(self):CODE
LOWtests/utils/test_rewards.py249 def test_mixed_latex_delimiters(self):CODE
LOWtests/utils/test_rewards.py38 def test_multiple_steps_with_boxed(self):CODE
LOWtests/utils/test_rewards.py62 def test_batch_processing_no_tag(self):CODE
LOWtests/tuners/test_swift_device_map.py25 def test_swift_multiple_adapters(self):CODE
LOWtests/tuners/test_swift_base.py73 def test_swift_adapter_forward(self):CODE
LOWtests/tuners/test_swift_base.py93 def test_swift_prompt_forward(self):CODE
LOWtests/tuners/test_swift_base.py110 def test_swift_restuner_forward(self):CODE
LOWtests/tuners/test_swift_base.py133 def lora_injection_with_dtype(self, dtype=torch.float32):CODE
LOWtests/tuners/test_swift_base.py185 def test_swift_lora_injection(self):CODE
421 more matches not shown…
Deep Nesting335 hits · 308 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_arch.py1CODE
LOWtests/train/test_vllm_importance_sampling_basic.py49CODE
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.py587CODE
LOWswift/dataset/dataset_meta.py120CODE
LOWswift/dataset/packing.py53CODE
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.py173CODE
LOWswift/dataset/preprocessor/core.py494CODE
LOWswift/rewards/orm.py238CODE
LOWswift/rlhf_trainers/rollout_mixin.py198CODE
LOWswift/rlhf_trainers/rollout_mixin.py370CODE
LOWswift/rlhf_trainers/rollout_mixin.py521CODE
LOWswift/rlhf_trainers/rollout_mixin.py658CODE
LOWswift/rlhf_trainers/rollout_mixin.py892CODE
275 more matches not shown…
Decorative Section Separators83 hits · 270 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.py1775# ============================================================================COMMENT
MEDIUMswift/rlhf_trainers/utils.py1777# ============================================================================COMMENT
MEDIUMswift/rlhf_trainers/grpo_trainer.py445 # --------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/grpo_trainer.py447 # --------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/grpo_trainer.py480 # --------------------------------------------------COMMENT
MEDIUMswift/rlhf_trainers/grpo_trainer.py482 # --------------------------------------------------COMMENT
MEDIUMswift/pipelines/infer/rollout.py318 # ------------------------------------------------------------------COMMENT
MEDIUMswift/pipelines/infer/rollout.py320 # ------------------------------------------------------------------COMMENT
MEDIUMswift/pipelines/infer/rollout.py440 # ── Step 1: receive + rebuild IPC handle (with reuse) ────────COMMENT
MEDIUMswift/pipelines/infer/rollout.py478 # ── 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.py18# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/model/npu_patch/model.py20# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/model/npu_patch/model.py177# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/model/npu_patch/model.py179# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/model/npu_patch/model.py209# ---------------------------------------------------------------------------COMMENT
MEDIUMswift/model/npu_patch/model.py211# ---------------------------------------------------------------------------COMMENT
23 more matches not shown…
Excessive Try-Catch Wrapping196 hits · 218 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.py385 except Exception:CODE
LOWtests/megatron/test_ray_gkd.py398 except Exception as e: # noqaCODE
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.py177 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.py195 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.py1573def infer_task():CODE
MEDIUMswift/rlhf_trainers/rollout_mixin.py1583def done(future):CODE
LOWswift/rlhf_trainers/rollout_mixin.py1577 except Exception as e:CODE
LOWswift/rlhf_trainers/rollout_mixin.py1587 except Exception as e:CODE
LOWswift/rlhf_trainers/reward_trainer.py102 except Exception as e:CODE
LOWswift/rlhf_trainers/utils.py1109 except Exception:CODE
LOWswift/rlhf_trainers/utils.py1136 except Exception:CODE
LOWswift/rlhf_trainers/utils.py1150 except Exception as e:CODE
LOWswift/rlhf_trainers/utils.py1182 except Exception:CODE
LOWswift/rlhf_trainers/utils.py1198 except Exception:CODE
LOWswift/rlhf_trainers/utils.py1285 except Exception as e:CODE
MEDIUMswift/rlhf_trainers/vllm_client.py130def process_chunk(i, chunk):CODE
MEDIUMswift/rlhf_trainers/vllm_client.py237def _update_single_server(i):CODE
136 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_5-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_5-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 Structure15 hits · 75 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.py522Split model parameters into batches for synchronized weight transfer. This method divides model parameters intoSTRING
HIGHswift/rlhf_trainers/rollout_mixin.py1723 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.py20Factory function to create a loss scale object from a string specification. The loss_scale string supports the follSTRING
HIGHswift/utils/hub_utils.py27Download 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/chunk_gated_delta_rule.py256 Args: q (torch.Tensor): queries of shape `[B, T, H, K]`. k (torch.Tensor): STRING
HIGHswift/model/register.py544Load 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.py1276 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.py1856 # Create a copy to avoid modifying the original table used by other loggers.COMMENT
MEDIUMswift/template/base.py473 # This function is only used to handle scenarios where the model needsCOMMENT
MEDIUMswift/template/base.py1629 """This function is important for multi-modal training, as it registers the post_encode methodSTRING
MEDIUMswift/pipelines/train/tuner.py127 """This function is only useful on the vera tuner"""STRING
MEDIUMswift/pipelines/infer/rollout.py150 # 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 Block51 hits · 50 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.py721 print(f'labels: {template.safe_decode(encoded2["labels"])}')COMMENT
LOWtests/test_align/test_template/test_agent.py741 # test_glm4_5()COMMENT
LOWtests/test_align/test_template/test_llm.py741 logger = get_logger()COMMENT
LOWtests/test_align/test_template/test_llm.py761 # test_qwen2_5_math()COMMENT
LOWtests/test_align/test_template/test_llm.py781 # test_hunyuan()COMMENT
LOWtests/test_align/test_template/test_video.py401 logger = get_logger()COMMENT
LOWtests/test_align/test_template/test_vision.py1281 # test_qwen2_5_vl_batch_infer()COMMENT
LOWtests/test_align/test_template/test_vision.py1301 # test_got_ocr()COMMENT
LOWtests/test_align/test_template/test_vision.py1321 # test_doc_owl2()COMMENT
LOWtests/test_align/test_template/test_vision.py1341 test_minicpmv4_6()COMMENT
LOWtests/test_align/test_template/test_vision.py1361 # test_paddle_ocr_1_5()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/pipelines/infer/rollout.py321 #COMMENT
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.py193 '### Step 1: Recall the formula\n\n'CODE
LOWtests/utils/test_rewards.py195 '### Step 2: Use the given terms\n\n'CODE
LOWtests/utils/test_rewards.py200 '### 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.py431 # Step 1: Base encode — produces input_ids with -100 for imagesCOMMENT
LOWswift/template/templates/minicpm.py445 # Step 2: Process images — replace -100 tokens with image placeholdersCOMMENT
LOWswift/template/templates/minicpm.py459 # Step 3: Process audios — expand audio_start/audio_end pairs with <unk> tokensCOMMENT
LOWswift/template/templates/minicpm.py497 # Step 4: Compute image_bound using start/end token boundariesCOMMENT
LOWswift/template/templates/minicpm.py522 # Step 5: Compute audio_boundsCOMMENT
LOWswift/sequence_parallel/sequence_parallel.py427 # Step 1: Gather from all sequence parallel ranksCOMMENT
LOWswift/sequence_parallel/sequence_parallel.py435 # 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.py312 # Step 2: Compute KL from logps if kl_in_reward is enabledCOMMENT
LOWswift/megatron/trainers/grpo_trainer.py317 # Step 3: Compute the per-sequence base advantage (with ref-KL penalty if kl_in_reward).COMMENT
LOWswift/megatron/trainers/grpo_trainer.py321 # Step 4: Write the advantage onto each batch, expanding the per-sequence base advantage toCOMMENT
LOWswift/megatron/trainers/grpo_trainer.py283 # Step 1: Encode batches and compute logps first (unified flow like GRPOTrainer)COMMENT
Verbosity Indicators21 hits · 40 pts
SeverityFileLineSnippetContext
LOWtests/utils/test_rewards.py193 '### Step 1: Recall the formula\n\n'CODE
LOWtests/utils/test_rewards.py195 '### Step 2: Use the given terms\n\n'CODE
LOWtests/utils/test_rewards.py200 '### 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.py431 # Step 1: Base encode — produces input_ids with -100 for imagesCOMMENT
LOWswift/template/templates/minicpm.py445 # Step 2: Process images — replace -100 tokens with image placeholdersCOMMENT
LOWswift/template/templates/minicpm.py459 # Step 3: Process audios — expand audio_start/audio_end pairs with <unk> tokensCOMMENT
LOWswift/template/templates/minicpm.py497 # Step 4: Compute image_bound using start/end token boundariesCOMMENT
LOWswift/template/templates/minicpm.py522 # Step 5: Compute audio_boundsCOMMENT
LOWswift/sequence_parallel/sequence_parallel.py427 # Step 1: Gather from all sequence parallel ranksCOMMENT
LOWswift/sequence_parallel/sequence_parallel.py435 # 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.py312 # Step 2: Compute KL from logps if kl_in_reward is enabledCOMMENT
LOWswift/megatron/trainers/grpo_trainer.py317 # Step 3: Compute the per-sequence base advantage (with ref-KL penalty if kl_in_reward).COMMENT
LOWswift/megatron/trainers/grpo_trainer.py321 # Step 4: Write the advantage onto each batch, expanding the per-sequence base advantage toCOMMENT
LOWswift/megatron/trainers/grpo_trainer.py283 # 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.py75CODE
LOWtests/train/test_opsd.py44CODE
LOWswift/dataset/loader.py224CODE
LOWswift/dataset/loader.py24CODE
LOWswift/dataset/preprocessor/core.py438CODE
LOWswift/template/register.py55CODE
LOWswift/template/base.py80CODE
LOWswift/template/base.py2009CODE
LOWswift/template/templates/llava.py132CODE
LOWswift/utils/torch_utils.py312CODE
LOWswift/tuners/lora_layers.py542CODE
LOWswift/optimizers/muonclip.py192CODE
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.py516CODE
LOWswift/model/register.py633CODE
LOWswift/model/register.py163CODE
LOWswift/model/model_meta.py244CODE
LOWswift/model/model_meta.py247CODE
LOWswift/model/models/mllm.py234CODE
LOWswift/model/models/qwen.py989CODE
LOWswift/model/models/qwen.py1545CODE
LOWswift/model/models/qwen.py1781CODE
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.py40CODE
LOWswift/infer_engine/lmdeploy_engine.py189CODE
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.py593 # Check if model is wrapped with FSDPCOMMENT
LOWswift/callbacks/activation_cpu_offload.py597 # 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.py1026 # Check if already patched (idempotent). On NPU/vLLM-Ascend, sleep/wakeCOMMENT
LOWswift/rlhf_trainers/utils.py1060 # Check if inner_model has layers attributeCOMMENT
LOWswift/rlhf_trainers/grpo_trainer.py2157 # 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.py453 # 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.py641 # Check if teacher_deepspeed is a predefined nameCOMMENT
LOWswift/megatron/utils/megatron_lm_utils.py541 # 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.py301 # Check if env says invalidCOMMENT
LOWexamples/train/grpo/plugin/openenv/sudoku_scheduler.py306 # Check if move targets an empty cellCOMMENT
Hallucination Indicators2 hits · 30 pts
SeverityFileLineSnippetContext
CRITICALswift/template/templates/deepseek.py471 self.model.model.image_newline.data = self.model.model.image_newline.data.to(vision_device)CODE
CRITICALswift/template/templates/deepseek.py472 self.model.model.view_seperator.data = self.model.model.view_seperator.data.to(vision_device)CODE
Modern Structural Boilerplate22 hits · 22 pts
SeverityFileLineSnippetContext
LOWswift/rlhf_trainers/rollout_mixin.py198 def _setup_teacher(self) -> None:CODE
LOWswift/rlhf_trainers/rollout_mixin.py1523 def set_default_max_tokens(_self, request_config: RequestConfig, inputs: Dict[str, Any]) -> None:CODE
LOWswift/rlhf_trainers/utils.py1621def set_expandable_segments(enable: bool) -> None:CODE
LOWswift/rlhf_trainers/vllm_client.py38logger = logging.getLogger(__name__)CODE
LOWswift/template/base.py1622 def set_mode(self, mode: Literal['transformers', 'vllm', 'lmdeploy', 'sglang', 'train', 'rlhf', 'kto']) -> None:CODE
LOWswift/pipelines/infer/deploy.py167 def _set_request_config(self, request_config) -> None:CODE
LOWswift/pipelines/infer/rollout.py171 def update_named_param(self, name: str, dtype: str, shape: Sequence[int]) -> None:CODE
LOWswift/pipelines/infer/rollout.py203 def update_adapter_flattened_param(self, peft_config: Dict, metadatas: list[Dict]) -> None:CODE
LOWswift/pipelines/infer/rollout.py232 def update_adapter_param(self, peft_config: Dict, lora_tensors_metadata: list[Dict]) -> None:CODE
LOWswift/pipelines/infer/rollout.py271 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', 'patch_mindspeed_te_cp_implementation']CODE
LOWswift/model/npu_patch/vllm_ascend_memory.py88__all__ = [CODE
LOWswift/model/npu_patch/vllm_ascend.py58__all__ = [CODE
LOWswift/model/npu_patch/__init__.py49__all__ = ['NPUCastError', 'apply_all_patches', 'patch_mindspeed_te_cp_implementation']CODE
LOWswift/model/npu_patch/megatron_checkpoint.py209__all__ = ['load_optimizer_state_dict', 'optimizer_sharded_state_dict']CODE
LOWswift/model/npu_patch/vllm_ascend_moe.py385__all__ = [CODE
LOWswift/infer_engine/infer_engine.py210 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.py159 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.py2357 - 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.py1675 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.py498 # 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
Overly Generic Function Names1 hit · 1 pts
SeverityFileLineSnippetContext
LOWswift/callbacks/activation_cpu_offload.py480 def my_function(*inputs):CODE