Repository Analysis

OpenRLHF/OpenRLHF

An Easy-to-use, Scalable and High-performance Agentic RL Framework based on Ray (PPO & DAPO & REINFORCE++ & VLM & TIS & vLLM & Ray & Async RL)

14.8 Low AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of OpenRLHF/OpenRLHF, a Python project with 9,788 GitHub stars. SynthScan v2.0 examined 16,697 lines of code across 91 source files, recording 191 pattern matches distributed across 13 syntactic categories. The overall adjusted score of 14.8 places this repository in the Low 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).

14.8
Adjusted Score
14.8
Raw Score
100%
Time Factor
2026-07-14
Last Push
9.8K
Stars
Python
Language
16.7K
Lines of Code
91
Files
191
Pattern Hits
2026-07-14
Scan Date
0.00
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

Longitudinal tracking requires multiple scan runs. Once this repository is re-scanned after new commits land, this chart will visualise how the synthetic code signal evolves over time — enabling you to detect whether AI authorship is growing, stabilising, or being actively corrected by human engineers.

No multi-scan history yet — run the scanner again to build trend data.

Severity Breakdown

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

CRITICAL 0HIGH 0MEDIUM 19LOW 172

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 191 distinct pattern matches across 13 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 Identifiers55 hits · 62 pts
SeverityFileLineSnippetContext
LOWopenrlhf/utils/vlm_utils.py68def process_prompt_with_images(CODE
LOWopenrlhf/utils/seqlen_balancing.py153def get_seqlen_balanced_partitions(seqlen_list: List[int], k_partitions: int, equal_size: bool):CODE
LOWopenrlhf/utils/seqlen_balancing.py171 def _check_and_sort_partitions(partitions):CODE
LOWopenrlhf/utils/seqlen_balancing.py234def get_minimum_num_micro_batch_size(total_lengths, max_tokens_per_gpu, ring_attn_size, ds_tensor_parallel_size):CODE
LOWopenrlhf/utils/math_utils.py175def _strip_properly_formatted_commas(expr: str) -> str:CODE
LOWopenrlhf/utils/math_utils.py200def _inject_implicit_mixed_number(step: str) -> str:CODE
LOWopenrlhf/utils/math_utils.py278def count_unknown_letters_in_expr(expr: str) -> int:CODE
LOWopenrlhf/utils/loss_utils.py54def _optimizer_step_loss_norm(masks, dp_group, dp_size, gas):CODE
LOWopenrlhf/utils/loss_utils.py80def iter_grad_accum_global_norm(data_iter, strategy, accumulated_gradient, mask_fn):CODE
LOWopenrlhf/utils/distributed_util.py1def torch_dist_barrier_and_cuda_sync():CODE
LOWopenrlhf/utils/distributed_util.py13def stateless_init_process_group(master_address, master_port, rank, world_size, device):CODE
LOWopenrlhf/utils/deepspeed/deepspeed_utils.py121def get_optimizer_grouped_parameters(CODE
LOWopenrlhf/models/ring_attn_utils.py9def patch_transformers_for_ring_flash_attn():CODE
LOWopenrlhf/models/ring_attn_utils.py32def reset_ring_attn_position_ids(start, end, packed_seq_lens):CODE
LOWopenrlhf/models/ring_attn_utils.py72def get_tensor_in_current_ring_attn_rank(tensors: list[torch.Tensor] | torch.Tensor, ring_attn_group, pad_id):CODE
LOWopenrlhf/models/model.py21def get_llm_for_sequence_regression(CODE
LOWopenrlhf/models/actor.py298 def gradient_checkpointing_enable(self, gradient_checkpointing_kwargs={"use_reentrant": False}):CODE
LOWopenrlhf/models/actor.py301 def gradient_checkpointing_disable(self):CODE
LOWopenrlhf/models/actor.py304 def print_trainable_parameters(self):CODE
LOWopenrlhf/trainer/sft_trainer.py215 def save_logs_and_checkpoints(self, args, global_step, step_bar, logs_dict=None, client_states=None):CODE
LOWopenrlhf/trainer/rm_trainer.py214 def save_logs_and_checkpoints(self, args, global_step, step_bar, logs_dict={}, client_states={}):CODE
LOWopenrlhf/trainer/ppo_trainer.py197 def restore_best_checkpoint_state(self, checkpoint_states) -> None:CODE
LOWopenrlhf/trainer/ppo_trainer.py383 def save_logs_and_checkpoints(self, global_step: int, logs_dict=None, client_states=None) -> None:CODE
LOWopenrlhf/trainer/dpo_trainer.py223 def save_logs_and_checkpoints(self, args, global_step, step_bar, logs_dict=None, client_states=None):CODE
LOWopenrlhf/trainer/ppo_utils/samples_generator.py199 def _dispatch_prompts_to_vllm(CODE
LOWopenrlhf/trainer/ppo_utils/samples_generator.py247 def _process_response_into_experience(self, response, **generate_kwargs) -> Experience:CODE
LOWopenrlhf/trainer/ppo_utils/experience_maker.py238 def compute_advantages_and_returns(self, experiences: List[Experience]) -> List[Experience]:CODE
LOWopenrlhf/trainer/ppo_utils/experience_maker.py333 def get_advantages_and_returns(CODE
LOWopenrlhf/trainer/ppo_utils/experience.py256def remove_padding_in_sequences(items: List[Experience]) -> List[Experience]:CODE
LOWopenrlhf/trainer/ppo_utils/length_penalty.py61def apply_stop_properly_penalty(CODE
LOWopenrlhf/trainer/ray/vllm_engine.py179 def get_num_unfinished_requests(self) -> int:CODE
LOWopenrlhf/trainer/ray/ppo_actor.py494 def init_model_from_pretrained(self, strategy: DeepspeedStrategy, pretrain, max_steps=None, vllm_engines=None):CODE
LOWopenrlhf/trainer/ray/ppo_critic.py189 def init_model_from_pretrained(self, strategy: DeepspeedStrategy, pretrain, max_steps):CODE
LOWopenrlhf/trainer/ray/utils.py20def ray_noset_visible_devices(env_vars=os.environ):CODE
LOWopenrlhf/trainer/ray/launcher.py60 def init_model_from_pretrained(self, *args, **kwargs):CODE
LOWopenrlhf/trainer/ray/launcher.py106 def init_model_from_pretrained(self, strategy: DeepspeedStrategy, pretrain):CODE
LOWopenrlhf/trainer/ray/launcher.py159 def init_model_from_pretrained(self, strategy: DeepspeedStrategy, pretrain):CODE
LOWopenrlhf/trainer/ray/launcher.py292 def async_init_model_from_pretrained(CODE
LOWtests/test_ray_env_vars.py140 def test_tokenizers_parallelism_default(self):CODE
LOWtests/test_ray_env_vars.py146 def test_ray_zero_copy_default(self):CODE
LOWtests/test_ray_env_vars.py161 def test_nccl_debug_user_info(self):CODE
LOWtests/test_ray_env_vars.py165 def test_nccl_debug_user_trace(self):CODE
LOWtests/test_ray_env_vars.py169 def test_tokenizers_parallelism_user_false(self):CODE
LOWtests/test_ray_env_vars.py173 def test_ray_zero_copy_user_disabled(self):CODE
LOWtests/test_ray_env_vars.py177 def test_multiple_user_overrides(self):CODE
LOWtests/test_ray_env_vars.py198 def test_ray_init_not_called_when_initialized(self):CODE
LOWtests/test_loss_aggregation.py47def test_token_mean_aggregation_matches_verl_dp_average():CODE
LOWtests/test_loss_aggregation.py61def test_seq_mean_token_mean_aggregation_matches_verl_dp_average():CODE
LOWtests/test_loss_aggregation.py86def test_loss_batch_info_excludes_fully_masked_sequences():CODE
LOWtests/test_loss_aggregation.py97def test_policy_loss_token_mean_aggregation_matches_full_batch():CODE
LOWtests/test_loss_aggregation.py127def test_policy_kl_metric_uses_policy_ratio_when_vllm_correction_is_enabled():CODE
LOWtests/test_loss_aggregation.py151def test_grad_accum_global_norm_matches_global_token_mean_over_window():CODE
LOWtests/test_loss_aggregation.py183def test_grad_accum_global_norm_differs_from_per_microbatch_when_uneven():CODE
LOWtests/test_loss_aggregation.py196def test_policy_kl_metric_is_not_clamped():CODE
LOWexamples/python/vlm_multiturn_agent.py42def get_screenshot_from_environment():CODE
Decorative Section Separators12 hits · 45 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_ray_env_vars.py126# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_ray_env_vars.py128# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_ray_env_vars.py153# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_ray_env_vars.py155# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_ray_env_vars.py190# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_ray_env_vars.py192# ---------------------------------------------------------------------------COMMENT
MEDIUMexamples/python/vlm_multiturn_agent.py37# ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMexamples/python/vlm_multiturn_agent.py39# ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMexamples/python/vlm_multiturn_agent.py69# ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMexamples/python/vlm_multiturn_agent.py71# ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMexamples/python/vlm_multiturn_agent.py177# ──────────────────────────────────────────────────────────────────────COMMENT
MEDIUMexamples/python/vlm_multiturn_agent.py179# ──────────────────────────────────────────────────────────────────────COMMENT
Unused Imports32 hits · 32 pts
SeverityFileLineSnippetContext
LOWopenrlhf/datasets/__init__.py1CODE
LOWopenrlhf/datasets/__init__.py2CODE
LOWopenrlhf/datasets/__init__.py3CODE
LOWopenrlhf/utils/math_utils.py6CODE
LOWopenrlhf/utils/__init__.py1CODE
LOWopenrlhf/utils/__init__.py1CODE
LOWopenrlhf/utils/__init__.py2CODE
LOWopenrlhf/utils/__init__.py2CODE
LOWopenrlhf/utils/deepspeed/__init__.py1CODE
LOWopenrlhf/models/__init__.py1CODE
LOWopenrlhf/models/__init__.py2CODE
LOWopenrlhf/models/__init__.py2CODE
LOWopenrlhf/models/__init__.py2CODE
LOWopenrlhf/models/__init__.py2CODE
LOWopenrlhf/models/__init__.py2CODE
LOWopenrlhf/models/__init__.py2CODE
LOWopenrlhf/models/__init__.py2CODE
LOWopenrlhf/models/__init__.py2CODE
LOWopenrlhf/models/__init__.py12CODE
LOWopenrlhf/trainer/ppo_utils/__init__.py1CODE
LOWopenrlhf/trainer/ppo_utils/__init__.py1CODE
LOWopenrlhf/trainer/ppo_utils/__init__.py1CODE
LOWopenrlhf/trainer/ppo_utils/__init__.py1CODE
LOWopenrlhf/trainer/ppo_utils/__init__.py2CODE
LOWopenrlhf/trainer/ppo_utils/__init__.py2CODE
LOWopenrlhf/trainer/ppo_utils/__init__.py3CODE
LOWopenrlhf/trainer/ppo_utils/__init__.py3CODE
LOWopenrlhf/trainer/ppo_utils/__init__.py3CODE
LOWopenrlhf/trainer/ppo_utils/__init__.py4CODE
LOWopenrlhf/trainer/ray/__init__.py2CODE
LOWopenrlhf/trainer/ray/__init__.py2CODE
LOWexamples/python/agent_func_openai_server_executor.py16CODE
Deep Nesting30 hits · 30 pts
SeverityFileLineSnippetContext
LOWopenrlhf/datasets/prompts_dataset.py26CODE
LOWopenrlhf/datasets/utils.py10CODE
LOWopenrlhf/utils/vlm_utils.py30CODE
LOWopenrlhf/utils/math_utils.py25CODE
LOWopenrlhf/utils/math_utils.py285CODE
LOWopenrlhf/utils/math_utils.py372CODE
LOWopenrlhf/utils/math_utils.py26CODE
LOWopenrlhf/utils/agent.py202CODE
LOWopenrlhf/utils/deepspeed/deepspeed.py507CODE
LOWopenrlhf/utils/deepspeed/deepspeed.py537CODE
LOWopenrlhf/utils/deepspeed/deepspeed.py683CODE
LOWopenrlhf/models/model.py21CODE
LOWopenrlhf/models/utils.py10CODE
LOWopenrlhf/models/actor.py76CODE
LOWopenrlhf/models/actor.py221CODE
LOWopenrlhf/trainer/sft_trainer.py215CODE
LOWopenrlhf/trainer/sft_trainer.py246CODE
LOWopenrlhf/trainer/ppo_trainer_async.py100CODE
LOWopenrlhf/trainer/rm_trainer.py214CODE
LOWopenrlhf/trainer/rm_trainer.py245CODE
LOWopenrlhf/trainer/dpo_trainer.py223CODE
LOWopenrlhf/trainer/dpo_trainer.py254CODE
LOWopenrlhf/trainer/ppo_utils/samples_generator.py140CODE
LOWopenrlhf/trainer/ppo_utils/experience_maker.py238CODE
LOWopenrlhf/trainer/ppo_utils/experience.py184CODE
LOWopenrlhf/trainer/ppo_utils/experience.py219CODE
LOWopenrlhf/trainer/ppo_utils/experience.py123CODE
LOWopenrlhf/trainer/ppo_utils/length_penalty.py61CODE
LOWopenrlhf/trainer/ray/ppo_actor.py155CODE
LOWexamples/python/agent_func_openai_server_executor.py241CODE
Excessive Try-Catch Wrapping16 hits · 17 pts
SeverityFileLineSnippetContext
LOWopenrlhf/datasets/utils.py62 except Exception as e:CODE
LOWopenrlhf/utils/vlm_utils.py63 except Exception as e:CODE
LOWopenrlhf/utils/math_utils.py38 except Exception:CODE
LOWopenrlhf/utils/math_utils.py66 except Exception:CODE
LOWopenrlhf/utils/math_utils.py130 except Exception:CODE
LOWopenrlhf/utils/math_utils.py160 except Exception:CODE
LOWopenrlhf/utils/math_utils.py167 except Exception:CODE
LOWopenrlhf/utils/math_utils.py190 except Exception:CODE
LOWopenrlhf/utils/math_utils.py248 except Exception:CODE
LOWopenrlhf/utils/math_utils.py311 except Exception:CODE
LOWopenrlhf/utils/math_utils.py361 except Exception:CODE
LOWopenrlhf/utils/utils.py47 except Exception:CODE
LOWopenrlhf/utils/agent.py298 except Exception as e:CODE
LOWopenrlhf/utils/agent.py347 except Exception as e: # pragma: no cover - defensiveCODE
LOWexamples/python/agent_func_openai_server_executor.py47 except Exception:CODE
LOWexamples/python/agent_func_openai_server_executor.py218 except Exception:CODE
Over-Commented Block12 hits · 12 pts
SeverityFileLineSnippetContext
LOWREADME_zh.md481 --vllm.sync_backend nccl \COMMENT
LOWopenrlhf/utils/seqlen_balancing.py1# Copied from https://github.com/volcengine/verl/blob/468adf22c43b744348051fccd7a5d830c6c3c36a/verl/utils/seqlen_balanciCOMMENT
LOWopenrlhf/utils/deepspeed/deepspeed.py141 # ``optim`` defaults to the strategy-wide setting but can be overridden per-modelCOMMENT
LOWopenrlhf/utils/deepspeed/deepspeed.py301 # sets are silently dropped. ns_steps / nesterov are NOT configurable viaCOMMENT
LOWexamples/scripts/train_nonrl_slurm.sh1#!/bin/bashCOMMENT
LOWexamples/scripts/train_vlm_math_hybrid_engine.sh1#!/bin/bashCOMMENT
LOWexamples/scripts/train_vlm_math_hybrid_engine.sh81 --ds.enable_sleepCOMMENT
LOWexamples/scripts/train_vlm_math_hybrid_engine.sh101# Images in the dataset should be a list of paths/URLs.COMMENT
LOWexamples/scripts/train_prorlv2_math_hybrid_engine.sh1#!/bin/bashCOMMENT
LOWexamples/scripts/train_prorlv2_math_hybrid_engine.sh81COMMENT
LOWexamples/scripts/train_prorlv2_math_hybrid_engine.sh101# Truncated sample rewards are scaled by this coefficient (0.0 = zero reward for truncated)COMMENT
LOWexamples/scripts/train_ppo_ray_slurm.sh1#!/bin/bashCOMMENT
Self-Referential Comments4 hits · 12 pts
SeverityFileLineSnippetContext
MEDIUMopenrlhf/utils/agent.py78 # Initialize tracking variablesCOMMENT
MEDIUMopenrlhf/models/utils.py112 # The following code is equivalent to:COMMENT
MEDIUMopenrlhf/trainer/ray/vllm_engine.py248 # Create a big placement group to ensure that all engines are packedCOMMENT
MEDIUMopenrlhf/trainer/ray/utils.py5# This function is used to get the bundle indices of a placement groupCOMMENT
Modern Structural Boilerplate12 hits · 12 pts
SeverityFileLineSnippetContext
LOWopenrlhf/datasets/__init__.py5__all__ = ["PromptDataset", "RewardDataset", "SFTDataset"]CODE
LOWopenrlhf/utils/vlm_utils.py15logger = logging.getLogger(__name__)CODE
LOWopenrlhf/utils/__init__.py4__all__ = [CODE
LOWopenrlhf/utils/distributed_sampler.py9__all__ = ["DistributedSampler"]CODE
LOWopenrlhf/utils/distributed_sampler.py138 def set_epoch(self, epoch: int, consumed_samples=0) -> None:STRING
LOWopenrlhf/utils/deepspeed/__init__.py3__all__ = [CODE
LOWopenrlhf/models/__init__.py14__all__ = [CODE
LOWopenrlhf/models/utils.py10def set_z3_leaf_modules(model: nn.Module, detect_hybrid: bool = True) -> None:CODE
LOWopenrlhf/trainer/ppo_utils/__init__.py6__all__ = [CODE
LOWopenrlhf/trainer/ray/__init__.py4__all__ = [CODE
LOWexamples/python/agent_func_gem_multiturn.py13logger = logging.getLogger(__name__)CODE
LOWexamples/python/agent_func_openai_server_executor.py33logger = logging.getLogger(__name__)CODE
Redundant / Tautological Comments7 hits · 10 pts
SeverityFileLineSnippetContext
LOWopenrlhf/utils/agent.py246 # Check if response was truncated (hit max_tokens length limit)COMMENT
LOWopenrlhf/trainer/ppo_utils/samples_generator.py281 # Check if response was truncated (hit max_tokens limit, finish_reason == "length")COMMENT
LOWopenrlhf/trainer/ray/launcher.py330 # Check if all kwargs parameters are iterableCOMMENT
LOWexamples/python/agent_func.py47 # Check if episode is doneCOMMENT
LOWexamples/python/agent_func_gem_multiturn.py113 # Check if episode is doneCOMMENT
LOWexamples/scripts/ckpt_ds_zero_to_universal.sh10# Set CKPT_PATH to the first argument and shift it out so that "$@" contains the extra arguments.COMMENT
LOWexamples/scripts/ckpt_ds_zero_to_universal.sh20 # Check if the latest tag exists.COMMENT
AI Structural Patterns6 hits · 6 pts
SeverityFileLineSnippetContext
LOWopenrlhf/utils/deepspeed/deepspeed_utils.py7CODE
LOWopenrlhf/models/model.py21CODE
LOWopenrlhf/models/loss.py121CODE
LOWopenrlhf/models/actor.py76CODE
LOWopenrlhf/models/actor.py221CODE
LOWopenrlhf/trainer/ray/ppo_actor.py39CODE
Modern AI Meta-Vocabulary2 hits · 5 pts
SeverityFileLineSnippetContext
MEDIUMREADME.md41- [🎯 Design Paradigm](#design-paradigm-agent-based-execution) - Unified agent-based execution pipelineCODE
MEDIUMopenrlhf/trainer/ppo_utils/samples_generator.py264 # Truncate everything to the configured context window.COMMENT
AI Slop Vocabulary1 hit · 3 pts
SeverityFileLineSnippetContext
MEDIUMexamples/scripts/train_prorlv2_math_hybrid_engine.sh13# ProRL v2 achieves state-of-the-art performance among 1.5B reasoning modelsCOMMENT
Overly Generic Function Names2 hits · 2 pts
SeverityFileLineSnippetContext
LOWopenrlhf/datasets/sft_dataset.py89 def process_data(self, data):CODE
LOWopenrlhf/datasets/reward_dataset.py101 def process_data(self, data):CODE