# dheerajdamala/probing architecture

> Architecture diagram of the GitHub repository dheerajdamala/probing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dheerajdamala/probing
- Repository: https://github.com/dheerajdamala/probing

## Overview

ISAE is a research toolkit for learning security representations, probing code-model activations, steering generation, and evaluating security and functional correctness. Its principal documented workflow prepares paired security data, loads a Mistral model, extracts representations and steering vectors, optionally intervenes during generation, then evaluates generated code on separate security and functional measures. A substantial companion SQL-injection analyzer adds project-level static analysis and report generation. The README documents the research capabilities; source-index references and excerpts support the analyzer connections, but several broader pipeline links are documented rather than verified from full implementations.

Main entry points: [`experiments/sqli_probe_v3_full_mistral/extension/pipeline.py`](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/pipeline.py) (Analysis Pipeline), [`src/model/load_model.py`](https://github.com/dheerajdamala/probing/blob/main/src/model/load_model.py) (Mistral Loader), [`src/steering/steered_generate.py`](https://github.com/dheerajdamala/probing/blob/main/src/steering/steered_generate.py) (Steered Generation), [`src/steering/extract_security_vectors.py`](https://github.com/dheerajdamala/probing/blob/main/src/steering/extract_security_vectors.py) (Security Vectors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_research_data["Research Data"]
  node_dataset_download["Dataset Download"]
  node_dataset_prepare["Dataset Preparation<br/>[prepare_dataset.py]"]
  node_dataset_validate["Dataset Validation"]
  node_sink_extractor["SQL Sink Extraction"]
end

subgraph group_model_runtime["Model Runtime"]
  node_model_loader["Mistral Loader<br/>[load_model.py]"]
  node_activation_extract["Activation Extraction"]
end

subgraph group_security_steering["Probing and Steering"]
  node_vector_extract["Security Vectors"]
  node_semantic_probe["Semantic Probe"]
  node_probe_evaluate["Probe Evaluation"]
  node_activation_hook["Steering Hook<br/>[activation_hook.py]"]
  node_steered_generate["Steered Generation"]
  node_vector_evaluate["Vector Evaluation"]
  node_single_sample_probe["Single-Sample Probe<br/>[inference.py]"]
  node_probe_model["Probe Model<br/>[probe_model.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_security_eval["Security Evaluation<br/>[security_eval.py]"]
  node_functional_eval["Functional Evaluation<br/>[functional_eval.py]"]
  node_benchmark_runner["Benchmark Runner<br/>[run_benchmarks.py]"]
end

subgraph group_sql_analysis["SQL Analysis"]
  node_sql_input["Project Input<br/>[input_handler.py]"]
  node_sql_pipeline["Analysis Pipeline<br/>[pipeline.py]"]
  node_sql_ast["SQL AST Analysis<br/>[ast_analyzer.py]"]
  node_sql_dataflow["Query Dataflow<br/>[query_dataflow.py]"]
  node_sql_interproc["Interprocedural Analysis"]
  node_sql_project_graph["Project AST Graph"]
  node_sql_representation["Representation Extraction"]
  node_sql_probe["Probe Prediction<br/>[probe_predictor.py]"]
  node_sql_classifier["Vulnerability Classification"]
  node_sql_evidence["Evidence Builder"]
  node_sql_report["Report Generation"]
  node_sql_v1_ast["Frozen AST Analysis<br/>[ast_analyzer.py]"]
  node_sql_v1_interproc["Frozen Interprocedural Analysis"]
end

node_researcher(("Researcher"))

node_researcher -->|"requests data"| node_dataset_download
node_researcher -.->|"submits code"| node_sql_pipeline
node_dataset_download -->|"supplies datasets"| node_dataset_prepare
node_dataset_prepare -->|"prepares splits"| node_dataset_validate
node_researcher -->|"starts experiments"| node_model_loader
node_model_loader -->|"loads model for"| node_activation_extract
node_model_loader -->|"loads model for"| node_semantic_probe
node_model_loader -->|"provides model to"| node_activation_hook
node_activation_extract -->|"extracts training features"| node_semantic_probe
node_semantic_probe -->|"trains probe for"| node_probe_evaluate
node_researcher -->|"runs vector extraction"| node_vector_extract
node_researcher -->|"requests generation"| node_steered_generate
node_activation_hook -->|"intervenes during"| node_steered_generate
node_vector_extract -->|"provides direction"| node_activation_hook
node_vector_extract -->|"evaluates vectors"| node_vector_evaluate
node_steered_generate -->|"checks vulnerabilities"| node_security_eval
node_steered_generate -->|"runs functional tests"| node_functional_eval
node_researcher -->|"runs benchmarks"| node_benchmark_runner
node_benchmark_runner -->|"runs security tests"| node_security_eval
node_benchmark_runner -->|"runs functional tests"| node_functional_eval
node_sql_pipeline -->|"processes input"| node_sql_input
node_sql_pipeline -->|"runs AST analysis"| node_sql_ast
node_sql_pipeline -->|"traces query flow"| node_sql_dataflow
node_sql_pipeline -->|"runs cross-file analysis"| node_sql_interproc
node_sql_pipeline -->|"extracts representations"| node_sql_representation
node_sql_pipeline -->|"requests prediction"| node_sql_probe
node_sql_pipeline -->|"classifies findings"| node_sql_classifier
node_sql_pipeline -->|"builds evidence"| node_sql_evidence
node_sql_pipeline -->|"generates report"| node_sql_report
node_sql_interproc -->|"uses project graph"| node_sql_project_graph
node_sql_interproc -->|"uses AST analysis"| node_sql_ast
node_sql_representation -->|"uses sink regions"| node_sink_extractor
node_single_sample_probe -->|"scores representations"| node_probe_model
node_researcher -->|"analyzes code"| node_single_sample_probe
node_sql_v1_interproc -->|"uses AST analysis"| node_sql_v1_ast
node_sql_v1_interproc -.->|"references graph module"| node_sql_project_graph

click node_dataset_download "https://github.com/dheerajdamala/probing/blob/main/src/data/download_datasets.py"
click node_dataset_prepare "https://github.com/dheerajdamala/probing/blob/main/src/data/prepare_dataset.py"
click node_dataset_validate "https://github.com/dheerajdamala/probing/blob/main/src/data/validate_dataset.py"
click node_model_loader "https://github.com/dheerajdamala/probing/blob/main/src/model/load_model.py"
click node_activation_extract "https://github.com/dheerajdamala/probing/blob/main/src/model/extract_activations.py"
click node_vector_extract "https://github.com/dheerajdamala/probing/blob/main/src/steering/extract_security_vectors.py"
click node_semantic_probe "https://github.com/dheerajdamala/probing/blob/main/src/probes/train_semantic_probe.py"
click node_probe_evaluate "https://github.com/dheerajdamala/probing/blob/main/src/probes/evaluate_semantic_probe.py"
click node_activation_hook "https://github.com/dheerajdamala/probing/blob/main/src/steering/activation_hook.py"
click node_steered_generate "https://github.com/dheerajdamala/probing/blob/main/src/steering/steered_generate.py"
click node_vector_evaluate "https://github.com/dheerajdamala/probing/blob/main/src/steering/evaluate_vectors.py"
click node_security_eval "https://github.com/dheerajdamala/probing/blob/main/src/evaluation/security_eval.py"
click node_functional_eval "https://github.com/dheerajdamala/probing/blob/main/src/evaluation/functional_eval.py"
click node_benchmark_runner "https://github.com/dheerajdamala/probing/blob/main/src/evaluation/run_benchmarks.py"
click node_sql_input "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/input_handler.py"
click node_sql_pipeline "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/pipeline.py"
click node_sql_ast "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/ast_analyzer.py"
click node_sql_dataflow "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/query_dataflow.py"
click node_sql_interproc "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/interprocedural_analyzer.py"
click node_sql_project_graph "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/project_ast_graph.py"
click node_sql_representation "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/representation_extractor.py"
click node_sql_probe "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/probe_predictor.py"
click node_sql_classifier "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/vulnerability_classifier.py"
click node_sql_evidence "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/evidence_builder.py"
click node_sql_report "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/report_generator.py"
click node_sql_v1_ast "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension_v1_frozen/ast_analyzer.py"
click node_sql_v1_interproc "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension_v1_frozen/interprocedural_analyzer.py"
click node_sink_extractor "https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v2/extraction/ast_sink_extractor.py"
click node_single_sample_probe "https://github.com/dheerajdamala/probing/blob/main/security_probe/src/inference.py"
click node_probe_model "https://github.com/dheerajdamala/probing/blob/main/security_probe/src/probe_model.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dataset_download,node_dataset_prepare,node_dataset_validate,node_sink_extractor toneBlue
class node_model_loader,node_activation_extract toneAmber
class node_vector_extract,node_semantic_probe,node_probe_evaluate,node_activation_hook,node_steered_generate,node_vector_evaluate,node_single_sample_probe,node_probe_model toneMint
class node_security_eval,node_functional_eval,node_benchmark_runner toneRose
class node_sql_input,node_sql_pipeline,node_sql_ast,node_sql_dataflow,node_sql_interproc,node_sql_project_graph,node_sql_representation,node_sql_probe,node_sql_classifier,node_sql_evidence,node_sql_report,node_sql_v1_ast,node_sql_v1_interproc,node_researcher toneIndigo
```

## Components

### Research Data

- [Dataset Download](https://github.com/dheerajdamala/probing/blob/main/src/data/download_datasets.py): `src/data/download_datasets.py`
- [Dataset Preparation](https://github.com/dheerajdamala/probing/blob/main/src/data/prepare_dataset.py): `src/data/prepare_dataset.py`
- [Dataset Validation](https://github.com/dheerajdamala/probing/blob/main/src/data/validate_dataset.py): `src/data/validate_dataset.py`
- [SQL Sink Extraction](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v2/extraction/ast_sink_extractor.py): `experiments/sqli_probe_v2/extraction/ast_sink_extractor.py`

### Model Runtime

- [Mistral Loader](https://github.com/dheerajdamala/probing/blob/main/src/model/load_model.py): `src/model/load_model.py`
- [Activation Extraction](https://github.com/dheerajdamala/probing/blob/main/src/model/extract_activations.py): `src/model/extract_activations.py`

### Probing and Steering

- [Security Vectors](https://github.com/dheerajdamala/probing/blob/main/src/steering/extract_security_vectors.py): `src/steering/extract_security_vectors.py`
- [Semantic Probe](https://github.com/dheerajdamala/probing/blob/main/src/probes/train_semantic_probe.py): `src/probes/train_semantic_probe.py`
- [Probe Evaluation](https://github.com/dheerajdamala/probing/blob/main/src/probes/evaluate_semantic_probe.py): `src/probes/evaluate_semantic_probe.py`
- [Steering Hook](https://github.com/dheerajdamala/probing/blob/main/src/steering/activation_hook.py): `src/steering/activation_hook.py`
- [Steered Generation](https://github.com/dheerajdamala/probing/blob/main/src/steering/steered_generate.py): `src/steering/steered_generate.py`
- [Vector Evaluation](https://github.com/dheerajdamala/probing/blob/main/src/steering/evaluate_vectors.py): `src/steering/evaluate_vectors.py`
- [Single-Sample Probe](https://github.com/dheerajdamala/probing/blob/main/security_probe/src/inference.py): `security_probe/src/inference.py`
- [Probe Model](https://github.com/dheerajdamala/probing/blob/main/security_probe/src/probe_model.py): `security_probe/src/probe_model.py`

### Evaluation

- [Security Evaluation](https://github.com/dheerajdamala/probing/blob/main/src/evaluation/security_eval.py): `src/evaluation/security_eval.py`
- [Functional Evaluation](https://github.com/dheerajdamala/probing/blob/main/src/evaluation/functional_eval.py): `src/evaluation/functional_eval.py`
- [Benchmark Runner](https://github.com/dheerajdamala/probing/blob/main/src/evaluation/run_benchmarks.py): `src/evaluation/run_benchmarks.py`

### SQL Analysis

- [Project Input](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/input_handler.py): `experiments/sqli_probe_v3_full_mistral/extension/input_handler.py`
- [Analysis Pipeline](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/pipeline.py): `experiments/sqli_probe_v3_full_mistral/extension/pipeline.py`
- [SQL AST Analysis](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/ast_analyzer.py): `experiments/sqli_probe_v3_full_mistral/extension/ast_analyzer.py`
- [Query Dataflow](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/query_dataflow.py): `experiments/sqli_probe_v3_full_mistral/extension/query_dataflow.py`
- [Interprocedural Analysis](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/interprocedural_analyzer.py): `experiments/sqli_probe_v3_full_mistral/extension/interprocedural_analyzer.py`
- [Project AST Graph](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/project_ast_graph.py): `experiments/sqli_probe_v3_full_mistral/extension/project_ast_graph.py`
- [Representation Extraction](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/representation_extractor.py): `experiments/sqli_probe_v3_full_mistral/extension/representation_extractor.py`
- [Probe Prediction](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/probe_predictor.py): `experiments/sqli_probe_v3_full_mistral/extension/probe_predictor.py`
- [Vulnerability Classification](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/vulnerability_classifier.py): `experiments/sqli_probe_v3_full_mistral/extension/vulnerability_classifier.py`
- [Evidence Builder](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/evidence_builder.py): `experiments/sqli_probe_v3_full_mistral/extension/evidence_builder.py`
- [Report Generation](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension/report_generator.py): `experiments/sqli_probe_v3_full_mistral/extension/report_generator.py`
- [Frozen AST Analysis](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension_v1_frozen/ast_analyzer.py): `experiments/sqli_probe_v3_full_mistral/extension_v1_frozen/ast_analyzer.py`
- [Frozen Interprocedural Analysis](https://github.com/dheerajdamala/probing/blob/main/experiments/sqli_probe_v3_full_mistral/extension_v1_frozen/interprocedural_analyzer.py): `experiments/sqli_probe_v3_full_mistral/extension_v1_frozen/interprocedural_analyzer.py`

### Other components

- **Researcher**

## Connections

- Researcher → Dataset Download: requests data (evidence: `README.md`)
- Researcher → Analysis Pipeline: submits code
- Dataset Download → Dataset Preparation: supplies datasets (evidence: `README.md`)
- Dataset Preparation → Dataset Validation: prepares splits (evidence: `README.md`)
- Researcher → Mistral Loader: starts experiments (evidence: `README.md`)
- Mistral Loader → Activation Extraction: loads model for (evidence: `src/model/extract_activations.py`)
- Mistral Loader → Semantic Probe: loads model for (evidence: `src/probes/train_semantic_probe.py`)
- Mistral Loader → Steering Hook: provides model to (evidence: `src/steering/activation_hook.py`)
- Activation Extraction → Semantic Probe: extracts training features (evidence: `src/probes/train_semantic_probe.py`)
- Semantic Probe → Probe Evaluation: trains probe for (evidence: `README.md`)
- Researcher → Security Vectors: runs vector extraction (evidence: `README.md`)
- Researcher → Steered Generation: requests generation (evidence: `README.md`)
- Steering Hook → Steered Generation: intervenes during (evidence: `README.md`)
- Security Vectors → Steering Hook: provides direction (evidence: `README.md`)
- Security Vectors → Vector Evaluation: evaluates vectors (evidence: `README.md`)
- Steered Generation → Security Evaluation: checks vulnerabilities (evidence: `README.md`)
- Steered Generation → Functional Evaluation: runs functional tests (evidence: `README.md`)
- Researcher → Benchmark Runner: runs benchmarks (evidence: `README.md`)
- Benchmark Runner → Security Evaluation: runs security tests (evidence: `README.md`)
- Benchmark Runner → Functional Evaluation: runs functional tests (evidence: `README.md`)
- Analysis Pipeline → Project Input: processes input (evidence: `experiments/sqli_probe_v3_full_mistral/extension/pipeline.py`)
- Analysis Pipeline → SQL AST Analysis: runs AST analysis (evidence: `experiments/sqli_probe_v3_full_mistral/extension/pipeline.py`)
- Analysis Pipeline → Query Dataflow: traces query flow (evidence: `experiments/sqli_probe_v3_full_mistral/extension/pipeline.py`)
- Analysis Pipeline → Interprocedural Analysis: runs cross-file analysis (evidence: `experiments/sqli_probe_v3_full_mistral/extension/pipeline.py`)
- Analysis Pipeline → Representation Extraction: extracts representations (evidence: `experiments/sqli_probe_v3_full_mistral/extension/pipeline.py`)
- Analysis Pipeline → Probe Prediction: requests prediction (evidence: `experiments/sqli_probe_v3_full_mistral/extension/pipeline.py`)
- Analysis Pipeline → Vulnerability Classification: classifies findings (evidence: `experiments/sqli_probe_v3_full_mistral/extension/pipeline.py`)
- Analysis Pipeline → Evidence Builder: builds evidence (evidence: `experiments/sqli_probe_v3_full_mistral/extension/pipeline.py`)
- Analysis Pipeline → Report Generation: generates report (evidence: `experiments/sqli_probe_v3_full_mistral/extension/pipeline.py`)
- Interprocedural Analysis → Project AST Graph: uses project graph (evidence: `experiments/sqli_probe_v3_full_mistral/extension/interprocedural_analyzer.py`)
- Interprocedural Analysis → SQL AST Analysis: uses AST analysis (evidence: `experiments/sqli_probe_v3_full_mistral/extension/interprocedural_analyzer.py`)
- Representation Extraction → SQL Sink Extraction: uses sink regions (evidence: `experiments/sqli_probe_v3_full_mistral/extension/representation_extractor.py`)
- Single-Sample Probe → Probe Model: scores representations (evidence: `security_probe/src/inference.py`)
- Researcher → Single-Sample Probe: analyzes code
- Frozen Interprocedural Analysis → Frozen AST Analysis: uses AST analysis (evidence: `experiments/sqli_probe_v3_full_mistral/extension_v1_frozen/interprocedural_analyzer.py`)
- Frozen Interprocedural Analysis → Project AST Graph: references graph module (evidence: `experiments/sqli_probe_v3_full_mistral/extension_v1_frozen/interprocedural_analyzer.py`)
