AI Slop Code RIsk Monitor

NirDiamant/RAG_Techniques

This repository showcases various advanced techniques for Retrieval-Augmented Generation (RAG) systems. Each technique has a detailed notebook tutorial.

27.9 Elevated pattern signal View on GitHub

Maintenance and Governance Review

This report summarizes scanner evidence for NirDiamant/RAG_Techniques, a Jupyter Notebook project with 29,770 GitHub stars. SynthScan examined 10,812 lines of code across 38 source files, recording 158 pattern matches distributed across 12 syntactic categories. The legacy adjusted pattern signal is 27.9 (Elevated pattern signal); it is not an authorship estimate.

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

27.9
Adjusted Signal
27.9
Raw Pattern Score
100%
Time Factor
2026-09-21
Last Push
29.8K
Stars
Jupyter Notebook
Language
10.8K
Lines of Code
38
Files
158
Pattern Hits
2026-10-12
Scan Date
0.11
HC Hit Rate

Risk Review · v3

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

Cognitive Ownership Risk 68.1/100 · HIGH

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

Hallucinated Dependency & Supply Chain Risk 19.9/100 · LOW

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

Agent Over-Engineering Ratio 12.4/100 · LOW

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

PR Review Velocity Impact 71.8/100 · HIGH

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

What These Metrics Mean

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

Pattern-Signal History

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

Severity Breakdown

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

CRITICAL 0HIGH 4MEDIUM 48LOW 106

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 158 distinct pattern matches across 12 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.

