AI Slop Code RIsk Monitor

huggingface/trl

Train transformer language models with reinforcement learning.

19.0 Elevated pattern signal View on GitHub

Maintenance and Governance Review

This report summarizes scanner evidence for huggingface/trl, a Python project with 19,484 GitHub stars. SynthScan examined 138,464 lines of code across 463 source files, recording 2240 pattern matches distributed across 21 syntactic categories. The legacy adjusted pattern signal is 19.0 (Elevated pattern signal); it is not an authorship estimate.

Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.

19.0
Adjusted Signal
19.0
Raw Pattern Score
100%
Time Factor
2026-10-10
Last Push
19.5K
Stars
Python
Language
138.5K
Lines of Code
463
Files
2.2K
Pattern Hits
2026-10-12
Scan Date
0.19
HC Hit Rate

Risk Review · v3

Use each vector to guide manual verification of the underlying findings.

Cognitive Ownership Risk 47.0/100 · MEDIUM

Can maintainers explain intent, assumptions, and trade-offs? 1806 finding(s).

Hallucinated Dependency & Supply Chain Risk 7.2/100 · LOW

Are imports declared and package/API names verified? 186 finding(s).

Agent Over-Engineering Ratio 45.6/100 · MEDIUM

Are wrappers, guards, and repeated structures necessary? 1462 finding(s).

PR Review Velocity Impact 65.7/100 · HIGH

Which changes need focused human review? 2240 finding(s).

What These Metrics Mean

Adjusted Signal
Legacy pattern score normalized per 1,000 scanned lines and multiplied by the repository-level time factor. It is not an estimate of AI authorship.
Raw Pattern Score
Sum of severity- and context-weighted pattern findings before applying the time factor.
Time Factor
A coarse multiplier based on repository last-push metadata. It does not identify when individual code was written.
Pattern Hits
Count of configured pattern findings. Review each location and surrounding code before acting.
HC Hit Rate
High- and critical-severity findings per scanned file. Severity is a configured detector weight, not proof of a vulnerability or authorship.
Lines / Files
Scan coverage denominators used by the legacy normalized score.

Pattern-Signal History

This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.

Severity Breakdown

Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.

CRITICAL 2HIGH 87MEDIUM 136LOW 2015

Directory Score Breakdown

This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.

Pattern Findings

The scanner identified 2240 distinct pattern matches across 21 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.

