AI Slop Code Risk Monitor

KevinMusgrave/pytorch-metric-learning

SlopCodeMonitor badge for KevinMusgrave/pytorch-metric-learning Adjusted legacy signal; badge bands: 25 / 50 / 75 (different from dashboard bands).
13.4 Moderate pattern signal View on GitHub

Open-Source Code Quality, Security and Technical Debt Review

This report summarizes scanner evidence for KevinMusgrave/pytorch-metric-learning. SynthScan examined 65,420 lines of code across 388 source files, recording 856 pattern matches distributed across 6 syntactic categories. The legacy adjusted pattern signal is 13.4 (Moderate 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.

13.4
Adjusted Signal
13.4
Raw Pattern Score
100%
Time Factor
—
Last Push
—
Stars
—
Language
65.4K
Lines of Code
388
Files
856
Pattern Hits
2026-10-31
Scan Date
0.00
HC Hit Rate

Risk Review · Payload v1

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

Payload schema: 1.0.0 · Engine: 2.0.0 · Scoring: heuristic-density-v1 · Scan date: 2026-10-31.

Cognitive Ownership Risk 44.4/100 · MEDIUM

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

Hallucinated Dependency & Supply Chain Risk 6.9/100 · LOW

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

Agent Over-Engineering Ratio 41.2/100 · MEDIUM

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

PR Review Velocity Impact 48.0/100 · MEDIUM

Which changes need focused human review? 856 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

Run additional scans to build a history of the legacy pattern signal. Score changes are not a measure of AI adoption or code quality.

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

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 0HIGH 0MEDIUM 0LOW 856

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 856 distinct pattern matches across 6 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 Identifiers633 hits · 677 pts
SeverityFileLineSnippetContext
LOWconftest.py38def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]):CODE
LOWtests/helpers.py11def use_deterministic_kernels(test) -> None:CODE
LOWtests/losses/test_circle_loss.py131 def test_anchors_without_positives_and_negatives_are_excluded(self):CODE
LOWtests/losses/test_histogram_loss.py128 def test_with_no_valid_triplets(self):CODE
LOWtests/losses/test_histogram_loss.py152 def test_identical_and_opposite_embeddings(self):CODE
LOWtests/losses/test_histogram_loss.py171 def test_collapsed_embeddings_have_unit_loss(self):CODE
LOWtests/losses/test_histogram_loss.py186 def test_endpoint_mass_splits_between_first_and_last_nodes(self):CODE
LOWtests/losses/test_histogram_loss.py204 def test_interior_interpolation_preserves_values_and_slopes(self):CODE
LOWtests/losses/test_pnp_loss.py203 def test_negatives_that_have_no_positives(self):CODE
LOWtests/losses/test_pnp_loss.py211 def test_anchors_without_other_positives_are_excluded(self):CODE
LOWtests/losses/test_pnp_loss.py246 def test_batches_without_positive_pairs_give_differentiable_zero(self):CODE
LOWtests/losses/test_pnp_loss.py276 def test_variants_match_scalar_values_and_analytic_gradients(self):CODE
LOWtests/losses/test_pnp_loss.py319 def test_masked_comparisons_keep_backward_finite(self):CODE
LOWtests/losses/test_pnp_loss.py335 def test_half_exponent_overflow_keeps_default_temperature_finite(self):CODE
LOWtests/losses/test_pnp_loss.py352 def test_negative_tail_keeps_representable_values_and_gradients(self):CODE
LOWtests/losses/test_fastap_loss.py16def original_implementation_fast_ap_loss(input, target, num_bins):CODE
LOWtests/losses/test_margin_loss.py94 def test_margin_loss_with_ref(self):CODE
LOWtests/losses/test_margin_loss.py105 def test_with_no_valid_triplets(self):CODE
LOWtests/losses/test_margin_loss.py131 def test_beta_follows_module_placement(self):CODE
LOWtests/losses/test_cross_batch_memory.py43 def test_remove_self_comparisons(self):CODE
LOWtests/losses/test_cross_batch_memory.py139 def test_memory_filled_each_batch_matches_inner_loss(self):CODE
LOWtests/losses/test_cross_batch_memory.py215 def test_with_distance_weighted_miner(self):CODE
LOWtests/losses/test_cross_batch_memory.py585 def test_reset_queue_keeps_placement(self):CODE
LOWtests/losses/test_cross_batch_memory.py606 def test_easy_positive_miner_skips_each_anchors_queued_copy(self):CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py83 def test_autocast_histogram_uses_buffer_precision(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py110 def test_autocast_training_steps_have_finite_gradients(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py134 def test_values_and_gradients_across_training_steps(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py155 def test_paired_batches_and_accumulated_backward(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py185 def test_reported_convolutional_training_loop(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py206 def test_earlier_graph_stays_out_of_later_steps(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py219 def test_forwards_before_backward_in_any_order(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py229 def test_forwards_summed_before_backward_match_separate_backward(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py246 def test_histogram_interpolation_endpoints_and_clipping(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py266 def test_supplied_triplets_without_labels_keep_reference_gradients(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py291 def test_coincident_and_opposite_embeddings_have_finite_gradients(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py312 def test_empty_valid_sets_preserve_histogram(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py333 def test_checkpoint_preserves_next_loss_and_gradient(self) -> None:CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py354 def test_invalid_histogram_configuration(self) -> None:CODE
LOWtests/losses/test_lifted_structure_loss.py16 def test_lifted_structure_loss(self):CODE
LOWtests/losses/test_lifted_structure_loss.py96 def test_generalized_lifted_structure_loss(self):CODE
LOWtests/losses/test_lifted_structure_loss.py182 def test_separate_reference_set_is_rejected(self):CODE
LOWtests/losses/test_lifted_structure_loss.py197 def test_positive_pair_without_negatives_has_finite_zero_gradient(self):CODE
LOW⚡tests/losses/test_multi_supcon_loss.py298 def test_loss_dtype_follows_embeddings(self):CODE
LOW⚡tests/losses/test_multi_supcon_loss.py303 def test_unsupported_wrappers_reject_label_sets(self):CODE
LOW⚡tests/losses/test_multi_supcon_loss.py310 def test_multiple_losses_compose_label_set_losses(self):CODE
LOWtests/losses/test_multi_supcon_loss.py91 def test_values_match_equation_three(self):CODE
LOWtests/losses/test_multi_supcon_loss.py106 def test_value_matches_multisupcontrast(self):CODE
LOWtests/losses/test_multi_supcon_loss.py111 def test_gradient_matches_reference(self):CODE
LOWtests/losses/test_multi_supcon_loss.py128 def test_threshold_includes_exact_similarity(self):CODE
LOWtests/losses/test_multi_supcon_loss.py144 def test_threshold_one_is_supcon(self):CODE
LOWtests/losses/test_multi_supcon_loss.py153 def test_threshold_zero_counts_zero_weight_pairs(self):CODE
LOWtests/losses/test_multi_supcon_loss.py169 def test_empty_label_sets_match_only_each_other(self):CODE
LOWtests/losses/test_multi_supcon_loss.py192 def test_anchors_without_positives_have_no_term(self):CODE
LOWtests/losses/test_multi_supcon_loss.py203 def test_batch_without_positives_is_differentiable_zero(self):CODE
LOWtests/losses/test_multi_supcon_loss.py217 def test_empty_batch_is_differentiable_zero(self):CODE
LOWtests/losses/test_multi_supcon_loss.py224 def test_references_keep_every_row(self):CODE
LOWtests/losses/test_multi_supcon_loss.py244 def test_supplied_pairs_restrict_the_denominator(self):CODE
LOWtests/losses/test_multi_supcon_loss.py260 def test_empty_supplied_pairs_select_nothing(self):CODE
LOWtests/losses/test_multi_supcon_loss.py266 def test_inverted_distance_uses_negated_distances(self):CODE
LOWtests/losses/test_multi_supcon_loss.py341 def test_queue_matches_stateless_reference(self):CODE
573 more matches not shown…
Unused Imports110 hits · 93 pts
SeverityFileLineSnippetContext
LOWsrc/pytorch_metric_learning/types.py1CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py1CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py2CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py3CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py4CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py5CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py6CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py7CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py8CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py9CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py10CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py11CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py12CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py13CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py14CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py15CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py16CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py17CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py18CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py19CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py20CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py21CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py22CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py22CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py23CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py24CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py25CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py26CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py27CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py28CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py29CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py30CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py31CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py32CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py33CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py34CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py35CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py36CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py37CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py38CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py39CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py40CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py41CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py42CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py43CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py44CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py45CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py46CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py47CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py48CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py49CODE
LOWsrc/pytorch_metric_learning/utils/_common.py1CODE
LOWsrc/pytorch_metric_learning/regularizers/__init__.py1CODE
LOWsrc/pytorch_metric_learning/regularizers/__init__.py2CODE
LOWsrc/pytorch_metric_learning/regularizers/__init__.py3CODE
LOWsrc/pytorch_metric_learning/regularizers/__init__.py4CODE
LOWsrc/pytorch_metric_learning/regularizers/__init__.py5CODE
LOWsrc/pytorch_metric_learning/regularizers/__init__.py6CODE
LOWsrc/pytorch_metric_learning/regularizers/__init__.py7CODE
LOWsrc/pytorch_metric_learning/samplers/__init__.py1CODE
50 more matches not shown…
Deep Nesting87 hits · 81 pts
SeverityFileLineSnippetContext
LOWtests/losses/test_circle_loss.py13CODE
LOWtests/losses/test_pnp_loss.py111CODE
LOWtests/losses/test_pnp_loss.py276CODE
LOWtests/losses/test_pnp_loss.py319CODE
LOWtests/losses/test_margin_loss.py13CODE
LOWtests/losses/test_cross_batch_memory.py43CODE
LOWtests/losses/test_cross_batch_memory.py139CODE
LOWtests/losses/test_cross_batch_memory.py303CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py83CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py110CODE
LOWtests/losses/test_dynamic_soft_margin_loss.py155CODE
LOWtests/losses/test_lifted_structure_loss.py16CODE
LOWtests/losses/test_lifted_structure_loss.py96CODE
LOWtests/losses/test_losses_without_labels.py49CODE
LOWtests/losses/test_npairs_loss.py22CODE
LOWtests/losses/test_anchor_batched_backward.py101CODE
LOWtests/losses/test_anchor_batched_backward.py219CODE
LOWtests/losses/test_anchor_batched_backward.py284CODE
LOWtests/losses/test_anchor_batched_backward.py328CODE
LOWtests/losses/test_anchor_batched_backward.py368CODE
LOWtests/losses/test_proxy_nca_loss.py60CODE
LOWtests/losses/test_manifold_loss.py51CODE
LOWtests/losses/test_ranked_list_loss.py16CODE
LOWtests/losses/test_ranked_list_loss.py100CODE
LOWtests/losses/test_tuplet_margin_loss.py13CODE
LOWtests/losses/test_tuplet_margin_loss.py84CODE
LOWtests/losses/test_cross_batch_memory_state.py44CODE
LOWtests/losses/test_cross_batch_memory_state.py109CODE
LOWtests/losses/test_cross_batch_memory_state.py145CODE
LOWtests/losses/test_cross_batch_memory_state.py217CODE
LOWtests/losses/test_loss_composition.py50CODE
LOWtests/losses/test_loss_composition.py345CODE
LOWtests/losses/test_loss_composition.py406CODE
LOWtests/losses/test_ntxent_loss.py74CODE
LOWtests/losses/test_ntxent_loss.py163CODE
LOWtests/losses/test_ntxent_loss.py200CODE
LOWtests/losses/test_ntxent_loss.py326CODE
LOWtests/losses/test_nca_loss.py12CODE
LOWtests/losses/test_centroid_triplet_loss.py22CODE
LOWtests/losses/test_centroid_triplet_loss.py55CODE
LOW…ts/losses/test_selectively_contrastive_triplet_loss.py168CODE
LOWtests/losses/test_large_margin_softmax_loss.py23CODE
LOWtests/losses/test_large_margin_softmax_loss.py113CODE
LOWtests/losses/test_triplet_margin_loss.py201CODE
LOWtests/losses/test_rank_n_contrast_loss.py55CODE
LOWtests/losses/test_distance_matrix_input.py396CODE
LOWtests/losses/test_distance_matrix_input.py444CODE
LOWtests/losses/test_distance_matrix_input.py462CODE
LOWtests/losses/test_ge2e_loss.py62CODE
LOWtests/distributed/test_distributed.py803CODE
LOWtests/distributed/test_distributed_fallback.py66CODE
LOWtests/distributed/test_distributed_fallback.py117CODE
LOWtests/distributed/test_distributed_fallback.py166CODE
LOWtests/docs/test_documented_signatures.py89CODE
LOWtests/docs/test_public_surface.py29CODE
LOWtests/docs/test_public_surface.py50CODE
LOWtests/docs/test_documentation_paths.py58CODE
LOWtests/recipes/test_training.py301CODE
LOWtests/recipes/test_training.py36CODE
LOWtests/recipes/test_training.py359CODE
27 more matches not shown…
Modern Structural Boilerplate16 hits · 16 pts
SeverityFileLineSnippetContext
LOWsrc/pytorch_metric_learning/types.py16__all__ = [CODE
LOWsrc/pytorch_metric_learning/distributed.py13__all__ = ["DistributedLossWrapper", "DistributedMinerWrapper"]CODE
LOWsrc/pytorch_metric_learning/losses/__init__.py51__all__ = [CODE
LOWsrc/pytorch_metric_learning/losses/center_loss.py56 def update_centers(self, embeddings: Tensor, labels: Tensor) -> None:CODE
LOW…rch_metric_learning/losses/dynamic_soft_margin_loss.py115 def update_histogram(self, data: Tensor) -> None:CODE
LOWsrc/pytorch_metric_learning/utils/indexing.py10__all__ = [CODE
LOWsrc/pytorch_metric_learning/regularizers/__init__.py9__all__ = [CODE
LOW…ic_learning/regularizers/sparse_centers_regularizer.py44 def set_class_masks(self, num_classes: int, centers_per_class: int) -> None:CODE
LOWsrc/pytorch_metric_learning/samplers/__init__.py6__all__ = [CODE
LOWsrc/pytorch_metric_learning/miners/__init__.py12__all__ = [CODE
LOWsrc/pytorch_metric_learning/evaluation/thresholds.py9__all__ = [CODE
LOWsrc/pytorch_metric_learning/evaluation/__init__.py25__all__ = [CODE
LOWsrc/pytorch_metric_learning/evaluation/retrieval.py13__all__ = ["CustomKNN", "FaissKMeans", "FaissKNN", "MatchFinder"]CODE
LOW…orch_metric_learning/evaluation/accuracy_calculator.py25__all__ = [CODE
LOWsrc/pytorch_metric_learning/distances/__init__.py8__all__ = [CODE
LOWsrc/pytorch_metric_learning/reducers/__init__.py11__all__ = [CODE
Overly Generic Function Names8 hits · 8 pts
SeverityFileLineSnippetContext
LOWtests/losses/test_margin_loss.py13 def helper(CODE
LOWtests/losses/test_ntxent_loss.py74 def helper(CODE
LOWtests/losses/test_angular_loss.py53 def helper(CODE
LOWtests/losses/test_multi_similarity_loss.py57 def helper(CODE
LOWtests/losses/test_triplet_margin_loss.py70 def helper(CODE
LOWtests/miners/test_batch_easy_hard_miner.py344 def helper(self, a1, p, a2, n, gt):CODE
LOWtests/miners/test_hdc_miner.py85 def helper(self, pos_pairs, neg_pairs):CODE
LOWtests/miners/test_batch_hard_miner.py76 def helper(self, a, p, n):CODE
AI Structural Patterns2 hits · 2 pts
SeverityFileLineSnippetContext
LOWtests/losses/test_proxy_anchor_loss.py31CODE
LOW…orch_metric_learning/evaluation/accuracy_calculator.py312CODE