Self-Referential Comments24 hits · 79 pts
SeverityFileLineSnippetContext
MEDIUM⚡helper_functions.py166 # Define the prompt template for chain-of-thought reasoningCOMMENT
MEDIUM⚡helper_functions.py174 # Create a PromptTemplate object with the specified template and input variablesSTRING
MEDIUM⚡helper_functions.py180 # Create a chain by combining the prompt template and the language modelSTRING
MEDIUM…unnable_scripts/HyPE_Hypothetical_Prompt_Embeddings.py46 # Create a retriever from the vector storeCOMMENT
MEDIUM…l_rag_techniques_runnable_scripts/choose_chunk_size.py75# Define the main class for the RAG methodCOMMENT
MEDIUM…nnable_scripts/HyDe_Hypothetical_Document_Embedding.py18# Define the HyDe retriever class - creating vector store, generating hypothetical document, and retrievingCOMMENT
MEDIUM…l_rag_techniques_runnable_scripts/semantic_chunking.py56 # Create a vector store and retriever from the semantic chunksCOMMENT
MEDIUM…iques_runnable_scripts/retrieval_with_feedback_loop.py25# Define the Response classCOMMENT
MEDIUM…iques_runnable_scripts/retrieval_with_feedback_loop.py104# Define the main RAG classSTRING
MEDIUM⚡all_rag_techniques_runnable_scripts/graph_rag.py108# Define the knowledge graph classCOMMENT
MEDIUM⚡all_rag_techniques_runnable_scripts/graph_rag.py109# Define the Concepts classCOMMENT
MEDIUM⚡all_rag_techniques_runnable_scripts/graph_rag.py114# Define the KnowledgeGraph classCOMMENT
MEDIUM⚡all_rag_techniques_runnable_scripts/graph_rag.py315# Define the Query Engine classCOMMENT
MEDIUM⚡all_rag_techniques_runnable_scripts/graph_rag.py316# Define the AnswerCheck classCOMMENT
MEDIUM⚡all_rag_techniques_runnable_scripts/graph_rag.py322# Define the QueryEngine classCOMMENT
MEDIUM⚡all_rag_techniques_runnable_scripts/graph_rag.py809 # Create a graph RAG instanceCOMMENT
MEDIUMall_rag_techniques_runnable_scripts/graph_rag.py47# Define the document processor classCOMMENT
MEDIUMall_rag_techniques_runnable_scripts/graph_rag.py48# Define the DocumentProcessor classCOMMENT
MEDIUMall_rag_techniques_runnable_scripts/graph_rag.py584# Import necessary librariesCOMMENT
MEDIUMall_rag_techniques_runnable_scripts/graph_rag.py590# Define the Visualizer classCOMMENT
MEDIUMall_rag_techniques_runnable_scripts/graph_rag.py731# Define the graph RAG classCOMMENT
MEDIUMall_rag_techniques_runnable_scripts/self_rag.py70# Define main classCOMMENT
MEDIUMall_rag_techniques_runnable_scripts/simple_rag.py41 # Create a retriever from the vector storeCOMMENT
MEDIUM…_rag_techniques_runnable_scripts/adaptive_retrieval.py193# Define the main Adaptive RAG classCOMMENT
Modern AI Meta-Vocabulary23 hits · 70 pts
SeverityFileLineSnippetContext
MEDIUMllms.txt1# RAG TechniquesCOMMENT
MEDIUMllms.txt13## Foundational RAGCOMMENT
MEDIUMllms.txt52## Iterative and Self-Correcting RAGCOMMENT
MEDIUMllms.txt61## Graph RAGCOMMENT
MEDIUM⚡helper_functions.py166 # Define the prompt template for chain-of-thought reasoningCOMMENT
MEDIUMREADME.md3# Advanced RAG Techniques 🚀COMMENT
MEDIUMREADME.md255### 🌱 Foundational RAG TechniquesCOMMENT
MEDIUMCONTRIBUTING.md1# Contributing to RAG TechniquesCOMMENT
MEDIUMCONTRIBUTING.md41## Adding a New RAG MethodCOMMENT
MEDIUMCONTRIBUTING.md80### 1. [Simple RAG 🌱](https://colab.research.google.com/github/NirDiamant/RAG_Techniques/blob/main/all_rag_techniques/siCOMMENT
MEDIUM…unnable_scripts/HyPE_Hypothetical_Prompt_Embeddings.py185 # Initialize the HyPE-based RAG RetrieverCOMMENT
MEDIUM…l_rag_techniques_runnable_scripts/choose_chunk_size.py75# Define the main class for the RAG methodCOMMENT
MEDIUM…_techniques_runnable_scripts/contextual_compression.py109# Main function to run the RAG pipelineCOMMENT
MEDIUM…nnable_scripts/HyDe_Hypothetical_Document_Embedding.py76 # Create and run the RAG method instanceCOMMENT
MEDIUM…iques_runnable_scripts/retrieval_with_feedback_loop.py104# Define the main RAG classSTRING
MEDIUM…able_scripts/context_enrichment_window_around_chunk.py74# Main class that encapsulates the RAG methodCOMMENT
MEDIUM…able_scripts/context_enrichment_window_around_chunk.py139 # Initialize and run the RAG methodSTRING
MEDIUM…g_techniques_runnable_scripts/query_transformations.py62# Main class for the RAG methodCOMMENT
MEDIUM⚡all_rag_techniques_runnable_scripts/graph_rag.py809 # Create a graph RAG instanceCOMMENT
MEDIUM⚡all_rag_techniques_runnable_scripts/graph_rag.py815 # Input a query and get the retrieved information from the graph RAGCOMMENT
MEDIUMall_rag_techniques_runnable_scripts/graph_rag.py731# Define the graph RAG classCOMMENT
MEDIUM…_rag_techniques_runnable_scripts/adaptive_retrieval.py193# Define the main Adaptive RAG classCOMMENT
MEDIUMall_rag_techniques/README.md3## RAG Techniques - notebook indexCOMMENT
Unused Imports50 hits · 48 pts
SeverityFileLineSnippetContext
LOWtests/test_imports.py2CODE
LOW…unnable_scripts/HyPE_Hypothetical_Prompt_Embeddings.py14CODE
LOW…unnable_scripts/HyPE_Hypothetical_Prompt_Embeddings.py15CODE
LOW…_techniques_runnable_scripts/contextual_compression.py9CODE
LOW…_techniques_runnable_scripts/contextual_compression.py10CODE
LOW…nnable_scripts/HyDe_Hypothetical_Document_Embedding.py9CODE
LOW…nnable_scripts/HyDe_Hypothetical_Document_Embedding.py10CODE
LOWall_rag_techniques_runnable_scripts/raptor.py22CODE
LOWall_rag_techniques_runnable_scripts/raptor.py23CODE
LOWall_rag_techniques_runnable_scripts/light_rag.py9CODE
LOW…l_rag_techniques_runnable_scripts/semantic_chunking.py6CODE
LOW…g_techniques_runnable_scripts/document_augmentation.py9CODE
LOW…g_techniques_runnable_scripts/document_augmentation.py9CODE
LOW…g_techniques_runnable_scripts/document_augmentation.py21CODE
LOW…iques_runnable_scripts/retrieval_with_feedback_loop.py8CODE
LOW…iques_runnable_scripts/retrieval_with_feedback_loop.py14CODE
LOW…iques_runnable_scripts/retrieval_with_feedback_loop.py15CODE
LOW…able_scripts/context_enrichment_window_around_chunk.py2CODE
LOW…able_scripts/context_enrichment_window_around_chunk.py5CODE
LOW…able_scripts/context_enrichment_window_around_chunk.py6CODE
LOW…g_techniques_runnable_scripts/explainable_retrieval.py6CODE
LOW…g_techniques_runnable_scripts/explainable_retrieval.py7CODE
LOWall_rag_techniques_runnable_scripts/reranking.py14CODE
LOWall_rag_techniques_runnable_scripts/reranking.py15CODE
LOWall_rag_techniques_runnable_scripts/graph_rag.py18CODE
LOWall_rag_techniques_runnable_scripts/graph_rag.py29CODE
LOWall_rag_techniques_runnable_scripts/graph_rag.py33CODE
LOWall_rag_techniques_runnable_scripts/graph_rag.py34CODE
LOWall_rag_techniques_runnable_scripts/self_rag.py10CODE
LOWall_rag_techniques_runnable_scripts/self_rag.py11CODE
LOW…ag_techniques_runnable_scripts/hierarchical_indices.py8CODE
LOW…ag_techniques_runnable_scripts/hierarchical_indices.py8CODE
LOW…ag_techniques_runnable_scripts/hierarchical_indices.py11CODE
LOW…ag_techniques_runnable_scripts/hierarchical_indices.py12CODE
LOWall_rag_techniques_runnable_scripts/simple_rag.py10CODE
LOWall_rag_techniques_runnable_scripts/simple_rag.py11CODE
LOWall_rag_techniques_runnable_scripts/fusion_retrieval.py11CODE
LOWall_rag_techniques_runnable_scripts/fusion_retrieval.py12CODE
LOW…_rag_techniques_runnable_scripts/adaptive_retrieval.py9CODE
LOW…_rag_techniques_runnable_scripts/adaptive_retrieval.py10CODE
LOW…_rag_techniques_runnable_scripts/adaptive_retrieval.py10CODE
LOW…_rag_techniques_runnable_scripts/adaptive_retrieval.py11CODE
LOW…_rag_techniques_runnable_scripts/adaptive_retrieval.py17CODE
LOW…_rag_techniques_runnable_scripts/adaptive_retrieval.py18CODE
LOWevaluation/evalute_rag.py16CODE
LOWevaluation/evalute_rag.py17CODE
LOWevaluation/evalute_rag.py19CODE
LOWevaluation/evalute_rag.py34CODE
LOWevaluation/evalute_rag.py34CODE
LOWevaluation/evalute_rag.py34CODE
Verbosity Indicators11 hits · 25 pts
SeverityFileLineSnippetContext
LOW⚡…_techniques_runnable_scripts/contextual_compression.py42 # Step 1: Create a vector storeCOMMENT
LOW⚡…_techniques_runnable_scripts/contextual_compression.py45 # Step 2: Create a retrieverCOMMENT
LOW⚡…_techniques_runnable_scripts/contextual_compression.py48 # Step 3: Initialize language model and create a contextual compressorCOMMENT
LOW⚡…_techniques_runnable_scripts/contextual_compression.py52 # Step 4: Combine the retriever with the compressorCOMMENT
LOW⚡…_techniques_runnable_scripts/contextual_compression.py58 # Step 5: Create a QA chain with the compressed retrieverCOMMENT
LOW⚡all_rag_techniques_runnable_scripts/self_rag.py88 # Step 1: Determine if retrieval is necessaryCOMMENT
LOW⚡all_rag_techniques_runnable_scripts/self_rag.py95 # Step 2: Retrieve relevant documentsCOMMENT
LOW⚡all_rag_techniques_runnable_scripts/self_rag.py101 # Step 3: Evaluate relevance of retrieved documentsCOMMENT
LOW⚡all_rag_techniques_runnable_scripts/self_rag.py119 # Step 4: Generate response using relevant contextsCOMMENT
LOW⚡all_rag_techniques_runnable_scripts/self_rag.py127 # Step 5: Assess supportCOMMENT
LOW⚡all_rag_techniques_runnable_scripts/self_rag.py133 # Step 6: Evaluate utilityCOMMENT
Structural Annotation Overuse11 hits · 25 pts
SeverityFileLineSnippetContext
LOW⚡…_techniques_runnable_scripts/contextual_compression.py42 # Step 1: Create a vector storeCOMMENT
LOW⚡…_techniques_runnable_scripts/contextual_compression.py45 # Step 2: Create a retrieverCOMMENT
LOW⚡…_techniques_runnable_scripts/contextual_compression.py48 # Step 3: Initialize language model and create a contextual compressorCOMMENT
LOW⚡…_techniques_runnable_scripts/contextual_compression.py52 # Step 4: Combine the retriever with the compressorCOMMENT
LOW⚡…_techniques_runnable_scripts/contextual_compression.py58 # Step 5: Create a QA chain with the compressed retrieverCOMMENT
LOW⚡all_rag_techniques_runnable_scripts/self_rag.py88 # Step 1: Determine if retrieval is necessaryCOMMENT
LOW⚡all_rag_techniques_runnable_scripts/self_rag.py95 # Step 2: Retrieve relevant documentsCOMMENT
LOW⚡all_rag_techniques_runnable_scripts/self_rag.py101 # Step 3: Evaluate relevance of retrieved documentsCOMMENT
LOW⚡all_rag_techniques_runnable_scripts/self_rag.py119 # Step 4: Generate response using relevant contextsCOMMENT
LOW⚡all_rag_techniques_runnable_scripts/self_rag.py127 # Step 5: Assess supportCOMMENT
LOW⚡all_rag_techniques_runnable_scripts/self_rag.py133 # Step 6: Evaluate utilityCOMMENT
Hyper-Verbose Identifiers22 hits · 21 pts
SeverityFileLineSnippetContext
LOW⚡helper_functions.py129def retrieve_context_per_question(question, chunks_query_retriever):CODE
LOW⚡helper_functions.py162def create_question_answer_from_context_chain(llm):CODE
LOW⚡helper_functions.py186def answer_question_from_context(question, context, question_answer_from_context_chain):STRING
LOWhelper_functions.py294async def retry_with_exponential_backoff(coroutine, max_retries=5):STRING
LOWhelper_functions.py338def get_langchain_embedding_provider(provider: EmbeddingProvider, model_id: str = None):STRING
LOWtests/test_imports.py8def execute_imports_from_notebook(notebook_path) -> None:CODE
LOWtests/test_imports.py42def execute_imports_from_script_files(script_path) -> None:CODE
LOW…unnable_scripts/HyPE_Hypothetical_Prompt_Embeddings.py49 def generate_hypothetical_prompt_embeddings(self, chunk_text):CODE
LOW…l_rag_techniques_runnable_scripts/choose_chunk_size.py23def evaluate_response_time_and_accuracy(chunk_size, eval_questions, eval_documents, faithfulness_evaluator,CODE
LOW…l_rag_techniques_runnable_scripts/choose_chunk_size.py99 def create_faithfulness_evaluator(self):CODE
LOW…l_rag_techniques_runnable_scripts/choose_chunk_size.py110 def create_relevancy_evaluator(self):STRING
LOW…nnable_scripts/HyDe_Hypothetical_Document_Embedding.py34 def generate_hypothetical_document(self, query):CODE
LOW…g_techniques_runnable_scripts/document_augmentation.py52def clean_and_filter_questions(questions: List[str]) -> List[str]:CODE
LOW…able_scripts/context_enrichment_window_around_chunk.py17def split_text_to_chunks_with_indices(text: str, chunk_size: int, chunk_overlap: int) -> List[Document]:CODE
LOW…able_scripts/context_enrichment_window_around_chunk.py38def retrieve_with_context_overlap(vectorstore, retriever, query: str, num_neighbors: int = 1, chunk_size: int = 200,CODE
LOW⚡all_rag_techniques_runnable_scripts/graph_rag.py331 def _create_answer_check_chain(self):CODE
LOWall_rag_techniques_runnable_scripts/graph_rag.py95 def compute_similarity_matrix(self, embeddings):CODE
LOWall_rag_techniques_runnable_scripts/graph_rag.py206 def _extract_concepts_and_entities(self, content, llm):CODE
LOWall_rag_techniques_runnable_scripts/graph_rag.py567 def _retrieve_relevant_documents(self, query: str):CODE
LOWall_rag_techniques_runnable_scripts/fusion_retrieval.py20def encode_pdf_and_get_split_documents(path, chunk_size=1000, chunk_overlap=200):CODE
LOW…techniques_runnable_scripts/multi_faceted_filtering.py57def apply_similarity_threshold(CODE
LOWevaluation/evalute_rag.py40def create_deep_eval_test_cases(CODE
Docstring Block Structure3 hits · 15 pts
SeverityFileLineSnippetContext
HIGHhelper_functions.py80 Encodes a string into a vector store using OpenAI embeddings. Args: content (str): The text content toSTRING
HIGHhelper_functions.py295 Retries a coroutine using exponential backoff upon encountering a RateLimitError. Args: coroutine:STRING
HIGHhelper_functions.py339 Returns an embedding provider based on the specified provider and model ID. Args: provider (EmbeddingPSTRING
Redundant / Tautological Comments4 hits · 7 pts
SeverityFileLineSnippetContext
LOW⚡helper_functions.py115 # Assign metadata to each chunkCOMMENT
LOW…_techniques_runnable_scripts/contextual_compression.py85 # Display the result and the source documentsCOMMENT
LOWall_rag_techniques_runnable_scripts/graph_rag.py456 # Check if we have a complete answer with the current contextCOMMENT
LOWall_rag_techniques_runnable_scripts/graph_rag.py497 # Check if we have a complete answer after adding the neighbor's contentCOMMENT
Excessive Try-Catch Wrapping5 hits · 6 pts
SeverityFileLineSnippetContext
LOW⚡helper_functions.py123 except Exception as e:CODE
LOWtests/test_imports.py33 except Exception as e:CODE
LOWtests/test_imports.py64 except Exception as e:CODE
MEDIUMall_rag_techniques_runnable_scripts/crag.py119 print("Error parsing search results. Returning empty list.")CODE
LOWall_rag_techniques_runnable_scripts/light_rag.py156 except Exception as e:CODE
Deep Nesting3 hits · 2 pts
SeverityFileLineSnippetContext
LOWtests/test_imports.py8CODE
LOWall_rag_techniques_runnable_scripts/light_rag.py149CODE
LOWall_rag_techniques_runnable_scripts/graph_rag.py363CODE
Synthetic Comment Markers1 hit · 2 pts
SeverityFileLineSnippetContext
HIGH…l_rag_techniques_runnable_scripts/choose_chunk_size.py26 Evaluate the average response time, faithfulness, and relevancy of responses generated by GPT-3.5-turbo for a given STRING
AI Structural Patterns1 hit · 1 pts
SeverityFileLineSnippetContext
LOWall_rag_techniques_runnable_scripts/crag.py91CODE