Hyper-Verbose Identifiers1182 hits · 998 pts
SeverityFileLineSnippetContext
LOWtests/test_rloo_trainer.py152 def test_logps_match_plain_forward(self):CODE
LOWtests/test_rloo_trainer.py190 def test_reward_func_wrong_number_of_rewards(self):CODE
LOWtests/test_rloo_trainer.py215 def test_train_dataset_format(self, config_name):CODE
LOWtests/test_rloo_trainer.py290 def test_train_with_num_generations_eval(self):CODE
LOWtests/test_rloo_trainer.py314 def test_train_with_iterable_dataset(self):CODE
LOWtests/test_rloo_trainer.py349 def test_init_with_train_dataset(self, train_dataset_type):CODE
LOWtests/test_rloo_trainer.py401 def test_init_with_eval_dataset(self, eval_dataset_type):CODE
LOWtests/test_rloo_trainer.py435 def test_iterable_dataset_requires_dispatch_batches_false(self):CODE
LOWtests/test_rloo_trainer.py450 def test_iterable_dataset_forces_num_workers_zero(self):CODE
LOWtests/test_rloo_trainer.py465 def test_iterable_eval_keeps_map_style_train_workers(self):CODE
LOWtests/test_rloo_trainer.py503 def test_evaluate_with_eval_dataset(self, eval_dataset_type):CODE
LOWtests/test_rloo_trainer.py542 def test_train_multiple_iterations(self):CODE
LOWtests/test_rloo_trainer.py630 def test_train_peft_and_quantization(self):CODE
LOWtests/test_rloo_trainer.py676 def test_train_peft_dora_and_quantization(self):CODE
LOWtests/test_rloo_trainer.py788 def test_train_moe_peft_model(self):CODE
LOWtests/test_rloo_trainer.py836 def test_train_peft_with_gradient_checkpointing(self):CODE
LOWtests/test_rloo_trainer.py903 def test_train_different_reward_model(self):CODE
LOWtests/test_rloo_trainer.py942 def test_train_reward_func_standard(self):CODE
LOWtests/test_rloo_trainer.py976 def test_train_reward_func_conversational(self):CODE
LOWtests/test_rloo_trainer.py1011 def test_train_multiple_reward_funcs(self):CODE
LOWtests/test_rloo_trainer.py1049 def test_train_sync_and_async_reward_funcs(self):CODE
LOWtests/test_rloo_trainer.py1105 def non_applicable_reward_func(completions, **kwargs):CODE
LOWtests/test_rloo_trainer.py1141 def test_train_multiple_reward_funcs_with_weights(self):CODE
LOWtests/test_rloo_trainer.py1185 def test_reward_metric_reflects_reward_weights(self):CODE
LOWtests/test_rloo_trainer.py1222 def test_train_multiple_mixed_reward_funcs(self):CODE
LOWtests/test_rloo_trainer.py1256 def test_train_reward_func_additional_column(self):CODE
LOWtests/test_rloo_trainer.py1296 def test_ref_model_like_model_instance(self):CODE
LOWtests/test_rloo_trainer.py1317 def test_train_with_sync_ref_model(self):CODE
LOWtests/test_rloo_trainer.py1382 def test_train_with_pad_to_multiple_of(self):CODE
LOWtests/test_rloo_trainer.py1494 def test_train_vllm_structured_outputs(self):CODE
LOWtests/test_rloo_trainer.py1526 def test_train_with_additional_generation_kwargs(self):CODE
LOWtests/test_rloo_trainer.py1563 def test_train_vllm_with_additional_generation_kwargs(self):CODE
LOWtests/test_rloo_trainer.py1609 def test_train_with_transformers_continuous_batching(self):CODE
LOWtests/test_rloo_trainer.py1640 def test_train_with_normalized_advantages(self):CODE
LOWtests/test_rloo_trainer.py1670 def test_train_with_clipped_rewards(self):CODE
LOWtests/test_rloo_trainer.py1701 def test_train_with_mask_truncated_completions(self, mock_generate):CODE
LOWtests/test_rloo_trainer.py1750 def test_train_with_mask_truncated_completions_all_masked(self):CODE
LOWtests/test_rloo_trainer.py1788 def test_warning_raised_all_rewards_none(self, caplog):CODE
LOWtests/test_rloo_trainer.py1817 def test_train_num_generations_larger_than_batch_size(self):CODE
LOWtests/test_rloo_trainer.py1847 def test_train_multiple_dataloader_workers(self):CODE
LOWtests/test_rloo_trainer.py1888 def test_train_with_generation_kwargs(self):CODE
LOWtests/test_rloo_trainer.py1919 def test_train_with_reward_func_accessing_trainer_state(self):CODE
LOWtests/test_rloo_trainer.py1944 def test_train_reward_func_with_log_extra(self):CODE
LOWtests/test_rloo_trainer.py1970 def test_train_reward_func_with_log_metric(self):CODE
LOWtests/test_rloo_trainer.py1997 def test_prepare_input_called_with_correct_data(self):CODE
LOWtests/test_rloo_trainer.py2048 def test_train_stops_on_every_eos_token_id(self):CODE
LOWtests/test_rloo_trainer.py2079 def test_train_with_chat_template_kwargs(self):CODE
LOWtests/test_rloo_trainer.py2109 def test_mismatched_reward_processing_classes_length(self):CODE
LOWtests/test_rloo_trainer.py2135 def test_correct_reward_processing_classes_list(self):CODE
LOWtests/test_rloo_trainer.py2166 def test_single_reward_model_with_single_processing_class(self):CODE
LOWtests/test_rloo_trainer.py2191 def test_pad_token_id_synced_with_model_config(self):CODE
LOWtests/test_rloo_trainer.py2212 def test_reward_model_pad_token_id_synced_with_text_config(self):CODE
LOWtests/test_rloo_trainer.py2314 def test_train_vlm_with_pad_to_multiple_of(self):CODE
LOWtests/test_rloo_trainer.py2357 def test_train_vlm_beta_non_zero(self, model_id):CODE
LOWtests/test_rloo_trainer.py2447 def test_train_vlm_peft_and_quantization(self, model_id):CODE
LOWtests/test_rloo_trainer.py2504 def test_train_vlm_peft_dora_and_quantization(self, model_id):CODE
LOWtests/test_rloo_trainer.py2618 def test_train_vlm_multi_image(self, model_id):CODE
LOWtests/test_rloo_trainer.py2660 def test_train_vlm_log_multimodal_false(self):CODE
LOW⚡tests/test_utils.py201 def test_pad_to_multiple_of_side_left(self):CODE
LOW⚡tests/test_utils.py209 def test_pad_to_multiple_of_no_extra_padding(self):CODE
1122 more matches not shown…
Over-Commented Block355 hits · 345 pts
SeverityFileLineSnippetContext
LOWpyproject.toml181 # Remove once: no supported torch version emits itCOMMENT
LOWpyproject.toml201 # torch.get_autocast_gpu_dtype() in its Triton ssd_combined.py kernel (upstream, not actionable in TRL)COMMENT
LOWpyproject.toml221 # Tracking issue: https://github.com/huggingface/trl/issues/6848COMMENT
LOWtests/test_rloo_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_utils.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/conftest.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_callbacks.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_sft_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/testing_constants.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_chat_template_utils.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_selective_activation_checkpointing.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_grpo_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_grpo_trainer.py1801 @pytest.mark.parametrize(COMMENT
LOWtests/test_grpo_trainer.py2201 # Trainer.__init__ moves the model to args.device, so on a GPU runner the inputs have to be built there too.COMMENT
LOWtests/test_model_utils.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/testing_utils.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_data_utils.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_examples_index.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/__init__.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_vllm_client_server.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_kernels.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_rich_progress_callback.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_activation_offloading.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_rewards.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_cli_utils.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_kto_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_dpo_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_distillation_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_cli.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/test_reward_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/_openreward_echo_env.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_async_distillation_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOW…xperimental/test_self_distillation_trainer_behavior.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_utils.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_a2po_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_gmpo_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_gkd_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_server_distillation_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_tpo_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_sdft_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/__init__.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_sdpo_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_iw_opd_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_gold_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_online_dpo_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_openreward.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_async_grpo_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_ssd_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_harbor.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_orpo_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_cpo_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_openenv_tito.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_merge_model_callback.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/invariant/__init__.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/invariant/test_invariant.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/distributed/__init__.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/distributed/test_distributed.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWdocs/source/jobs_training.md141</hfoption>COMMENT
LOWexamples/grpo_catch/grpo_catch.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWexamples/sft_visual_chat/sft_visual_chat.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
295 more matches not shown…
Decorative Section Separators74 hits · 218 pts
SeverityFileLineSnippetContext
MEDIUMtests/conftest.py27# ============================================================================COMMENT
MEDIUMtests/conftest.py29# ============================================================================COMMENT
MEDIUMtests/conftest.py74# ============================================================================COMMENT
MEDIUMtests/conftest.py76# ============================================================================COMMENT
MEDIUMtests/conftest.py88# ============================================================================COMMENT
MEDIUMexamples/grpo_harbor/harnesses/terminal_notes/env.py60 # ── shell toolkit ───────────────────────────────────────────────────────COMMENT
MEDIUMexamples/grpo_harbor/harnesses/terminal_notes/env.py170 # ── note toolkit (in-env state) ──────────────────────────────────────────COMMENT
MEDIUMexamples/grpo_browsergym/browsergym_llm.py237# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/grpo_browsergym/browsergym_llm.py239# ---------------------------------------------------------------------------COMMENT
MEDIUM⚡examples/grpo_browsergym/browsergym_llm.py256# ---------------------------------------------------------------------------COMMENT
MEDIUM⚡examples/grpo_browsergym/browsergym_llm.py258# ---------------------------------------------------------------------------COMMENT
MEDIUM⚡examples/grpo_browsergym/browsergym_llm.py266# ---------------------------------------------------------------------------COMMENT
MEDIUM⚡examples/grpo_browsergym/browsergym_llm.py268# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/grpo_sudoku/grpo_sudoku.py109# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/grpo_sudoku/grpo_sudoku.py111# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/grpo_sudoku/grpo_sudoku.py191# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/grpo_sudoku/grpo_sudoku.py193# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/grpo_sudoku/grpo_sudoku.py343# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/grpo_sudoku/grpo_sudoku.py345# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/grpo_sudoku/grpo_sudoku.py373# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/grpo_sudoku/grpo_sudoku.py375# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/grpo_sql_agent/grpo_sql_agent.py184# ------------------------COMMENT
MEDIUMexamples/grpo_sql_agent/grpo_sql_agent.py186# ------------------------COMMENT
MEDIUMexamples/grpo_sql_agent/grpo_sql_agent.py231# ------------------------COMMENT
MEDIUMexamples/grpo_sql_agent/grpo_sql_agent.py233# ------------------------COMMENT
MEDIUM⚡examples/grpo_sql_agent/grpo_sql_agent.py260# ------------------------STRING
MEDIUM⚡examples/grpo_sql_agent/grpo_sql_agent.py262# ------------------------STRING
MEDIUM⚡examples/grpo_sql_agent/grpo_sql_agent.py267 # ------------------------STRING
MEDIUM⚡examples/grpo_sql_agent/grpo_sql_agent.py269 # ------------------------STRING
MEDIUMexamples/grpo_sql_agent/grpo_sql_agent.py284 # ------------------------STRING
MEDIUMexamples/grpo_sql_agent/grpo_sql_agent.py286 # ------------------------STRING
MEDIUM⚡examples/grpo_sql_agent/grpo_sql_agent.py298 # ------------------------STRING
MEDIUM⚡examples/grpo_sql_agent/grpo_sql_agent.py300 # ------------------------STRING
MEDIUM⚡examples/grpo_sql_agent/grpo_sql_agent.py310 # ------------------------STRING
MEDIUM⚡examples/grpo_sql_agent/grpo_sql_agent.py312 # ------------------------STRING
MEDIUM⚡examples/grpo_sql_agent/grpo_sql_agent.py315 # ------------------------STRING
MEDIUM⚡examples/grpo_sql_agent/grpo_sql_agent.py317 # ------------------------STRING
MEDIUMexamples/gold_qwen3_vl/gold_qwen3_vl.py110 # ──────────────────────────────────────────────COMMENT
MEDIUMexamples/gold_qwen3_vl/gold_qwen3_vl.py112 # ──────────────────────────────────────────────COMMENT
MEDIUMexamples/gold_qwen3_vl/gold_qwen3_vl.py130 # ──────────────────────────────────────────────COMMENT
MEDIUMexamples/gold_qwen3_vl/gold_qwen3_vl.py132 # ──────────────────────────────────────────────COMMENT
MEDIUMexamples/gold_qwen3_vl/gold_qwen3_vl.py143 # ──────────────────────────────────────────────COMMENT
MEDIUMexamples/gold_qwen3_vl/gold_qwen3_vl.py145 # ──────────────────────────────────────────────COMMENT
MEDIUMexamples/gold_qwen3_vl/gold_qwen3_vl.py189 # ──────────────────────────────────────────────COMMENT
MEDIUMexamples/gold_qwen3_vl/gold_qwen3_vl.py191 # ──────────────────────────────────────────────COMMENT
MEDIUM⚡trl/experimental/iw_opd/iw_opd_trainer.py726 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUM⚡trl/experimental/iw_opd/iw_opd_trainer.py728 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/iw_opd/iw_opd_trainer.py788 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/iw_opd/iw_opd_trainer.py790 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/iw_opd/iw_opd_trainer.py1074 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/iw_opd/iw_opd_trainer.py1076 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/iw_opd/iw_opd_trainer.py1663 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/iw_opd/iw_opd_trainer.py1665 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUM⚡trl/experimental/ssd/ssd_trainer.py290 # ------------------------------------------------------------------COMMENT
MEDIUM⚡trl/experimental/ssd/ssd_trainer.py292 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py340 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py342 # ------------------------------------------------------------------COMMENT
MEDIUM⚡trl/experimental/ssd/ssd_trainer.py359 # ------------------------------------------------------------------COMMENT
MEDIUM⚡trl/experimental/ssd/ssd_trainer.py361 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py442 # ------------------------------------------------------------------COMMENT
14 more matches not shown…
Cross-File Repetition42 hits · 210 pts
SeverityFileLineSnippetContext
HIGHAGENTS.md0brief one-line description of what this does. args: param1 (`str`): description of required param. param2 (`int`, *optioSTRING
HIGHCLAUDE.md0brief one-line description of what this does. args: param1 (`str`): description of required param. param2 (`int`, *optioSTRING
HIGH.cursor/BUGBOT.md0brief one-line description of what this does. args: param1 (`str`): description of required param. param2 (`int`, *optioSTRING
HIGH.ai/AGENTS.md0brief one-line description of what this does. args: param1 (`str`): description of required param. param2 (`int`, *optioSTRING
HIGHtests/test_rloo_trainer.py0test that training works with additional generation kwargs.STRING
HIGHtests/test_grpo_trainer.py0test that training works with additional generation kwargs.STRING
HIGHtests/test_distillation_trainer.py0test that training works with additional generation kwargs.STRING
HIGHtests/test_grpo_trainer.py0asynchronously multiplies two integers. args: a: the first integer. b: the second integer. returns: the product of the tSTRING
HIGHtests/test_vllm_client_server.py0asynchronously multiplies two integers. args: a: the first integer. b: the second integer. returns: the product of the tSTRING
HIGHtests/test_distillation_trainer.py0asynchronously multiplies two integers. args: a: the first integer. b: the second integer. returns: the product of the tSTRING
HIGHdocs/source/grpo_trainer.md0asynchronously multiplies two integers. args: a: the first integer. b: the second integer. returns: the product of the tSTRING
HIGHdocs/source/distillation_trainer.md0asynchronously multiplies two integers. args: a: the first integer. b: the second integer. returns: the product of the tSTRING
HIGHdocs/source/openenv.md0make a guess in the wordle environment. args: guess: the guessed word, formatted as '[abcde]' returns: the feedback messSTRING
HIGHexamples/grpo_multi_env/grpo_multi_env.py0make a guess in the wordle environment. args: guess: the guessed word, formatted as '[abcde]' returns: the feedback messSTRING
HIGHexamples/grpo_wordle/grpo_wordle.py0make a guess in the wordle environment. args: guess: the guessed word, formatted as '[abcde]' returns: the feedback messSTRING
HIGHexamples/grpo_carla/carla_vlm_gemma.py0change lane to avoid obstacles. args: direction: direction to change lane, either "left" or "right". returns: the scene STRING
HIGHexamples/grpo_carla/carla_vlm.py0change lane to avoid obstacles. args: direction: direction to change lane, either "left" or "right". returns: the scene STRING
HIGHexamples/grpo_carla/grpo_carla.py0change lane to avoid obstacles. args: direction: direction to change lane, either "left" or "right". returns: the scene STRING
HIGHexamples/datasets/tldr.py0arguments for the script. args: push_to_hub (`bool`, *optional*, defaults to `false`): whether to push the dataset to thSTRING
HIGHexamples/datasets/deepmath_103k.py0arguments for the script. args: push_to_hub (`bool`, *optional*, defaults to `false`): whether to push the dataset to thSTRING
HIGHexamples/datasets/lm-human-preferences-sentiment.py0arguments for the script. args: push_to_hub (`bool`, *optional*, defaults to `false`): whether to push the dataset to thSTRING
HIGH…mples/datasets/lm-human-preferences-descriptiveness.py0arguments for the script. args: push_to_hub (`bool`, *optional*, defaults to `false`): whether to push the dataset to thSTRING
HIGHexamples/datasets/hh-rlhf-helpful-base.py0arguments for the script. args: push_to_hub (`bool`, *optional*, defaults to `false`): whether to push the dataset to thSTRING
HIGHexamples/datasets/rlaif-v.py0arguments for the script. args: push_to_hub (`bool`, *optional*, defaults to `false`): whether to push the dataset to thSTRING
HIGHexamples/datasets/llava_instruct_mix.py0arguments for the script. args: push_to_hub (`bool`, *optional*, defaults to `false`): whether to push the dataset to thSTRING
HIGHexamples/datasets/ultrafeedback-prompt.py0arguments for the script. args: push_to_hub (`bool`, *optional*, defaults to `false`): whether to push the dataset to thSTRING
HIGHexamples/datasets/tldr_preference.py0arguments for the script. args: push_to_hub (`bool`, *optional*, defaults to `false`): whether to push the dataset to thSTRING
HIGHscripts/generate_zen_multi_image_dataset.py0arguments for the script. args: test_size (`float`, *optional*, defaults to `0.1`): fraction of the dataset to include iSTRING
HIGHscripts/generate_harmony_dataset.py0arguments for the script. args: test_size (`float`, *optional*, defaults to `0.1`): fraction of the dataset to include iSTRING
HIGHscripts/generate_zen_image_dataset.py0arguments for the script. args: test_size (`float`, *optional*, defaults to `0.1`): fraction of the dataset to include iSTRING
HIGHscripts/generate_zen_dataset.py0arguments for the script. args: test_size (`float`, *optional*, defaults to `0.1`): fraction of the dataset to include iSTRING
HIGHscripts/generate_toolcall_dataset.py0arguments for the script. args: test_size (`float`, *optional*, defaults to `0.1`): fraction of the dataset to include iSTRING
HIGHtrl/experimental/iw_opd/iw_opd_trainer.py0trim padded batch tensors into per-sample (prompt+completion) sequences for teacher-server requests.STRING
HIGH…tal/server_distillation/server_distillation_trainer.py0trim padded batch tensors into per-sample (prompt+completion) sequences for teacher-server requests.STRING
HIGHtrl/experimental/sdpo/sdpo_trainer.py0trim padded batch tensors into per-sample (prompt+completion) sequences for teacher-server requests.STRING
HIGHtrl/experimental/sdft/sdft_trainer.py0trim padded batch tensors into per-sample (prompt+completion) sequences for teacher-server requests.STRING
HIGHtrl/experimental/cpo/cpo_trainer.py0compute the kto loss and other metrics for the given batch of inputs for train or test.STRING
HIGHtrl/experimental/orpo/orpo_trainer.py0compute the kto loss and other metrics for the given batch of inputs for train or test.STRING
HIGHtrl/trainer/kto_trainer.py0compute the kto loss and other metrics for the given batch of inputs for train or test.STRING
HIGHtrl/trainer/distillation_trainer.py0tokenize prompts and extract images/multimodal fields for generation.STRING
HIGHtrl/trainer/rloo_trainer.py0tokenize prompts and extract images/multimodal fields for generation.STRING
HIGHtrl/trainer/grpo_trainer.py0tokenize prompts and extract images/multimodal fields for generation.STRING
Unused Imports176 hits · 159 pts
SeverityFileLineSnippetContext
LOWexamples/grpo_harbor/harnesses/__init__.py15CODE
LOWexamples/grpo_harbor/harnesses/__init__.py16CODE
LOWexamples/grpo_harbor/harnesses/__init__.py17CODE
LOWexamples/grpo_harbor/harnesses/bash/__init__.py15CODE
LOW…mples/grpo_harbor/harnesses/terminal_notes/__init__.py15CODE
LOWexamples/grpo_harbor/harnesses/jupyter/kernel_server.py29CODE
LOWexamples/grpo_harbor/harnesses/jupyter/__init__.py15CODE
LOWexamples/grpo_harbor/harnesses/jupyter/run_cell.py25CODE
LOWexamples/async_grpo_harbor/async_grpo_harbor.py74CODE
LOWexamples/async_grpo_harbor/launcher.py69CODE
LOWexamples/grpo_browsergym/grpo_browsergym.py53CODE
LOWexamples/grpo_browsergym/browsergym_llm.py67CODE
LOWexamples/grpo_sudoku/grpo_sudoku.py87CODE
LOWexamples/ssd_codegen/ssd_eval.py59CODE
LOWtrl/__init__.py19CODE
LOWtrl/__init__.py77CODE
LOWtrl/__init__.py77CODE
LOWtrl/__init__.py77CODE
LOWtrl/__init__.py77CODE
LOWtrl/__init__.py83CODE
LOWtrl/__init__.py83CODE
LOWtrl/__init__.py83CODE
LOWtrl/__init__.py83CODE
LOWtrl/__init__.py83CODE
LOWtrl/__init__.py83CODE
LOWtrl/__init__.py83CODE
LOWtrl/__init__.py83CODE
LOWtrl/__init__.py83CODE
LOWtrl/__init__.py83CODE
LOWtrl/__init__.py83CODE
LOWtrl/__init__.py96CODE
LOWtrl/__init__.py97CODE
LOWtrl/__init__.py97CODE
LOWtrl/__init__.py97CODE
LOWtrl/__init__.py97CODE
LOWtrl/__init__.py97CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/__init__.py98CODE
LOWtrl/kernels/__init__.py15CODE
LOWtrl/kernels/__init__.py16CODE
116 more matches not shown…
Deep Nesting140 hits · 124 pts
SeverityFileLineSnippetContext
LOWtests/test_utils.py1102CODE
LOWtests/test_utils.py1133CODE
LOWtests/test_kto_trainer.py1050CODE
LOWtests/test_dpo_trainer.py1035CODE
LOWtests/test_distillation_trainer.py978CODE
LOWtests/experimental/test_openreward.py214CODE
LOWexamples/grpo_catch/grpo_catch.py209CODE
LOW…les/sdft_privileged_context/sdft_privileged_context.py119CODE
LOWexamples/sdpo_math/sdpo_math.py162CODE
LOWexamples/grpo_multi_env/grpo_multi_env.py127CODE
LOWexamples/sft_gemma3_vision/sft_gemma3_vision.py77CODE
LOWexamples/sft_gemma3_vision/sft_gemma3_vision.py96CODE
LOWexamples/grpo_sudoku/grpo_sudoku.py212CODE
LOWexamples/grpo_sudoku/grpo_sudoku.py294CODE
LOWexamples/grpo_sudoku/grpo_sudoku.py378CODE
LOWexamples/grpo_sudoku/grpo_sudoku.py545CODE
LOWexamples/grpo_sql_agent/grpo_sql_agent.py50CODE
LOWexamples/grpo_sql_agent/grpo_sql_agent.py145CODE
LOWscripts/generate_tiny_models/_common.py295CODE
LOWtrl/chat_template_utils.py674CODE
LOWtrl/data_utils.py32CODE
LOWtrl/data_utils.py967CODE
LOWtrl/_compat.py90CODE
LOWtrl/import_utils.py29CODE
LOWtrl/kernels/chunked_logprob.py272CODE
LOWtrl/kernels/chunked_divergence.py247CODE
LOWtrl/kernels/chunked_divergence.py374CODE
LOWtrl/experimental/merge_model_callback.py82CODE
LOWtrl/experimental/merge_model_callback.py260CODE
LOWtrl/experimental/utils.py189CODE
LOWtrl/experimental/utils.py930CODE
LOWtrl/experimental/utils.py950CODE
LOWtrl/experimental/utils.py71CODE
LOWtrl/experimental/utils.py468CODE
LOWtrl/experimental/utils.py485CODE
LOWtrl/experimental/iw_opd/iw_opd_trainer.py226CODE
LOWtrl/experimental/iw_opd/iw_opd_trainer.py385CODE
LOWtrl/experimental/iw_opd/iw_opd_trainer.py695CODE
LOWtrl/experimental/iw_opd/iw_opd_trainer.py847CODE
LOWtrl/experimental/iw_opd/iw_opd_trainer.py889CODE
LOWtrl/experimental/iw_opd/iw_opd_trainer.py946CODE
LOWtrl/experimental/iw_opd/iw_opd_trainer.py1111CODE
LOWtrl/experimental/iw_opd/iw_opd_trainer.py1713CODE
LOWtrl/experimental/sdpo/sdpo_trainer.py172CODE
LOWtrl/experimental/sdpo/sdpo_trainer.py350CODE
LOWtrl/experimental/sdpo/sdpo_trainer.py1142CODE
LOWtrl/experimental/cpo/cpo_trainer.py139CODE
LOWtrl/experimental/cpo/cpo_trainer.py476CODE
LOWtrl/experimental/cpo/cpo_trainer.py614CODE
LOWtrl/experimental/cpo/cpo_trainer.py678CODE
LOWtrl/experimental/harbor/_spec.py66CODE
LOWtrl/experimental/orpo/orpo_trainer.py149CODE
LOWtrl/experimental/orpo/orpo_trainer.py458CODE
LOWtrl/experimental/orpo/orpo_trainer.py606CODE
LOWtrl/experimental/online_dpo/online_dpo_trainer.py177CODE
LOWtrl/experimental/online_dpo/online_dpo_trainer.py815CODE
LOWtrl/experimental/online_dpo/online_dpo_trainer.py885CODE
LOWtrl/experimental/online_dpo/online_dpo_trainer.py947CODE
LOWtrl/experimental/online_dpo/online_dpo_trainer.py1140CODE
LOWtrl/experimental/bema_for_ref_model/callback.py204CODE
80 more matches not shown…
Empty Error Handlers23 hits · 115 pts
SeverityFileLineSnippetContext
HIGHtests/testing_utils.py166except psutil.NoSuchProcess:CODE
HIGHtests/testing_utils.py159except psutil.NoSuchProcess:CODE
HIGHtests/experimental/test_online_dpo_trainer.py300except Exception:CODE
HIGHtests/experimental/test_openreward.py67except requests.RequestException:CODE
HIGHexamples/grpo_harbor/harnesses/jupyter/kernel_server.py54except SystemExit:CODE
HIGHexamples/async_grpo_harbor/launcher.py118except ProcessLookupError:CODE
HIGHexamples/async_grpo_harbor/launcher.py125except ProcessLookupError:CODE
HIGHexamples/grpo_multi_env/grpo_multi_env.py136except Exception:CODE
HIGHexamples/grpo_multi_env/grpo_multi_env.py147except Exception:CODE
HIGHtrl/experimental/harbor/_env.py195except Exception: # noqa: BLE001 — best-effort teardownCODE
HIGH…xperimental/async_distillation/async_rollout_worker.py113except RuntimeError:CODE
HIGH…xperimental/async_distillation/async_rollout_worker.py453except queue.Full:CODE
HIGH…xperimental/async_distillation/async_rollout_worker.py305except Exception:CODE
HIGHtrl/experimental/async_distillation/vllm_client.py63except (requests.ConnectionError, requests.Timeout, OSError):CODE
HIGH…ental/async_distillation/async_distillation_trainer.py688except queue.Full:CODE
HIGHtrl/experimental/async_grpo/async_grpo_trainer.py390except queue.Full:CODE
HIGHtrl/experimental/async_grpo/async_rollout_worker.py262except RuntimeError:CODE
HIGHtrl/experimental/async_grpo/async_rollout_worker.py812except queue.Full:CODE
HIGHtrl/experimental/async_grpo/async_rollout_worker.py707except asyncio.QueueFull:CODE
HIGHtrl/experimental/async_grpo/async_rollout_worker.py511except Exception:CODE
HIGHtrl/experimental/async_grpo/vllm_client.py63except (requests.ConnectionError, requests.Timeout, OSError):CODE
HIGHtrl/models/activation_offloading.py261except (RuntimeError, AttributeError):CODE
HIGHtrl/trainer/utils.py116except ValueError:CODE
Self-Referential Comments39 hits · 104 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_rloo_trainer.py2119 # Create a single processing class (tokenizer)COMMENT
MEDIUMtests/test_rloo_trainer.py2173 # Create a single processing class (tokenizer)COMMENT
MEDIUMtests/test_grpo_trainer.py4132 # Create a single processing class (tokenizer)COMMENT
MEDIUMtests/test_grpo_trainer.py4186 # Create a single processing class (tokenizer)COMMENT
MEDIUM⚡tests/test_cli_utils.py202 # Create the main parserCOMMENT
MEDIUM⚡tests/test_cli_utils.py208 # Create a subparser for a specific commandCOMMENT
MEDIUM⚡tests/test_cli_utils.py228 # Create the main parserCOMMENT
MEDIUM⚡tests/test_cli_utils.py234 # Create a subparser for a specific commandCOMMENT
MEDIUM⚡tests/test_cli_utils.py251 # Create the main parserCOMMENT
MEDIUM⚡tests/test_cli_utils.py257 # Create a subparser for a specific commandCOMMENT
MEDIUM⚡tests/test_cli_utils.py273 # Create the main parserCOMMENT
MEDIUM⚡tests/test_cli_utils.py279 # Create a subparser for a specific commandCOMMENT
MEDIUMtests/test_cli.py174 # Create a temporary config fileCOMMENT
MEDIUMscripts/generate_zen_multi_image_dataset.py76 # Create the imagesSTRING
MEDIUMscripts/generate_zen_multi_image_dataset.py106 # Create the imagesSTRING
MEDIUMscripts/generate_zen_multi_image_dataset.py157 # Create the imagesSTRING
MEDIUMscripts/generate_zen_multi_image_dataset.py229 # Create the imagesSTRING
MEDIUMscripts/generate_zen_multi_image_dataset.py260 # Create the imagesSTRING
MEDIUMtrl/data_utils.py785 # Create a new binCOMMENT
MEDIUMtrl/experimental/merge_model_callback.py37 # Create the repository if it doesn't existCOMMENT
MEDIUM⚡trl/experimental/merge_model_callback.py118 # Create the merge configuration dictionarySTRING
MEDIUM⚡trl/experimental/merge_model_callback.py128 # Create the MergeConfiguration from the dictionarySTRING
MEDIUM⚡trl/experimental/merge_model_callback.py137 # Create the TIES merge configuration dictionarySTRING
MEDIUM⚡trl/experimental/merge_model_callback.py172 # Create the MergeConfiguration from the dictionarySTRING
MEDIUM⚡trl/experimental/merge_model_callback.py181 # Create the DARE TIES merge configuration dictionarySTRING
MEDIUM⚡trl/experimental/merge_model_callback.py216 # Create the MergeConfiguration from the dictionarySTRING
MEDIUM⚡trl/experimental/merge_model_callback.py226 # Create the SLERP merge configuration dictionarySTRING
MEDIUMtrl/experimental/merge_model_callback.py255 # Create the MergeConfiguration from the dictionarySTRING
MEDIUMtrl/experimental/utils.py15# This file contains utility classes and functions that are used across more than one experimental trainer or feature.COMMENT
MEDIUMtrl/experimental/cpo/cpo_trainer.py189 # Initialize this variable to False. This helps tracking the case when `peft_module_casting_to_bf16`COMMENT
MEDIUMtrl/experimental/orpo/orpo_trainer.py199 # Initialize this variable to False. This helps tracking the case when `peft_module_casting_to_bf16`COMMENT
MEDIUMtrl/experimental/online_dpo/online_dpo_trainer.py417 # Define the collator if not providedCOMMENT
MEDIUMtrl/experimental/online_dpo/online_dpo_trainer.py931 # Create the output dict with required fieldsCOMMENT
MEDIUMtrl/trainer/utils.py169 # Create an output tensor filled with the padding valueCOMMENT
MEDIUMtrl/trainer/utils.py180 # Define the slicesCOMMENT
MEDIUMtrl/trainer/utils.py1272# This function is intentionally not used internally. It is provided as a utility for users whose datasets containCOMMENT
MEDIUMtrl/trainer/utils.py928 self.generator = torch.Generator() # Create a local random generatorCODE
MEDIUMtrl/trainer/callbacks.py227 # Create a table per groupCOMMENT
MEDIUMtrl/trainer/callbacks.py704 # Create a new instance and load state_dictSTRING
Docstring Block Structure16 hits · 80 pts
SeverityFileLineSnippetContext
HIGHCONTRIBUTING.md280 Replicate a string `n` times with a separator. Args: string (`str`): String to replicate. STRING
HIGHAGENTS.md92 Brief one-line description of what this does. Args: param1 (`str`): Description of requireSTRING
HIGHCLAUDE.md92 Brief one-line description of what this does. Args: param1 (`str`): Description of requireSTRING
HIGH.cursor/BUGBOT.md92 Brief one-line description of what this does. Args: param1 (`str`): Description of requireSTRING
HIGHtrl/chat_template_utils.py675 Adds the appropriate response template (or legacy schema) to the given tokenizer based on its chat template. ASTRING
HIGHtrl/data_utils.py34 Convert messages into a structured multimodal format and inject the provided images into the message contents. STRING
HIGHtrl/data_utils.py127 Check if the example is in a conversational format. Args: example (`dict[str, Any]`): A siSTRING
HIGHtrl/data_utils.py309 If the example is in a conversational format, apply a chat template to it. Args: example (`dict[str, lSTRING
HIGHtrl/data_utils.py549 Extracts the shared prompt from a preference data example, where the prompt is implicit within both the chosen and STRING
HIGHtrl/data_utils.py928 Check if the example is in a conversational format (from/value). Note that this format isn't recommended. Prefer STRING
HIGH…ental/async_distillation/async_distillation_trainer.py914 Round a LoRA rank up to the smallest `max_lora_rank` vLLM accepts. `max_lora_rank` is a capacity bound rather STRING
HIGHtrl/experimental/gold/gold_trainer.py556 Merge probabilities based on alignment groups, using either the "observed" or "bayesian" strategy (`selSTRING
HIGHtrl/experimental/async_grpo/async_grpo_trainer.py693 Round a LoRA rank up to the smallest `max_lora_rank` vLLM accepts. `max_lora_rank` is a capacity bound rather STRING
HIGHtrl/scripts/vllm_serve.py196 Build the `vllm serve` command line that serves `script_args` the way TRL trainers expect. Beyond the plain arSTRING
HIGHtrl/trainer/utils.py128 Pads a list of tensors to the same shape along the first dimension. Args: tensors (`list[torch.Tensor]STRING
HIGH.ai/AGENTS.md92 Brief one-line description of what this does. Args: param1 (`str`): Description of requireSTRING
Excessive Try-Catch Wrapping64 hits · 72 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_rewards.py229def target():CODE
LOWtests/test_rewards.py232 except Exception as e:CODE
LOWtests/test_distillation_trainer.py1018 except Exception as e:CODE
MEDIUMtests/experimental/test_gold_trainer.py51def openr1_examples():CODE
MEDIUMtests/experimental/test_gold_trainer.py64def countdown_examples():CODE
MEDIUMtests/experimental/test_gold_trainer.py304def vlm_dataset():CODE
LOWtests/experimental/test_gold_trainer.py58 except Exception as exc: # pragma: no cover - network/environment dependentCODE
LOWtests/experimental/test_gold_trainer.py71 except Exception as exc: # pragma: no cover - network/environment dependentCODE
LOWtests/experimental/test_gold_trainer.py311 except Exception as exc: # pragma: no cover - network/environment dependentCODE
LOWtests/experimental/test_gold_trainer.py2721 except Exception as exc: # pragma: no cover - network/environment dependentCODE
LOWtests/experimental/test_gold_trainer.py2772 except Exception as exc: # pragma: no cover - network/environment dependentCODE
LOW⚡tests/experimental/test_online_dpo_trainer.py300 except Exception:CODE
LOWdocs/source/openenv.md406 except Exception:CODE
LOWdocs/source/openenv.md417 except Exception:CODE
LOWexamples/grpo_catch/grpo_catch.py166 except Exception as e:CODE
LOWexamples/grpo_carla/carla_vlm_gemma.py165 except Exception as e:CODE
LOWexamples/grpo_harbor/harnesses/jupyter/kernel_server.py70 except Exception:CODE
MEDIUMexamples/grpo_harbor/harnesses/jupyter/kernel_server.py63def do_POST(self):CODE
LOWexamples/grpo_harbor/harnesses/jupyter/run_cell.py55 except Exception as exc:CODE
LOW…les/sdft_privileged_context/sdft_privileged_context.py199 except Exception:CODE
LOWexamples/grpo_multi_env/grpo_multi_env.py136 except Exception:CODE
LOWexamples/grpo_multi_env/grpo_multi_env.py147 except Exception:CODE
LOWexamples/sft_gemma3_vision/sft_gemma3_vision.py106 except Exception as e:CODE
MEDIUMexamples/sft_gemma3_vision/sft_gemma3_vision.py107 print(f"Error processing image {img_path}: {e}")CODE
MEDIUMscripts/add_copyrights.py48 print(f"Error fetching tracked files: {e}")CODE
LOWtrl/_lazy_module.py72 except Exception as e:CODE
LOWtrl/_compat.py47 except Exception as e:CODE
LOWtrl/_compat.py73 except Exception as e:CODE
LOWtrl/_compat.py130 except Exception as e:CODE
LOWtrl/_compat.py159 except Exception as e:CODE
LOWtrl/experimental/harbor/_spec.py102 except Exception: # noqa: BLE001CODE
LOWtrl/experimental/harbor/_env.py195 except Exception: # noqa: BLE001 — best-effort teardownCODE
MEDIUMtrl/experimental/harbor/_env.py192def __del__(self):CODE
LOWtrl/experimental/openreward/_spec.py176 except Exception: # noqa: BLE001CODE
LOWtrl/experimental/openreward/_spec.py283 except Exception as e: # noqa: BLE001CODE
LOWtrl/experimental/openreward/_spec.py313 except Exception as e: # noqa: BLE001CODE
LOWtrl/experimental/openreward/environment.py262 except Exception as e: # noqa: BLE001CODE
LOWtrl/experimental/openreward/environment.py274 except Exception as e: # noqa: BLE001CODE
LOWtrl/experimental/async_distillation/weight_transfer.py115 except Exception as exc:CODE
LOWtrl/experimental/async_distillation/weight_transfer.py154 except Exception as exc:CODE
LOW…xperimental/async_distillation/async_rollout_worker.py150 except Exception:CODE
LOW…xperimental/async_distillation/async_rollout_worker.py305 except Exception:CODE
LOW…ental/async_distillation/async_distillation_trainer.py589 except Exception as e: # noqa: BLE001CODE
LOW…ental/async_distillation/async_distillation_trainer.py1430 except Exception as error:CODE
LOWtrl/experimental/async_grpo/async_grpo_trainer.py294 except Exception as e: # noqa: BLE001CODE
LOWtrl/experimental/async_grpo/async_grpo_trainer.py1311 except Exception as error:CODE
LOWtrl/experimental/async_grpo/openenv_harness.py163 except Exception:CODE
LOWtrl/experimental/async_grpo/openenv_harness.py188 except Exception:CODE
LOWtrl/experimental/async_grpo/openenv_harness.py256 except Exception:CODE
LOWtrl/experimental/async_grpo/openenv_harness.py263 except Exception:CODE
MEDIUMtrl/experimental/async_grpo/openenv_harness.py160def _close(session):CODE
LOWtrl/experimental/async_grpo/weight_transfer.py123 except Exception as exc:CODE
LOWtrl/experimental/async_grpo/weight_transfer.py162 except Exception as exc:CODE
LOWtrl/experimental/async_grpo/async_rollout_worker.py300 except Exception:CODE
LOWtrl/experimental/async_grpo/async_rollout_worker.py511 except Exception:CODE
LOWtrl/experimental/async_grpo/async_rollout_worker.py971 except Exception as error:CODE
LOWtrl/scripts/utils.py410 except Exception as e:CODE
MEDIUMtrl/scripts/utils.py391def get_git_commit_hash(package_name):CODE
LOWtrl/trainer/distillation_trainer.py1133 except Exception as e:CODE
LOWtrl/trainer/callbacks.py550 except Exception as scorer_e:CODE
4 more matches not shown…
Modern Structural Boilerplate45 hits · 45 pts
SeverityFileLineSnippetContext
LOWexamples/gold_chatbot_arena/gold_chatbot_arena.py79logger = logging.getLogger(__name__)CODE
LOWexamples/grpo_harbor/harnesses/__init__.py20__all__ = ["BashEnv", "JupyterEnv", "TerminalNotesEnv"]CODE
LOWexamples/grpo_harbor/harnesses/bash/__init__.py18__all__ = ["BashEnv"]CODE
LOW…mples/grpo_harbor/harnesses/terminal_notes/__init__.py18__all__ = ["TerminalNotesEnv"]CODE
LOWexamples/grpo_harbor/harnesses/jupyter/env.py52 async def _setup(self) -> None:CODE
LOWexamples/grpo_harbor/harnesses/jupyter/__init__.py18__all__ = ["JupyterEnv"]CODE
LOWexamples/async_grpo_harbor/async_grpo_harbor.py92logger = logging.getLogger(__name__)CODE
LOWtrl/kernels/__init__.py19__all__ = ["ChunkedLogProbFunction", "selective_log_softmax_and_entropy"]CODE
LOWtrl/experimental/merge_model_callback.py32logger = logging.getLogger(__name__)CODE
LOWtrl/experimental/iw_opd/__init__.py19__all__ = ["IWOPDConfig", "IWOPDTrainer"]CODE
LOWtrl/experimental/ssd/__init__.py19__all__ = ["SSDConfig", "SSDTrainer"]CODE
LOWtrl/experimental/sdpo/__init__.py19__all__ = ["SDPOConfig", "SDPOTrainer"]CODE
LOWtrl/experimental/sdpo/teacher_sync.py29logger = logging.getLogger(__name__)CODE
LOWtrl/experimental/sdpo/sdpo_trainer.py673 def _setup_teacher_model(self) -> None:CODE
LOWtrl/experimental/cpo/__init__.py19__all__ = ["CPOConfig", "CPOTrainer"]CODE
LOWtrl/experimental/harbor/__init__.py32__all__ = ["AGENTS", "HarborBashEnv", "HarborEnv", "HarborSpec"]CODE
LOWtrl/experimental/harbor/_env.py156 async def _setup(self) -> None:CODE
LOWtrl/experimental/orpo/__init__.py19__all__ = ["ORPOConfig", "ORPOTrainer"]CODE
LOWtrl/experimental/online_dpo/__init__.py19__all__ = ["OnlineDPOConfig", "OnlineDPOTrainer"]CODE
LOWtrl/experimental/bema_for_ref_model/callback.py25logger = logging.getLogger(__name__)CODE
LOWtrl/experimental/sdft/__init__.py19__all__ = ["SDFTConfig", "SDFTTrainer"]CODE
LOWtrl/experimental/sdft/teacher_sync.py29logger = logging.getLogger(__name__)CODE
LOWtrl/experimental/sdft/sdft_trainer.py468 def _setup_teacher_model(self) -> None:CODE
LOWtrl/experimental/distillation/__init__.py22__all__ = ["DistillationConfig", "DistillationTrainer"]CODE
LOWtrl/experimental/openreward/__init__.py18__all__ = ["OpenRewardSpec"]CODE
LOWtrl/experimental/openreward/_spec.py51logger = logging.getLogger(__name__)CODE
LOWtrl/experimental/openreward/environment.py32logger = logging.getLogger(__name__)CODE
LOWtrl/experimental/gkd/__init__.py19__all__ = ["GKDConfig", "GKDTrainer"]CODE
LOW…xperimental/async_distillation/async_rollout_worker.py704 def update_model_version(self, model_version: int) -> None:CODE
LOWtrl/experimental/async_distillation/vllm_client.py149 def update_weights(self, update_info: dict, timeout: int = 1800) -> None:CODE
LOW…ental/async_distillation/async_distillation_trainer.py460 def update_model_version(self, model_version: int) -> None: ...CODE
LOWtrl/experimental/gold/__init__.py19__all__ = ["GOLDConfig", "GOLDTrainer"]CODE
LOWtrl/experimental/async_grpo/async_grpo_trainer.py145 def update_model_version(self, model_version: int) -> None:CODE
LOWtrl/experimental/async_grpo/async_rollout_worker.py1185 def update_model_version(self, model_version: int) -> None:CODE
LOWtrl/experimental/async_grpo/vllm_client.py161 def update_weights(self, update_info: dict, timeout: int = 1800) -> None:CODE
LOWtrl/experimental/tpo/__init__.py19__all__ = ["TPOConfig", "TPOTrainer"]CODE
LOWtrl/experimental/kto/__init__.py22__all__ = ["KTOConfig", "KTOTrainer"]CODE
LOWtrl/experimental/server_distillation/__init__.py19__all__ = ["ServerDistillationConfig", "ServerDistillationTrainer", "build_teacher_request_inputs"]CODE
LOWtrl/cli/__init__.py18__all__ = ["main"]CODE
LOWtrl/cli/commands/__init__.py36__all__ = ["Command", "get_commands"]CODE
LOWtrl/scripts/utils.py36logger = logging.getLogger(__name__)CODE
LOWtrl/trainer/callbacks.py61logger = logging.getLogger(__name__)CODE
LOWtrl/generation/vllm_generation.py47logger = logging.getLogger(__name__)CODE
LOWtrl/generation/__init__.py20__all__ = []CODE
LOWtrl/generation/vllm_client.py62logger = logging.getLogger(__name__)CODE
Redundant / Tautological Comments23 hits · 36 pts
SeverityFileLineSnippetContext
LOWtests/test_chat_template_utils.py61 # Check if special tokens are correctly setCOMMENT
LOWtests/test_chat_template_utils.py128 # Check if special tokens are correctly setCOMMENT
LOWtests/experimental/test_gkd_trainer.py53 # Set temperature to 0 for deterministic outputCOMMENT
LOWtests/experimental/test_gkd_trainer.py70 # Check if the generated texts start with the original promptsCOMMENT
LOWtests/experimental/test_gkd_trainer.py81 # Check if the two generations are identicalCOMMENT
LOWtests/experimental/test_online_dpo_trainer.py329 # Check if training loss is availableCOMMENT
LOWscripts/add_copyrights.py61 # Check if the exact copyright header existsCOMMENT
LOW.github/workflows/tests.yml94 if: github.ref == 'refs/heads/main' && !cancelled() # Check if the branch is mainCODE
LOW.github/workflows/tests.yml151 if: github.ref == 'refs/heads/main' && !cancelled() # Check if the branch is mainCODE
LOW.github/workflows/tests.yml203 if: github.ref == 'refs/heads/main' && !cancelled() # Check if the branch is mainCODE
LOW.github/workflows/tests.yml259 if: github.ref == 'refs/heads/main' && !cancelled() # Check if the branch is mainCODE
LOW.github/workflows/tests.yml313 if: github.ref == 'refs/heads/main' && !cancelled() # Check if the branch is mainCODE
LOWtrl/experimental/utils.py881 # Check if model is sharded (FSDP/DS-Zero3)COMMENT
LOW⚡trl/models/activation_offloading.py228 # Check if tensor is on CPU (skip offloading)COMMENT
LOW⚡trl/models/activation_offloading.py233 # Check if tensor is too smallCOMMENT
LOW⚡trl/models/activation_offloading.py238 # Check if tensor is a parameter or bufferCOMMENT
LOW⚡trl/models/activation_offloading.py245 # Check if tensor is an FP8 tensor (TorchAO) - skip offloading as they're already compressedCOMMENT
LOW⚡trl/models/activation_offloading.py251 # Check if tensor storage is a model parameter (for FSDP compatibility)COMMENT
LOWtrl/models/activation_offloading.py266 # Check if tensor has broadcast dimensions (stride == 0)COMMENT
LOWtrl/models/activation_offloading.py504 # Check if tensor still exists (might have been cleaned up by a previous node)COMMENT
LOWtrl/models/utils.py284 # Check if the model is already a FSDP model due to `Manual Wrapping` and if so, don't wrap it againCOMMENT
LOWtrl/generation/vllm_client.py285 # Check if the total timeout duration has passedCOMMENT
LOWtrl/extras/profiling.py208 # Check if self is a Trainer-like object with required attributesCOMMENT
AI Structural Patterns32 hits · 30 pts
SeverityFileLineSnippetContext
LOWtests/test_distillation_trainer.py61CODE
LOWtrl/experimental/iw_opd/iw_opd_trainer.py385CODE
LOWtrl/experimental/sdpo/sdpo_trainer.py350CODE
LOWtrl/experimental/cpo/cpo_trainer.py139CODE
LOWtrl/experimental/orpo/orpo_trainer.py149CODE
LOWtrl/experimental/online_dpo/online_dpo_trainer.py177CODE
LOWtrl/experimental/bema_for_ref_model/callback.py130CODE
LOWtrl/experimental/openreward/_spec.py116CODE
LOWtrl/experimental/openreward/environment.py146CODE
LOWtrl/experimental/gkd/gkd_trainer.py111CODE
LOW…xperimental/async_distillation/async_rollout_worker.py196CODE
LOW…ental/async_distillation/async_distillation_trainer.py1210CODE
LOWtrl/experimental/gold/gold_trainer.py787CODE
LOWtrl/experimental/async_grpo/async_grpo_trainer.py1044CODE
LOWtrl/experimental/async_grpo/async_rollout_worker.py316CODE
LOWtrl/experimental/tpo/tpo_trainer.py288CODE
LOW…tal/server_distillation/server_distillation_trainer.py142CODE
LOWtrl/trainer/distillation_trainer.py98CODE
LOWtrl/trainer/distillation_trainer.py312CODE
LOWtrl/trainer/distillation_trainer.py1405CODE
LOWtrl/trainer/reward_trainer.py336CODE
LOWtrl/trainer/sft_trainer.py635CODE
LOWtrl/trainer/callbacks.py648CODE
LOWtrl/trainer/rloo_trainer.py239CODE
LOWtrl/trainer/rloo_trainer.py960CODE
LOWtrl/trainer/kto_trainer.py568CODE
LOWtrl/trainer/grpo_trainer.py302CODE
LOWtrl/trainer/grpo_trainer.py1380CODE
LOWtrl/trainer/dpo_trainer.py514CODE
LOWtrl/generation/vllm_generation.py216CODE
LOWtrl/generation/vllm_client.py346CODE
LOWtrl/generation/vllm_client.py480CODE
AI Slop Vocabulary12 hits · 29 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_grpo_trainer.py2161 return ratios[len(ratios) // 2] # median, robust to per-step noiseCODE
MEDIUMtests/test_grpo_trainer.py2161 return ratios[len(ratios) // 2] # median, robust to per-step noiseCODE
LOWtests/test_kto_trainer.py737 # purposes we will just use the same checkpointCOMMENT
LOWtests/test_dpo_trainer.py645 # purposes we will just just use the same checkpointCOMMENT
MEDIUMexamples/grpo_harbor/harnesses/bash/__init__.py15from trl.experimental.harbor import HarborBashEnv as BashEnv # the built-in bash harnessCODE
MEDIUMexamples/async_grpo_harbor/launcher.py330 # The pinned wheel omits harbor_env.harness; import it from the matching source checkout.COMMENT
MEDIUMtrl/experimental/cpo/cpo_trainer.py494 # 2. https://github.com/EleutherAI/lm-evaluation-harness/pull/531#issuecomment-1595586257COMMENT
MEDIUMtrl/experimental/harbor/_env.py49 #: Extra guidance appended to the task instruction by the harness subclass.COMMENT
MEDIUMtrl/experimental/harbor/_env.py123 await self._setup() # harness-specific sandbox prep (e.g. start a Jupyter kernel)CODE
MEDIUMtrl/experimental/harbor/_env.py231#: import path / file path resolving to one) for a custom harness.COMMENT
MEDIUMtrl/experimental/orpo/orpo_trainer.py476 # 2. https://github.com/EleutherAI/lm-evaluation-harness/pull/531#issuecomment-1595586257COMMENT
MEDIUMtrl/generation/vllm_client.py221 # This is not strictly required for correctness, but it helps make training more robust to rare, transientCOMMENT
Hallucination Indicators2 hits · 25 pts
SeverityFileLineSnippetContext
CRITICAL⚡trl/models/activation_offloading.py406 torch.autograd.variable.Variable._execution_engine.queue_callback(wait_and_del_remaining_references)CODE
CRITICALtrl/generation/vllm_generation.py511 self.llm.llm_engine.model_executor.driver_worker.model_runner.model.load_weights([(name, param)])CODE
Cross-Language Confusion5 hits · 18 pts
SeverityFileLineSnippetContext
HIGHexamples/grpo_harbor/harnesses/terminal_notes/env.py79 f"mkfifo {pipe} 2>/dev/null; ( nohup setsid bash -c {shlex.quote(command)} <{pipe} >{log} 2>&1 ) & echo $!",CODE
HIGHexamples/grpo_harbor/harnesses/jupyter/env.py56 await self._env.exec("which curl >/dev/null 2>&1 || apt-get install -y curl", timeout_sec=120)CODE
HIGHexamples/grpo_wordle/grpo_wordle.py80uv venv && source .venv/bin/activateSTRING
HIGHtrl/data_utils.py681 elif not first_column_offsets.equals(column.offsets):STRING
HIGHtrl/kernels/chunked_divergence.py241 `beta` selects the divergence: `0.0` is the forward KL(teacher || student), `1.0` the reverse KL(student ||STRING
AI Response Leakage1 hit · 8 pts
SeverityFileLineSnippetContext
HIGHdocs/source/customization.md128 # In this example: the hinge loss from https://huggingface.co/papers/2309.06657COMMENT
Modern AI Meta-Vocabulary3 hits · 4 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_data_utils.py658 # chosen keeps its reasoning trace, rejected doesn't: the common prefix of the two rendered strings endsSTRING
MEDIUMdocs/source/openenv.md3[OpenEnv](https://github.com/huggingface/OpenEnv) is an open-source framework for defining, deploying, and interacting wCODE
MEDIUMdocs/source/harbor.md3[Harbor](https://www.harborframework.com) is a framework for running agentic tasks in sandboxes. It decouples a **task**CODE
Fake / Example Data3 hits · 4 pts
SeverityFileLineSnippetContext
LOW⚡trl/chat_template_utils.py125 dummy_token = AddedToken(f"<extra_id_{idx}>")CODE
LOW⚡trl/chat_template_utils.py126 is_added = tokenizer.add_tokens(dummy_token)CODE
LOW⚡trl/chat_template_utils.py129 added_tokens.append(dummy_token)CODE
Overly Generic Function Names2 hits · 2 pts
SeverityFileLineSnippetContext
LOWtests/test_utils.py326 def test_function(self):CODE
LOWtests/test_utils.py356 def test_function(self):CODE
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippetContext
LOWtrl/generation/vllm_client.py866# Example usageCOMMENT