Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
DVDR_LLM — Ensemble framework for software vulnerability detection and repair using multiple large language models, with consensus analysis and evaluation tools for precision-recall trade-offs. | Kitploit
Tools/GitHubGitHub/erroristotle/dvdr_llm
Vulnerability AnalysisCode AnalysisMachine LearningPapers & ResearchLearning & EducationAI Security
GitHuberroristotle/dvdr_llm

DVDR_LLM

Ensemble framework for software vulnerability detection and repair using multiple large language models, with consensus analysis and evaluation tools for precision-recall trade-offs.

View Repository
38 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

DVDR-LLM: When Are LLMs Better Together for Software Vulnerability Detection and Repair?

Python 3.8+ Paper

Official implementation and artifact for the research paper:
"DVDR-LLM: When Are LLMs Better Together for Software Vulnerability Detection and Repair?"

🎯 Overview

DVDR-LLM is an ensemble framework that systematically examines the fundamental trade-offs in aggregating multiple Large Language Models (LLMs) for software vulnerability detection and repair. Our comprehensive evaluation reveals critical insights about precision-recall balancing, model diversity benefits, and consensus-based approaches in security-critical applications.

Key Findings

  • Precision-Recall Trade-offs: Ensemble reduces false positives in patch validity assessment (+10-12% accuracy) but increases false negatives in vulnerability identification
  • Complexity Benefits: Model diversity advantages increase with code abstraction level (+18% recall, +11.8% F1 for multi-file vulnerabilities)
  • Conservative Bias: 80% of models exhibit systematic conservative behavior (missing vulnerabilities vs. over-detection)
  • No Unique Specialists: All vulnerability detections overlap across the ensemble, validating majority voting strategies

📁 Repository Structure

root@kitploit:~
DVDR_LLM/
├── dvdr_llm/                  # Main package (professional structure)
│   ├── __init__.py            # Package exports
│   ├── cli.py                 # Command-line interface
│   ├── config.py              # Configuration settings
│   ├── core/                  # Core functionality
│   │   ├── api_client.py      # LLM API communication
│   │   ├── detector.py        # VulnerabilityDetector class
│   │   └── prompts.py         # Prompt generation utilities
│   ├── analysis/              # Analysis modules
│   │   ├── consensus.py       # Consensus analysis
│   │   └── metrics.py         # Performance metrics
│   ├── evaluation/            # Model evaluation
│   │   └── evaluator.py       # ModelEvaluator class
│   ├── visualization/         # Plotting and visualization
│   │   └── plotter.py         # ResultsPlotter class
│   └── tools/                 # Additional utilities
├── utils/                     # Original utility modules
│   ├── api.py                 # LLM API interaction helpers
│   ├── database.py            # SQLite helper functions
│   └── config.py              # Configuration constants
├── data/                      # Datasets and databases
│   ├── vulnerabilities.csv    # Vulnerability data
│   └── vulnerable and patched codes.sqlite
├── output/                    # Generated results and databases
│   ├── database_*.sqlite      # Model-specific databases
│   ├── consensus_analysis/    # Consensus analysis results
│   ├── metrics/              # Performance metrics
│   └── database_exports/     # Exported data
├── examples/                  # Usage examples
│   └── basic_usage.py         # Basic usage demonstration
├── docs/                      # Documentation
│   └── README_consensus_analysis.md
├── paper/                     # Research paper
│   ├── main.pdf               # Published paper
│   └── main.tex               # LaTeX source
├── setup.py                   # Package installation
├── requirements.txt           # Dependencies
├── CHANGELOG.md              # Change log
├── LICENSE                   # MIT License
└── README.md                 # This file

🚀 Quick Start

Prerequisites

  • Python 3.8+
  • Access to LLM APIs (Ollama, OpenAI, etc.)
  • SQLite for vulnerability databases

Installation

  1. Clone the repository:

    root@kitploit:~
    git clone https://github.com/Erroristotle/DVDR_LLM.git
    cd DVDR_LLM
    
  2. Install dependencies:

    root@kitploit:~
    pip install -r requirements.txt
    pip install -e .  # Install package in development mode
    
  3. Verify installation:

    root@kitploit:~
    python verify_package.py
    

Basic Usage

Command Line Interface

