Repository Analysis

huggingface/trl

Train transformer language models with reinforcement learning.

19.6 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of huggingface/trl, a Python project with 18,834 GitHub stars. SynthScan v2.0 examined 131,675 lines of code across 479 source files, recording 2112 pattern matches distributed across 20 syntactic categories. The overall adjusted score of 19.6 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).

19.6
Adjusted Score
19.6
Raw Score
100%
Time Factor
2026-07-14
Last Push
18.8K
Stars
Python
Language
131.7K
Lines of Code
479
Files
2.1K
Pattern Hits
2026-07-14
Scan Date
0.16
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 6HIGH 73MEDIUM 161LOW 1872

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 2112 distinct pattern matches across 20 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.

Hyper-Verbose Identifiers969 hits · 846 pts
SeverityFileLineSnippetContext
LOWtests/test_skills_cli.py26 def test_cmd_list_without_target(self, capsys):CODE
LOWtests/test_skills_cli.py38 def test_cmd_list_with_target(self, tmp_path, capsys):CODE
LOWtests/test_skills_cli.py51 def test_cmd_list_empty_target(self, tmp_path, capsys):CODE
LOWtests/test_skills_cli.py61 def test_cmd_install_single_skill(self, tmp_path, capsys):CODE
LOWtests/test_skills_cli.py73 def test_cmd_install_all_skills(self, tmp_path, capsys):CODE
LOWtests/test_skills_cli.py85 def test_cmd_install_no_skill_or_all(self, capsys):CODE
LOWtests/test_skills_cli.py95 def test_cmd_install_both_skill_and_all(self, capsys):CODE
LOWtests/test_skills_cli.py105 def test_cmd_install_nonexistent_skill(self, tmp_path, capsys):CODE
LOWtests/test_skills_cli.py116 def test_cmd_install_already_exists(self, tmp_path, capsys):CODE
LOWtests/test_skills_cli.py130 def test_cmd_install_with_force(self, tmp_path, capsys):CODE
LOWtests/test_skills_cli.py144 def test_cmd_uninstall_success(self, tmp_path, capsys):CODE
LOWtests/test_skills_cli.py159 def test_cmd_uninstall_not_installed(self, tmp_path, capsys):CODE
LOWtests/test_skills_cli.py170 def test_cmd_install_creates_target_directory(self, tmp_path, capsys):CODE
LOWtests/test_skills_cli.py187 def test_cmd_uninstall_invalid_target(self, capsys):CODE
LOWtests/test_skills_cli.py201 def test_add_skills_subcommands_creates_parsers(self):CODE
LOWtests/test_skills_cli.py222 def test_list_command_optional_target(self):CODE
LOWtests/test_skills_cli.py236 def test_default_target_is_agents(self):CODE
LOWtests/test_skills_cli.py281 def test_default_scope_is_project(self):CODE
LOWtests/test_rloo_trainer.py106 def test_train_dataset_format(self, config_name):CODE
LOWtests/test_rloo_trainer.py181 def test_train_with_num_generations_eval(self):CODE
LOWtests/test_rloo_trainer.py206 def test_init_with_eval_dataset(self, eval_dataset_type):CODE
LOWtests/test_rloo_trainer.py238 def test_init_with_iterable_eval_dataset_raises(self, eval_dataset_type):CODE
LOWtests/test_rloo_trainer.py263 def test_evaluate_with_eval_dataset(self, eval_dataset_type):CODE
LOWtests/test_rloo_trainer.py290 def test_train_multiple_iterations(self):CODE
LOWtests/test_rloo_trainer.py394 def test_train_moe_peft_model(self):CODE
LOWtests/test_rloo_trainer.py439 def test_train_peft_with_gradient_checkpointing(self):CODE
LOWtests/test_rloo_trainer.py475 def test_train_different_reward_model(self):CODE
LOWtests/test_rloo_trainer.py514 def test_train_reward_func_standard(self):CODE
LOWtests/test_rloo_trainer.py548 def test_train_reward_func_conversational(self):CODE
LOWtests/test_rloo_trainer.py583 def test_train_multiple_reward_funcs(self):CODE
LOWtests/test_rloo_trainer.py621 def test_train_sync_and_async_reward_funcs(self):CODE
LOWtests/test_rloo_trainer.py670 def non_applicable_reward_func(completions, **kwargs):CODE
LOWtests/test_rloo_trainer.py706 def test_train_multiple_reward_funcs_with_weights(self):CODE
LOWtests/test_rloo_trainer.py750 def test_reward_metric_reflects_reward_weights(self):CODE
LOWtests/test_rloo_trainer.py787 def test_train_multiple_mixed_reward_funcs(self):CODE
LOWtests/test_rloo_trainer.py821 def test_train_reward_func_additional_column(self):CODE
LOWtests/test_rloo_trainer.py861 def test_train_with_sync_ref_model(self):CODE
LOWtests/test_rloo_trainer.py926 def test_train_with_pad_to_multiple_of(self):CODE
LOWtests/test_rloo_trainer.py1006 def test_train_vllm_structured_outputs(self):CODE
LOWtests/test_rloo_trainer.py1038 def test_train_with_additional_generation_kwargs(self):CODE
LOWtests/test_rloo_trainer.py1075 def test_train_vllm_with_additional_generation_kwargs(self):CODE
LOWtests/test_rloo_trainer.py1111 def test_train_with_normalized_advantages(self):CODE
LOWtests/test_rloo_trainer.py1141 def test_train_with_clipped_rewards(self):CODE
LOWtests/test_rloo_trainer.py1172 def test_train_with_mask_truncated_completions(self, mock_generate):CODE
LOWtests/test_rloo_trainer.py1221 def test_train_with_mask_truncated_completions_all_masked(self):CODE
LOWtests/test_rloo_trainer.py1259 def test_warning_raised_all_rewards_none(self, caplog):CODE
LOWtests/test_rloo_trainer.py1288 def test_train_num_generations_larger_than_batch_size(self):CODE
LOWtests/test_rloo_trainer.py1318 def test_train_multiple_dataloader_workers(self):CODE
LOWtests/test_rloo_trainer.py1359 def test_train_with_generation_kwargs(self):CODE
LOWtests/test_rloo_trainer.py1390 def test_train_with_reward_func_accessing_trainer_state(self):CODE
LOWtests/test_rloo_trainer.py1415 def test_train_reward_func_with_log_extra(self):CODE
LOWtests/test_rloo_trainer.py1441 def test_train_reward_func_with_log_metric(self):CODE
LOWtests/test_rloo_trainer.py1468 def test_prepare_input_called_with_correct_data(self):CODE
LOWtests/test_rloo_trainer.py1519 def test_train_with_chat_template_kwargs(self):CODE
LOWtests/test_rloo_trainer.py1549 def test_mismatched_reward_processing_classes_length(self):CODE
LOWtests/test_rloo_trainer.py1575 def test_correct_reward_processing_classes_list(self):CODE
LOWtests/test_rloo_trainer.py1606 def test_single_reward_model_with_single_processing_class(self):CODE
LOWtests/test_rloo_trainer.py1708 def test_train_vlm_with_pad_to_multiple_of(self):CODE
LOWtests/test_rloo_trainer.py1751 def test_train_vlm_beta_non_zero(self, model_id):CODE
LOWtests/test_rloo_trainer.py1890 def test_train_vlm_multi_image(self, model_id):CODE
909 more matches not shown…
Over-Commented Block361 hits · 353 pts
SeverityFileLineSnippetContext
LOWtests/test_skills_cli.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
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_grpo_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.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/__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_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_skills.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_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
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_nash_md_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_minillm_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_gspo_token_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_xpo_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_prm_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_openreward.py201 # If a task spec ever shipped a `prompt` key, the metadata loop mustCOMMENT
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
LOW…s/experimental/test_grpo_with_replay_buffer_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_bco_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_distillation_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_modeling_value_head.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_dppo_trainer.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
LOWtests/experimental/test_ppo_trainer.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
LOWexamples/accelerate_configs/alst_ulysses_4gpu.yaml1# ALST/Ulysses Sequence Parallelism with 2D Parallelism (DP + SP) for 4 GPUsCOMMENT
LOWexamples/datasets/tldr.py1# Copyright 2020-2026 The HuggingFace Team. All rights reserved.COMMENT
301 more matches not shown…
Cross-File Repetition51 hits · 255 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_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
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/openenv.md0make a guess in the wordle environment. args: guess: the guessed word, formatted as '[abcde]' returns: the feedback messSTRING
HIGHexamples/scripts/openenv/multi_env.py0make a guess in the wordle environment. args: guess: the guessed word, formatted as '[abcde]' returns: the feedback messSTRING
HIGHexamples/scripts/openenv/wordle.py0make a guess in the wordle environment. args: guess: the guessed word, formatted as '[abcde]' returns: the feedback messSTRING
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
HIGHexamples/datasets/prm800k.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/math_shepherd.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
HIGHexamples/scripts/openenv/carla_vlm_gemma.py0change lane to avoid obstacles. args: direction: direction to change lane, either "left" or "right". returns: the scene STRING
HIGHexamples/scripts/openenv/carla_vlm.py0change lane to avoid obstacles. args: direction: direction to change lane, either "left" or "right". returns: the scene STRING
HIGHexamples/scripts/openenv/carla.py0change lane to avoid obstacles. args: direction: direction to change lane, either "left" or "right". returns: the scene STRING
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/sdpo/sdpo_trainer.py0trim padded batch tensors into per-sample sequences for teacher-server requests.STRING
HIGHtrl/experimental/sdft/sdft_trainer.py0trim padded batch tensors into per-sample sequences for teacher-server requests.STRING
HIGHtrl/experimental/distillation/distillation_trainer.py0trim padded batch tensors into per-sample 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/bco/bco_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/experimental/cpo/cpo_trainer.py0generate samples from the model and reference model for the given batch of inputs.STRING
HIGHtrl/experimental/bco/bco_trainer.py0generate samples from the model and reference model for the given batch of inputs.STRING
HIGHtrl/experimental/orpo/orpo_trainer.py0generate samples from the model and reference model for the given batch of inputs.STRING
HIGHtrl/experimental/cpo/cpo_trainer.py0overriding built-in evaluation loop to store metrics for each batch. prediction/evaluation loop, shared by `trainer.evalSTRING
HIGHtrl/experimental/bco/bco_trainer.py0overriding built-in evaluation loop to store metrics for each batch. prediction/evaluation loop, shared by `trainer.evalSTRING
HIGHtrl/experimental/orpo/orpo_trainer.py0overriding built-in evaluation loop to store metrics for each batch. prediction/evaluation loop, shared by `trainer.evalSTRING
HIGHtrl/experimental/cpo/cpo_trainer.py0log `logs` on the various objects watching training, including stored metrics. args: logs (`dict[str, float]`): the valuSTRING
HIGHtrl/experimental/bco/bco_trainer.py0log `logs` on the various objects watching training, including stored metrics. args: logs (`dict[str, float]`): the valuSTRING
HIGHtrl/experimental/orpo/orpo_trainer.py0log `logs` on the various objects watching training, including stored metrics. args: logs (`dict[str, float]`): the valuSTRING
HIGHtrl/experimental/distillation/distillation_trainer.py0backbone forward used by the liger jsd path (skips lm_head to save memory).STRING
HIGHtrl/experimental/gkd/gkd_trainer.py0backbone forward used by the liger jsd path (skips lm_head to save memory).STRING
HIGHtrl/experimental/gold/gold_trainer.py0backbone forward used by the liger jsd path (skips lm_head to save memory).STRING
HIGHtrl/experimental/dppo/dppo_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
Decorative Section Separators72 hits · 212 pts
SeverityFileLineSnippetContext
MEDIUMtests/conftest.py54# ============================================================================COMMENT
MEDIUMtests/conftest.py56# ============================================================================COMMENT
MEDIUMtests/conftest.py68# ============================================================================COMMENT
MEDIUMexamples/scripts/grpo_agent.py184# ------------------------COMMENT
MEDIUMexamples/scripts/grpo_agent.py186# ------------------------COMMENT
MEDIUMexamples/scripts/grpo_agent.py231# ------------------------COMMENT
MEDIUMexamples/scripts/grpo_agent.py233# ------------------------COMMENT
MEDIUMexamples/scripts/grpo_agent.py260# ------------------------STRING
MEDIUMexamples/scripts/grpo_agent.py262# ------------------------STRING
MEDIUMexamples/scripts/grpo_agent.py267 # ------------------------STRING
MEDIUMexamples/scripts/grpo_agent.py269 # ------------------------STRING
MEDIUMexamples/scripts/grpo_agent.py284 # ------------------------STRING
MEDIUMexamples/scripts/grpo_agent.py286 # ------------------------STRING
MEDIUMexamples/scripts/grpo_agent.py298 # ------------------------STRING
MEDIUMexamples/scripts/grpo_agent.py300 # ------------------------STRING
MEDIUMexamples/scripts/grpo_agent.py310 # ------------------------STRING
MEDIUMexamples/scripts/grpo_agent.py312 # ------------------------STRING
MEDIUMexamples/scripts/grpo_agent.py315 # ------------------------STRING
MEDIUMexamples/scripts/grpo_agent.py317 # ------------------------STRING
MEDIUMexamples/scripts/harbor/harnesses/terminal_notes/env.py60 # ── shell toolkit ───────────────────────────────────────────────────────COMMENT
MEDIUMexamples/scripts/harbor/harnesses/terminal_notes/env.py170 # ── note toolkit (in-env state) ──────────────────────────────────────────COMMENT
MEDIUMexamples/scripts/openenv/browsergym_llm.py234# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/browsergym_llm.py236# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/browsergym_llm.py253# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/browsergym_llm.py255# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/browsergym_llm.py263# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/browsergym_llm.py265# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/sudoku.py106# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/sudoku.py108# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/sudoku.py188# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/sudoku.py190# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/sudoku.py340# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/sudoku.py342# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/sudoku.py370# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/scripts/openenv/sudoku.py372# ---------------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py273 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py275 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py323 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py325 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py342 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py344 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py425 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py427 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py476 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/ssd/ssd_trainer.py478 # ------------------------------------------------------------------COMMENT
MEDIUMtrl/experimental/harbor/_spec.py157 # ── public surface ──────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/harbor/_env.py99 # ── harbor lifecycle (async, run on this env's loop) ────────────────────COMMENT
MEDIUMtrl/experimental/distillation/distillation_trainer.py734 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/distillation/distillation_trainer.py736 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/distillation/distillation_trainer.py796 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/distillation/distillation_trainer.py798 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/distillation/distillation_trainer.py1054 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/distillation/distillation_trainer.py1056 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/distillation/distillation_trainer.py1647 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/distillation/distillation_trainer.py1649 # ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/openreward/_spec.py144 # ── public surface ──────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/openreward/_spec.py251 # ── internals ───────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/openreward/environment.py101# ────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/openreward/environment.py204 # ── TRL contract ─────────────────────────────────────────────────COMMENT
MEDIUMtrl/experimental/openreward/environment.py252 # ── helpers ──────────────────────────────────────────────────────COMMENT
12 more matches not shown…
Unused Imports191 hits · 176 pts
SeverityFileLineSnippetContext
LOWexamples/scripts/ssd_eval.py59CODE
LOWexamples/scripts/harbor/harnesses/__init__.py15CODE
LOWexamples/scripts/harbor/harnesses/__init__.py16CODE
LOWexamples/scripts/harbor/harnesses/__init__.py17CODE
LOWexamples/scripts/harbor/harnesses/bash/__init__.py15CODE
LOW…es/scripts/harbor/harnesses/terminal_notes/__init__.py15CODE
LOW…ples/scripts/harbor/harnesses/jupyter/kernel_server.py29CODE
LOWexamples/scripts/harbor/harnesses/jupyter/__init__.py15CODE
LOWexamples/scripts/harbor/harnesses/jupyter/run_cell.py25CODE
LOWexamples/scripts/openenv/browsergym_llm.py64CODE
LOWexamples/scripts/openenv/sudoku.py84CODE
LOWexamples/scripts/openenv/browsergym.py50CODE
LOWtrl/__init__.py19CODE
LOWtrl/__init__.py76CODE
LOWtrl/__init__.py76CODE
LOWtrl/__init__.py76CODE
LOWtrl/__init__.py76CODE
LOWtrl/__init__.py82CODE
LOWtrl/__init__.py82CODE
LOWtrl/__init__.py82CODE
LOWtrl/__init__.py82CODE
LOWtrl/__init__.py82CODE
LOWtrl/__init__.py82CODE
LOWtrl/__init__.py82CODE
LOWtrl/__init__.py82CODE
LOWtrl/__init__.py82CODE
LOWtrl/__init__.py82CODE
LOWtrl/__init__.py82CODE
LOWtrl/__init__.py82CODE
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/experimental/utils.py55CODE
LOWtrl/experimental/ssd/__init__.py15CODE
LOWtrl/experimental/ssd/__init__.py16CODE
LOWtrl/experimental/ssd/ssd_trainer.py23CODE
LOWtrl/experimental/sdpo/__init__.py15CODE
131 more matches not shown…
Self-Referential Comments59 hits · 168 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_rloo_trainer.py1559 # Create a single processing class (tokenizer)COMMENT
MEDIUMtests/test_rloo_trainer.py1613 # Create a single processing class (tokenizer)COMMENT
MEDIUMtests/test_grpo_trainer.py94 # Create a mock trainer with minimal setupCOMMENT
MEDIUMtests/test_grpo_trainer.py97 # Create a mock acceleratorCOMMENT
MEDIUMtests/test_grpo_trainer.py101 # Create a minimal trainer instance just to access the methodCOMMENT
MEDIUMtests/test_grpo_trainer.py3213 # Create a single processing class (tokenizer)COMMENT
MEDIUMtests/test_grpo_trainer.py3267 # Create a single processing class (tokenizer)COMMENT
MEDIUMtests/test_grpo_trainer.py4139 # Create a VLM processorCOMMENT
MEDIUMtests/test_cli_utils.py176 # Create the main parserCOMMENT
MEDIUMtests/test_cli_utils.py182 # Create a subparser for a specific commandCOMMENT
MEDIUMtests/test_cli_utils.py202 # Create the main parserCOMMENT
MEDIUMtests/test_cli_utils.py208 # Create a subparser for a specific commandCOMMENT
MEDIUMtests/test_cli_utils.py225 # Create the main parserCOMMENT
MEDIUMtests/test_cli_utils.py231 # Create a subparser for a specific commandCOMMENT
MEDIUMtests/test_cli_utils.py247 # Create the main parserCOMMENT
MEDIUMtests/test_cli_utils.py253 # Create a subparser for a specific commandCOMMENT
MEDIUMtests/test_skills.py188 # Create a file instead of directoryCOMMENT
MEDIUMtests/test_skills.py199 # Create a skill with subdirectoriesCOMMENT
MEDIUMtests/test_skills.py264 # Create a skill with multiple filesCOMMENT
MEDIUMtests/test_skills.py171 # Create a symlinkCOMMENT
MEDIUMtests/test_skills.py217 # Create a skillCOMMENT
MEDIUMtests/test_skills.py435 # Create a real skillCOMMENT
MEDIUMtests/test_cli.py101 # Create a temporary config fileCOMMENT
MEDIUMtests/experimental/test_prm_trainer.py126 # Define the input featuresCOMMENT
MEDIUMtests/experimental/test_prm_trainer.py150 # Define the input featuresCOMMENT
MEDIUMtests/experimental/test_prm_trainer.py173 # Define the input featuresCOMMENT
MEDIUMtests/experimental/test_prm_trainer.py197 # Define the input featuresCOMMENT
MEDIUMtests/experimental/test_prm_trainer.py221 # Define the input featuresCOMMENT
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.py792 # Create a new binCOMMENT
MEDIUMtrl/experimental/merge_model_callback.py37 # Create the repository if it doesn't existCOMMENT
MEDIUMtrl/experimental/merge_model_callback.py118 # Create the merge configuration dictionarySTRING
MEDIUMtrl/experimental/merge_model_callback.py128 # Create the MergeConfiguration from the dictionarySTRING
MEDIUMtrl/experimental/merge_model_callback.py137 # Create the TIES merge configuration dictionarySTRING
MEDIUMtrl/experimental/merge_model_callback.py172 # Create the MergeConfiguration from the dictionarySTRING
MEDIUMtrl/experimental/merge_model_callback.py181 # Create the DARE TIES merge configuration dictionarySTRING
MEDIUMtrl/experimental/merge_model_callback.py216 # Create the MergeConfiguration from the dictionarySTRING
MEDIUMtrl/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.py184 # Initialize this variable to False. This helps tracking the case when `peft_module_casting_to_bf16`COMMENT
MEDIUMtrl/experimental/bco/bco_trainer.py493 # Initialize this variable to False. This helps tracking the case when `peft_module_casting_to_bf16`COMMENT
MEDIUMtrl/experimental/orpo/orpo_trainer.py194 # Initialize this variable to False. This helps tracking the case when `peft_module_casting_to_bf16`COMMENT
MEDIUMtrl/experimental/online_dpo/online_dpo_trainer.py389 # Define the collator if not providedCOMMENT
MEDIUMtrl/experimental/online_dpo/online_dpo_trainer.py887 # Create the output dict with required fieldsCOMMENT
MEDIUMtrl/experimental/prm/prm_trainer.py339 # Create the labelSTRING
MEDIUMtrl/experimental/ppo/ppo_trainer.py386 # Define the collator if not providedCOMMENT
MEDIUMtrl/scripts/vllm_serve.py109 # Create a stateless process group to manage communication between training processes and vLLM workers.COMMENT
MEDIUMtrl/scripts/vllm_serve.py489 # Define the endpoints for the model serverSTRING
MEDIUMtrl/trainer/utils.py161 # Create an output tensor filled with the padding valueCOMMENT
MEDIUMtrl/trainer/utils.py172 # Define the slicesCOMMENT
MEDIUMtrl/trainer/utils.py760 self.generator = torch.Generator() # Create a local random generatorCODE
MEDIUMtrl/trainer/utils.py1015# This function is intentionally not used internally. It is provided as a utility for users whose datasets containCOMMENT
MEDIUMtrl/trainer/callbacks.py220 # Create a table per groupCOMMENT
MEDIUMtrl/trainer/callbacks.py695 # Create a new instance and load state_dictSTRING
Deep Nesting155 hits · 142 pts
SeverityFileLineSnippetContext
LOWtests/test_utils.py841CODE
LOWtests/test_utils.py872CODE
LOWtests/test_grpo_trainer.py3996CODE
LOWtests/test_grpo_trainer.py4111CODE
LOWtests/test_grpo_trainer.py4259CODE
LOWtests/test_kto_trainer.py904CODE
LOWtests/test_dpo_trainer.py921CODE
LOWexamples/datasets/math_shepherd.py52CODE
LOWexamples/scripts/sdft.py119CODE
LOWexamples/scripts/sft_vlm_gemma3.py77CODE
LOWexamples/scripts/sft_vlm_gemma3.py96CODE
LOWexamples/scripts/grpo_agent.py50CODE
LOWexamples/scripts/grpo_agent.py145CODE
LOWexamples/scripts/sdpo.py162CODE
LOWexamples/scripts/distillation.py81CODE
LOWexamples/scripts/openenv/multi_env.py127CODE
LOWexamples/scripts/openenv/catch.py206CODE
LOWexamples/scripts/openenv/sudoku.py209CODE
LOWexamples/scripts/openenv/sudoku.py291CODE
LOWexamples/scripts/openenv/sudoku.py375CODE
LOWexamples/scripts/openenv/sudoku.py542CODE
LOWscripts/log_reports.py34CODE
LOWscripts/generate_tiny_models/_common.py256CODE
LOWtrl/chat_template_utils.py537CODE
LOWtrl/data_utils.py33CODE
LOWtrl/data_utils.py127CODE
LOWtrl/data_utils.py973CODE
LOWtrl/_compat.py86CODE
LOWtrl/import_utils.py29CODE
LOWtrl/experimental/merge_model_callback.py82CODE
LOWtrl/experimental/merge_model_callback.py260CODE
LOWtrl/experimental/utils.py191CODE
LOWtrl/experimental/utils.py934CODE
LOWtrl/experimental/utils.py954CODE
LOWtrl/experimental/utils.py73CODE
LOWtrl/experimental/utils.py470CODE
LOWtrl/experimental/utils.py487CODE
LOWtrl/experimental/sdpo/sdpo_trainer.py177CODE
LOWtrl/experimental/sdpo/sdpo_trainer.py346CODE
LOWtrl/experimental/sdpo/sdpo_trainer.py1167CODE
LOWtrl/experimental/cpo/cpo_trainer.py138CODE
LOWtrl/experimental/cpo/cpo_trainer.py480CODE
LOWtrl/experimental/cpo/cpo_trainer.py613CODE
LOWtrl/experimental/cpo/cpo_trainer.py677CODE
LOWtrl/experimental/bco/bco_trainer.py425CODE
LOWtrl/experimental/bco/bco_trainer.py1072CODE
LOWtrl/experimental/bco/bco_trainer.py1275CODE
LOWtrl/experimental/bco/bco_trainer.py1404CODE
LOWtrl/experimental/harbor/_spec.py65CODE
LOWtrl/experimental/orpo/orpo_trainer.py148CODE
LOWtrl/experimental/orpo/orpo_trainer.py466CODE
LOWtrl/experimental/orpo/orpo_trainer.py609CODE
LOWtrl/experimental/online_dpo/online_dpo_trainer.py172CODE
LOWtrl/experimental/online_dpo/online_dpo_trainer.py765CODE
LOWtrl/experimental/online_dpo/online_dpo_trainer.py841CODE
LOWtrl/experimental/online_dpo/online_dpo_trainer.py903CODE
LOWtrl/experimental/online_dpo/online_dpo_trainer.py1097CODE
LOWtrl/experimental/bema_for_ref_model/callback.py202CODE
LOWtrl/experimental/distillation/distillation_trainer.py233CODE
LOWtrl/experimental/distillation/distillation_trainer.py385CODE
95 more matches not shown…
Docstring Block Structure18 hits · 90 pts
SeverityFileLineSnippetContext
HIGHCONTRIBUTING.md268 Replicate a string `n` times with a separator. Args: string (`str`): String to replicate. STRING
HIGHAGENTS.md71 Brief one-line description of what this does. Args: param1 (`str`): Description of requireSTRING
HIGHCLAUDE.md71 Brief one-line description of what this does. Args: param1 (`str`): Description of requireSTRING
HIGH.cursor/BUGBOT.md71 Brief one-line description of what this does. Args: param1 (`str`): Description of requireSTRING
HIGHtrl/chat_template_utils.py538 Adds the appropriate response template (or legacy schema) to the given tokenizer based on its chat template. ASTRING
HIGHtrl/data_utils.py35 Convert messages into a structured multimodal format and inject the provided images into the message contents. STRING
HIGHtrl/data_utils.py161 Check if the example is in a conversational format. Args: example (`dict[str, Any]`): A siSTRING
HIGHtrl/data_utils.py341 If the example is in a conversational format, apply a chat template to it. Args: example (`dict[str, lSTRING
HIGHtrl/data_utils.py556 Extracts the shared prompt from a preference data example, where the prompt is implicit within both the chosen and STRING
HIGHtrl/data_utils.py934 Check if the example is in a conversational format (from/value). Note that this format isn't recommended. Prefer STRING
HIGHtrl/experimental/gold/gold_trainer.py567 Merge probabilities based on alignment groups, using either the "observed" or "bayesian" strategy (`selSTRING
HIGHtrl/skills/skills.py69 Resolve target to a concrete directory path. Converts semantic agent names (e.g., 'claude') with scope to actuSTRING
HIGHtrl/skills/skills.py180 Install a skill to target directory. Args: skill_name (`str`): Name of skill to install. targeSTRING
HIGHtrl/skills/skills.py247 Install a skill. Args: skill_name (`str`): Name of skill to install. target (`str | Path`): AgSTRING
HIGHtrl/skills/skills.py291 Uninstall a skill from target directory. Args: skill_name (`str`): Name of skill to uninstall. STRING
HIGHtrl/skills/skills.py323 Uninstall a skill. Args: skill_name (`str`): Name of skill to uninstall. target (`str | Path`)STRING
HIGHtrl/trainer/utils.py120 Pads a list of tensors to the same shape along the first dimension. Args: tensors (`list[torch.Tensor]STRING
HIGH.ai/AGENTS.md71 Brief one-line description of what this does. Args: param1 (`str`): Description of requireSTRING
Excessive Try-Catch Wrapping64 hits · 73 pts
SeverityFileLineSnippetContext
LOWtests/test_sft_trainer.py2374 except Exception:CODE
LOWtests/test_grpo_trainer.py4099 except Exception as e:CODE
LOWtests/test_grpo_trainer.py4226 except Exception as e:CODE
LOWtests/test_grpo_trainer.py4293 except Exception as e:CODE
MEDIUMtests/test_rewards.py229def target():CODE
LOWtests/test_rewards.py232 except Exception as e:CODE
MEDIUMtests/experimental/test_gold_trainer.py43def openr1_examples():CODE
MEDIUMtests/experimental/test_gold_trainer.py56def countdown_examples():CODE
MEDIUMtests/experimental/test_gold_trainer.py306def vlm_dataset():CODE
LOWtests/experimental/test_gold_trainer.py50 except Exception as exc: # pragma: no cover - network/environment dependentCODE
LOWtests/experimental/test_gold_trainer.py63 except Exception as exc: # pragma: no cover - network/environment dependentCODE
LOWtests/experimental/test_gold_trainer.py313 except Exception as exc: # pragma: no cover - network/environment dependentCODE
LOWtests/experimental/test_gold_trainer.py3134 except Exception as exc: # pragma: no cover - network/environment dependentCODE
LOWtests/experimental/test_gold_trainer.py3190 except Exception as exc: # pragma: no cover - network/environment dependentCODE
LOWtests/experimental/test_gold_trainer.py3241 except Exception as exc: # pragma: no cover - network/environment dependentCODE
LOWtests/experimental/test_gold_trainer.py3291 except Exception as exc: # pragma: no cover - network/environment dependentCODE
LOWtests/experimental/test_online_dpo_trainer.py225 except Exception:CODE
LOWdocs/source/openenv.md402 except Exception:CODE
LOWdocs/source/openenv.md413 except Exception:CODE
LOWexamples/scripts/sdft.py199 except Exception:CODE
LOWexamples/scripts/sft_vlm_gemma3.py106 except Exception as e:CODE
MEDIUMexamples/scripts/sft_vlm_gemma3.py107 print(f"Error processing image {img_path}: {e}")CODE
LOW…ples/scripts/harbor/harnesses/jupyter/kernel_server.py70 except Exception:CODE
MEDIUM…ples/scripts/harbor/harnesses/jupyter/kernel_server.py63def do_POST(self):CODE
LOWexamples/scripts/harbor/harnesses/jupyter/run_cell.py55 except Exception as exc:CODE
LOWexamples/scripts/openenv/multi_env.py136 except Exception:CODE
LOWexamples/scripts/openenv/multi_env.py147 except Exception:CODE
LOWexamples/scripts/openenv/carla_vlm_gemma.py165 except Exception as e:CODE
LOWexamples/scripts/openenv/catch.py163 except Exception as e:CODE
LOWscripts/log_reports.py59 except Exception as 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.py45 except Exception as e:CODE
LOWtrl/_compat.py69 except Exception as e:CODE
LOWtrl/_compat.py126 except Exception as e:CODE
LOWtrl/_compat.py155 except Exception as e:CODE
LOWtrl/experimental/harbor/_spec.py103 except Exception: # noqa: BLE001CODE
LOWtrl/experimental/harbor/_env.py194 except Exception: # noqa: BLE001 — best-effort teardownCODE
MEDIUMtrl/experimental/harbor/_env.py191def __del__(self):CODE
LOWtrl/experimental/openreward/_spec.py175 except Exception: # noqa: BLE001CODE
LOWtrl/experimental/openreward/_spec.py282 except Exception as e: # noqa: BLE001CODE
LOWtrl/experimental/openreward/_spec.py312 except Exception as e: # noqa: BLE001CODE
LOWtrl/experimental/openreward/environment.py261 except Exception as e: # noqa: BLE001CODE
LOWtrl/experimental/openreward/environment.py273 except Exception as e: # noqa: BLE001CODE
LOWtrl/experimental/async_grpo/async_rollout_worker.py267 except Exception:CODE
LOWtrl/experimental/async_grpo/async_rollout_worker.py441 except Exception:CODE
LOWtrl/experimental/async_grpo/async_rollout_worker.py753 except Exception as error:CODE
LOWtrl/experimental/dppo/dppo_trainer.py469 except Exception as err:CODE
LOWtrl/experimental/ppo/modeling_value_head.py459 except Exception:STRING
LOWtrl/experimental/ppo/modeling_value_head.py469 except Exception as exc:STRING
MEDIUMtrl/cli/commands/skills.py37 print("Error: Unknown skills command")CODE
LOWtrl/scripts/vllm_serve.py782 except Exception as e:CODE
LOWtrl/scripts/vllm_serve.py787 except Exception as e:CODE
LOWtrl/scripts/utils.py408 except Exception as e:CODE
MEDIUMtrl/scripts/utils.py389def get_git_commit_hash(package_name):CODE
MEDIUMtrl/skills/cli.py94 print("Error: Either provide a skill name or use --all to install all skills")CODE
MEDIUMtrl/skills/cli.py100 print("Error: Cannot specify both a skill name and --all")CODE
MEDIUMtrl/skills/cli.py158 print(f"Error: {e}")CODE
MEDIUMtrl/skills/cli.py193 print(f"Error: {e}")CODE
LOWtrl/trainer/callbacks.py543 except Exception as scorer_e:CODE
4 more matches not shown…
Redundant / Tautological Comments53 hits · 68 pts
SeverityFileLineSnippetContext
LOWtests/test_chat_template_utils.py47 # Check if special tokens are correctly setCOMMENT
LOWtests/test_chat_template_utils.py114 # Check if special tokens are correctly setCOMMENT
LOWtests/test_grpo_trainer.py4206 # Check if signature columns were set properlyCOMMENT
LOWtests/experimental/test_gkd_trainer.py53 # Set temperature to 0 for deterministic outputCOMMENT
LOWtests/experimental/test_gkd_trainer.py72 # Check if the generated texts start with the original promptsCOMMENT
LOWtests/experimental/test_gkd_trainer.py85 # Check if the two generations are identicalCOMMENT
LOWtests/experimental/test_online_dpo_trainer.py254 # Check if training loss is availableCOMMENT
LOW…s/experimental/test_grpo_with_replay_buffer_trainer.py45 # Check if the buffer contains the correct number of elementsCOMMENT
LOW…s/experimental/test_grpo_with_replay_buffer_trainer.py48 # Check if the buffer maintains the min-heap propertyCOMMENT
LOW…s/experimental/test_grpo_with_replay_buffer_trainer.py67 # Check if the buffer contains the correct number of elementsCOMMENT
LOW…s/experimental/test_grpo_with_replay_buffer_trainer.py70 # Check if the buffer maintains the min-heap propertyCOMMENT
LOW…s/experimental/test_grpo_with_replay_buffer_trainer.py90 # Check if the sampled elements are from the bufferCOMMENT
LOWtests/experimental/test_ppo_trainer.py750 # Check if critic weights have been updatedCOMMENT
LOWtests/experimental/test_ppo_trainer.py757 # Check if policy weights have been updatedCOMMENT
LOWtests/experimental/test_ppo_trainer.py812 # Check if critic weights have been updatedCOMMENT
LOWtests/experimental/test_ppo_trainer.py819 # Check if policy weights have been updated - for PEFT we check the LoRA weightsCOMMENT
LOWtests/experimental/test_ppo_trainer.py191 # Check if the weights are the sameSTRING
LOWtests/experimental/test_ppo_trainer.py206 # Check if the weights are the sameSTRING
LOWtests/experimental/test_ppo_trainer.py224 # Check if the weights are the sameSTRING
LOWtests/experimental/test_ppo_trainer.py245 # Check if the weights are the sameSTRING
LOWtests/experimental/test_ppo_trainer.py251 # Check if the trl model has the same keys as the transformers modelSTRING
LOWtests/experimental/test_ppo_trainer.py290 # Check if the outputs are of the right size - hereSTRING
LOWtests/experimental/test_ppo_trainer.py303 # Check if v head of the model has the same dropout as the configSTRING
LOWtests/experimental/test_ppo_trainer.py315 # Check if v head of the model has the same dropout as the configSTRING
LOWtests/experimental/test_ppo_trainer.py320 # Check if v head of the model has the same dropout as the configSTRING
LOWtests/experimental/test_ppo_trainer.py405 # Check if the outputs are of the right size - hereSTRING
LOWtests/experimental/test_ppo_trainer.py418 # Check if v head of the model has the same dropout as the configSTRING
LOWtests/experimental/test_ppo_trainer.py430 # Check if v head of the model has the same dropout as the configSTRING
LOWtests/experimental/test_ppo_trainer.py435 # Check if v head of the model has the same dropout as the configSTRING
LOWscripts/add_copyrights.py61 # Check if the exact copyright header existsCOMMENT
LOW.github/workflows/tests.yml90 if: github.ref == 'refs/heads/main' && always() # Check if the branch is mainCODE
LOW.github/workflows/tests.yml146 if: github.ref == 'refs/heads/main' && always() # Check if the branch is mainCODE
LOW.github/workflows/tests.yml197 if: github.ref == 'refs/heads/main' && always() # Check if the branch is mainCODE
LOW.github/workflows/tests.yml252 if: github.ref == 'refs/heads/main' && always() # Check if the branch is mainCODE
LOW.github/workflows/tests.yml305 if: github.ref == 'refs/heads/main' && always() # Check if the branch is mainCODE
LOWtrl/experimental/utils.py881 # Check if model is sharded (FSDP/DS-Zero3)COMMENT
LOWtrl/experimental/tpo/tpo_trainer.py591 # Check if the tokenized prompt starts with the tokenized prompt+completionCOMMENT
LOWtrl/models/activation_offloading.py235 # Check if tensor is on CPU (skip offloading)COMMENT
LOWtrl/models/activation_offloading.py240 # Check if tensor is too smallCOMMENT
LOWtrl/models/activation_offloading.py245 # Check if tensor is a parameter or bufferCOMMENT
LOWtrl/models/activation_offloading.py252 # Check if tensor is an FP8 tensor (TorchAO) - skip offloading as they're already compressedCOMMENT
LOWtrl/models/activation_offloading.py258 # Check if tensor storage is a model parameter (for FSDP compatibility)COMMENT
LOWtrl/models/activation_offloading.py301 # Check if tensor has broadcast dimensions (stride == 0)COMMENT
LOWtrl/models/activation_offloading.py511 # Check if tensor still exists (might have been cleaned up by a previous node)COMMENT
LOWtrl/models/utils.py277 # Check if the model is already a FSDP model due to `Manual Wrapping` and if so, don't wrap it againCOMMENT
LOWtrl/scripts/vllm_serve.py731 # Check if adding this item would exceed the token budgetCOMMENT
LOWtrl/skills/skills.py101 # Check if it's a predefined agentCOMMENT
LOWtrl/skills/skills.py201 # Check if source skill existsCOMMENT
LOWtrl/skills/skills.py214 # Check if already existsCOMMENT
LOWtrl/trainer/sft_trainer.py1492 # Check if the tokenized prompt starts with the tokenized prompt+completionCOMMENT
LOWtrl/trainer/dpo_trainer.py1027 # Check if the tokenized prompt starts with the tokenized prompt+completionCOMMENT
LOWtrl/generation/vllm_client.py186 # Check if the total timeout duration has passedCOMMENT
LOWtrl/extras/profiling.py208 # Check if self is a Trainer-like object with required attributesCOMMENT
Hallucination Indicators6 hits · 45 pts
SeverityFileLineSnippetContext
CRITICALtrl/experimental/ppo/modeling_value_head.py713 self.v_head.summary.weight.data.normal_(mean=0.0, std=initializer_range)STRING
CRITICALtrl/experimental/ppo/modeling_value_head.py714 self.v_head.summary.bias.data.zero_()STRING
CRITICALtrl/experimental/ppo/modeling_value_head.py979 self.v_head.summary.weight.data.normal_(mean=0.0, std=initializer_range)STRING
CRITICALtrl/experimental/ppo/modeling_value_head.py980 self.v_head.summary.bias.data.zero_()STRING
CRITICALtrl/models/activation_offloading.py413 torch.autograd.variable.Variable._execution_engine.queue_callback(wait_and_del_remaining_references)CODE
CRITICALtrl/generation/vllm_generation.py392 self.llm.llm_engine.model_executor.driver_worker.model_runner.model.load_weights([(name, param)])CODE
Modern Structural Boilerplate44 hits · 44 pts
SeverityFileLineSnippetContext
LOWexamples/scripts/gold.py70logger = logging.getLogger(__name__)CODE
LOWexamples/scripts/harbor/harnesses/__init__.py20__all__ = ["BashEnv", "JupyterEnv", "TerminalNotesEnv"]CODE
LOWexamples/scripts/harbor/harnesses/bash/__init__.py18__all__ = ["BashEnv"]CODE
LOW…es/scripts/harbor/harnesses/terminal_notes/__init__.py18__all__ = ["TerminalNotesEnv"]CODE
LOWexamples/scripts/harbor/harnesses/jupyter/env.py52 async def _setup(self) -> None:CODE
LOWexamples/scripts/harbor/harnesses/jupyter/__init__.py18__all__ = ["JupyterEnv"]CODE
LOWtrl/experimental/merge_model_callback.py32logger = logging.getLogger(__name__)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.py693 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.py155 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/xpo/__init__.py19__all__ = ["XPOConfig", "XPOTrainer"]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.py488 def _setup_teacher_model(self) -> None:CODE
LOWtrl/experimental/distillation/__init__.py19__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
LOWtrl/experimental/gold/__init__.py19__all__ = ["GOLDConfig", "GOLDTrainer"]CODE
LOWtrl/experimental/prm/__init__.py19__all__ = ["PRMConfig", "PRMTrainer"]CODE
LOWtrl/experimental/async_grpo/async_grpo_trainer.py78 def update_model_version(self, version: int) -> None:CODE
LOWtrl/experimental/async_grpo/async_rollout_worker.py942 def update_model_version(self, model_version: int) -> None:CODE
LOWtrl/experimental/nash_md/__init__.py19__all__ = ["NashMDConfig", "NashMDTrainer"]CODE
LOWtrl/experimental/ppo/__init__.py24__all__ = [CODE
LOWtrl/experimental/minillm/__init__.py19__all__ = ["MiniLLMConfig", "MiniLLMTrainer"]CODE
LOWtrl/experimental/tpo/__init__.py19__all__ = ["TPOConfig", "TPOTrainer"]CODE
LOWtrl/experimental/kto/__init__.py22__all__ = ["KTOConfig", "KTOTrainer"]CODE
LOWtrl/cli/__init__.py18__all__ = ["main"]CODE
LOWtrl/cli/commands/__init__.py37__all__ = ["Command", "get_commands"]CODE
LOWtrl/scripts/vllm_serve.py117 def update_named_param(self, name: str, dtype: str, shape: Sequence[int]) -> None:CODE
LOWtrl/scripts/utils.py36logger = logging.getLogger(__name__)CODE
LOWtrl/skills/cli.py197__all__ = [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.py48logger = logging.getLogger(__name__)CODE
AI Structural Patterns42 hits · 36 pts
SeverityFileLineSnippetContext
LOWtests/experimental/test_gold_trainer.py676CODE
LOWtests/experimental/test_gold_trainer.py1621CODE
LOWtests/experimental/test_gold_trainer.py1954CODE
LOWtests/experimental/test_gold_trainer.py2052CODE
LOWtests/experimental/test_gold_trainer.py2148CODE
LOWtests/experimental/test_gold_trainer.py2337CODE
LOWtests/experimental/test_gold_trainer.py2401CODE
LOWtests/experimental/test_gold_trainer.py2501CODE
LOWtests/experimental/test_gold_trainer.py2565CODE
LOWtrl/experimental/sdpo/sdpo_trainer.py346CODE
LOWtrl/experimental/cpo/cpo_trainer.py138CODE
LOWtrl/experimental/bco/bco_trainer.py425CODE
LOWtrl/experimental/orpo/orpo_trainer.py148CODE
LOWtrl/experimental/online_dpo/online_dpo_trainer.py172CODE
LOWtrl/experimental/bema_for_ref_model/callback.py128CODE
LOWtrl/experimental/xpo/xpo_trainer.py113CODE
LOWtrl/experimental/distillation/distillation_trainer.py385CODE
LOWtrl/experimental/openreward/_spec.py115CODE
LOWtrl/experimental/openreward/environment.py145CODE
LOWtrl/experimental/gkd/gkd_trainer.py111CODE
LOWtrl/experimental/gold/gold_trainer.py798CODE
LOWtrl/experimental/prm/prm_trainer.py153CODE
LOWtrl/experimental/async_grpo/async_grpo_trainer.py512CODE
LOWtrl/experimental/async_grpo/async_rollout_worker.py280CODE
LOWtrl/experimental/nash_md/nash_md_trainer.py166CODE
LOWtrl/experimental/dppo/dppo_trainer.py195CODE
LOWtrl/experimental/dppo/dppo_trainer.py762CODE
LOWtrl/experimental/ppo/modeling_value_head.py644CODE
LOWtrl/experimental/minillm/minillm_trainer.py166CODE
LOWtrl/experimental/tpo/tpo_trainer.py289CODE
LOWtrl/trainer/reward_trainer.py329CODE
LOWtrl/trainer/sft_trainer.py901CODE
LOWtrl/trainer/callbacks.py639CODE
LOWtrl/trainer/rloo_trainer.py230CODE
LOWtrl/trainer/rloo_trainer.py775CODE
LOWtrl/trainer/kto_trainer.py568CODE
LOWtrl/trainer/grpo_trainer.py294CODE
LOWtrl/trainer/grpo_trainer.py1304CODE
LOWtrl/trainer/dpo_trainer.py516CODE
LOWtrl/generation/vllm_generation.py224CODE
LOWtrl/generation/vllm_client.py204CODE
LOWtrl/generation/vllm_client.py302CODE
AI Slop Vocabulary12 hits · 31 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_grpo_trainer.py1693 ratio = ratios[len(ratios) // 2] # median, robust to per-step noiseCODE
MEDIUMtests/test_grpo_trainer.py1693 ratio = ratios[len(ratios) // 2] # median, robust to per-step noiseCODE
LOWtests/test_kto_trainer.py626 # purposes we will just use the same checkpointCOMMENT
LOWtests/test_dpo_trainer.py536 # purposes we will just just use the same checkpointCOMMENT
MEDIUMexamples/scripts/harbor/harnesses/bash/__init__.py15from trl.experimental.harbor import HarborBashEnv as BashEnv # the built-in bash harnessCODE
MEDIUMtrl/experimental/cpo/cpo_trainer.py498 # 2. https://github.com/EleutherAI/lm-evaluation-harness/pull/531#issuecomment-1595586257COMMENT
MEDIUMtrl/experimental/bco/bco_trainer.py270 # 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.py122 await self._setup() # harness-specific sandbox prep (e.g. start a Jupyter kernel)CODE
MEDIUMtrl/experimental/harbor/_env.py230#: import path / file path resolving to one) for a custom harness.COMMENT
MEDIUMtrl/experimental/orpo/orpo_trainer.py484 # 2. https://github.com/EleutherAI/lm-evaluation-harness/pull/531#issuecomment-1595586257COMMENT
MEDIUMtrl/generation/vllm_client.py138 # This is not strictly required for correctness, but it helps make training more robust to rare, transientCOMMENT
Cross-Language Confusion4 hits · 15 pts
SeverityFileLineSnippetContext
HIGHexamples/scripts/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/scripts/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/scripts/openenv/wordle.py77uv venv && source .venv/bin/activateSTRING
HIGHtrl/data_utils.py688 elif not first_column_offsets.equals(column.offsets):STRING
Modern AI Meta-Vocabulary5 hits · 12 pts
SeverityFileLineSnippetContext
MEDIUMtests/experimental/test_bco_trainer.py310 # Get embedding modelCOMMENT
MEDIUMdocs/source/openenv.md3[OpenEnv](https://github.com/huggingface/OpenEnv) is an open-source framework for defining, deploying, and interacting wCODE
MEDIUMdocs/source/bco_trainer.md58# customize this function depending on your embedding modelCOMMENT
MEDIUMdocs/source/harbor.md3[Harbor](https://www.harborframework.com) is a framework for running agentic tasks in sandboxes. It decouples a **task**CODE
MEDIUMdocs/source/example_overview.md66| [`trl/scripts/grpo_agent.py`](https://github.com/huggingface/trl/blob/main/trl/scripts/grpo_agent.py) | This script shCODE
Fake / Example Data3 hits · 4 pts
SeverityFileLineSnippetContext
LOWtrl/chat_template_utils.py122 dummy_token = AddedToken(f"<extra_id_{idx}>")CODE
LOWtrl/chat_template_utils.py123 is_added = tokenizer.add_tokens(dummy_token)CODE
LOWtrl/chat_template_utils.py126 added_tokens.append(dummy_token)CODE
Slop Phrases1 hit · 3 pts
SeverityFileLineSnippetContext
MEDIUMexamples/cli_configs/example_config.yaml1# This is an example configuration file of TRL CLI, you can use it forCOMMENT
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippetContext
LOWtrl/generation/vllm_client.py748# Example usageCOMMENT
Overly Generic Function Names1 hit · 1 pts
SeverityFileLineSnippetContext
LOWtests/test_utils.py285 def test_function(self):CODE