root@kitploit:~
# Run vulnerability detection with ensemble
dvdr-llm detect --models llama3-8b,codellama-7b --database data/vulnerabilities.sqlite

# Analyze consensus patterns (RQ2)
dvdr-llm analyze consensus --input results/metrics/model_predictions.csv --threshold 0.6

# Generate conflict pattern visualization (Figure in paper)
python dvdr_llm/visualization/conflict_pattern_plot.py results/metrics/reviewer_insights_disagreement_patterns.csv -o reviewer_insights

# Evaluate ensemble performance across abstraction levels (RQ3)
dvdr-llm evaluate --models-dir output/ --abstraction-analysis

Python API

root@kitploit:~
from dvdr_llm import VulnerabilityDetector, ConsensusAnalyzer, ModelEvaluator

# Initialize vulnerability detector
detector = VulnerabilityDetector("llama3-8b-instruct")

# Connect to database
detector.connect_to_database("data/vulnerabilities.sqlite")

# Analyze code for vulnerabilities
code = """
void vulnerable_function(char *input) {
    char buffer[100];
    strcpy(buffer, input);  // Buffer overflow
}
"""

# Get CVE predictions
cve_names = detector.analyze_code_for_cves(code, 2023)
print(f"Identified CVEs: {cve_names}")

# Detect vulnerability
is_vulnerable = detector.detect_vulnerability(code)
print(f"Is vulnerable: {is_vulnerable}")

# Process database entries
stats = detector.process_database_entries(limit=100)
print(f"Processed {stats['processed']} entries")

# Clean up
detector.close()

# Multi-model consensus analysis
model_databases = {
    "llama3-8b": "output/database_llama3-8b-instruct.sqlite",
    "codellama-7b": "output/database_codellama-7b-instruct.sqlite",
    "gemma2-9b": "output/database_gemma2-9b.sqlite"
}

analyzer = ConsensusAnalyzer()
consensus_results = analyzer.run_full_analysis(model_databases)

# Model evaluation
evaluator = ModelEvaluator()
evaluation_results = evaluator.evaluate_multiple_models(
    model_databases, 
    "data/ground_truth.csv"
)

📊 Reproducing Paper Results

Research Questions

RQ1: Impact of Aggregating Multiple LLMs

root@kitploit:~
# Generate Table 2 (Model comparison with delta percentages)
python dvdr_llm/tools/model_contribution_analysis.py results/metrics/model_predictions.csv --compare-ensemble --threshold 0.7

# Analyze individual vs ensemble performance
dvdr-llm evaluate --comparison-analysis --threshold 0.7

RQ2: Optimal Consensus Threshold

root@kitploit:~
# Generate Figure 3 (Threshold sensitivity analysis)
python dvdr_llm/tools/threshold_analysis.py results/metrics/model_predictions.csv --range 0.3-0.8

# Statistical validation of threshold selection
python dvdr_llm/analysis/statistical_validation.py --threshold-analysis

RQ3: Performance Across Abstraction Levels

root@kitploit:~
# Generate Table 3 (Abstraction level analysis)
python dvdr_llm/evaluation/evaluator.py --abstraction-analysis --threshold 0.6

# Level-specific performance evaluation
dvdr-llm evaluate --abstraction-levels 1,2,3 --ensemble

RQ4: Weighted Aggregation for Patch Quality

root@kitploit:~
# Analyze patch quality metrics (ROUGE, CodeBLEU, Complexity)
python dvdr_llm/tools/patch_quality_analysis.py results/patches/ --weighted-scoring

# Generate Figure 4 (Patch similarity and complexity analysis)
dvdr-llm visualize --patch-analysis --metrics results/patch_metrics.csv

Key Figures Generation

root@kitploit:~
# Main conflict pattern analysis figure (Figure 2)
python dvdr_llm/visualization/conflict_pattern_plot.py results/metrics/reviewer_insights_disagreement_patterns.csv -o reviewer_insights

# Threshold sensitivity analysis (Figure 3)
python dvdr_llm/visualization/enhanced_figure3_generator.py results/metrics/model_predictions.csv

# Statistical validation plots (Appendix)
python dvdr_llm/analysis/statistical_significance_analysis.py --generate-plots

🔧 Configuration

Model Configuration

Edit dvdr_llm/config.py to configure LLM endpoints:

root@kitploit:~
LLM_MODELS = {
    "llama3_8b": "ollama run llama3:8b-instruct",
    "codellama_7b": "ollama run codellama:7b-instruct",
    "mistral_7b": "ollama run mistral:7b-instruct",
    # Add your model configurations
}

# Consensus thresholds for different scenarios
CONSENSUS_THRESHOLDS = {
    "conservative": 0.8,  # High precision, low false positives
    "balanced": 0.6,      # Balanced precision-recall
    "sensitive": 0.4      # High recall, catch more vulnerabilities
}

Prompt Templates

The framework uses standardized prompt templates for reproducibility:

  • SVD1: Vulnerability identification in unpatched code
  • SVD2: Patch validity assessment
  • SVD3: CVE/CWE-guided vulnerability identification
  • SVD4: CVE/CWE-guided patch validation
  • SVR1: Zero-shot vulnerability repair
  • SVR2: Few-shot repair with commit descriptions

📈 Experimental Results

Model Performance Summary

Δ% shows performance difference from ensemble baseline

Key Insights

  1. Inverse Performance Relationship: Models excelling at detection often fail at verification
  2. Threshold Sensitivity: 60% threshold provides optimal balance across tasks
  3. Abstraction Benefits: Ensemble advantages increase with code complexity
  4. Conservative Bias: Systematic tendency toward under-detection vs. over-detection

🛠️ Advanced Usage

Custom Analysis

root@kitploit:~
# Implement custom consensus strategy
from dvdr_llm.analysis.consensus import ConsensusAnalyzer

class WeightedConsensus(ConsensusAnalyzer):
    def __init__(self, model_weights):
        self.weights = model_weights
    
    def weighted_majority_vote(self, predictions):
        weighted_sum = sum(pred * weight for pred, weight in zip(predictions, self.weights))
        return weighted_sum >= 0.5

# Use custom visualization
from dvdr_llm.visualization import ConflictPatternPlotter

plotter = ConflictPatternPlotter()
plotter.create_professional_figure(
    disagreement_data, 
    output_prefix="custom_analysis",
    style="publication"
)

Extending the Framework

root@kitploit:~
# Add new LLM model
from dvdr_llm.core.api_client import LLMClient

class CustomLLMClient(LLMClient):
    def __init__(self, api_endpoint, model_name):
        super().__init__(api_endpoint, model_name)
    
    def generate_response(self, prompt, **kwargs):
        # Implement custom API interaction
        pass

# Register new model
detector.register_model("custom-llm", CustomLLMClient("api_url", "model_name"))

📚 Documentation

  • API Reference: Detailed API documentation
  • Analysis Guide: Statistical analysis explanations
  • Visualization Guide: Figure generation instructions
  • Consensus Analysis: Consensus methodology details

🔬 Research Paper

The complete research findings are documented in paper/main.tex. Key contributions include:

  1. First comprehensive empirical evaluation of LLM ensemble diversity for vulnerability tasks
  2. Novel weighted repair evaluation system considering code quality beyond syntax
  3. Systematic analysis across three abstraction levels providing practical scalability insights
  4. Critical precision-recall trade-off analysis for security-critical applications

🤝 Contributing

We welcome contributions! Please see our contributing guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-analysis)
  3. Commit changes (git commit -am 'Add new analysis method')
  4. Push to branch (git push origin feature/new-analysis)
  5. Create Pull Request

📄 License

See LICENCE file.

If you use DVDR-LLM, please cite: @article{zibaeirad2025diverse, title={Diverse LLMs vs. Vulnerabilities: Who Detects and Fixes Them Better?}, author={Zibaeirad, Arastoo and Vieira, Marco}, journal={arXiv preprint arXiv:2512.12536}, year={2025} }

Download Tool
ModelSVD1 (Δ%)SVD2 (Δ%)SVD3 (Δ%)SVD4 (Δ%)
Llama3-8b+59.8%-87.5%+127.1%-73.5%
Llama3-70b-50.8%+54.4%-19.6%+13.5%
CodeLlama-7b+16.8%-34.6%+86.9%-45.4%
Ensemble (60%)BaselineBaselineBaselineBaseline