Skip to content
Saad edited this page Mar 10, 2026 · 1 revision

πŸ›‘οΈ LogicShield – AI-Argument Simulator With Risk Forecasting

πŸš€ An AI-powered debate training and communication risk analysis platform. LogicShield strengthens your arguments, detects logical fallacies, and evaluates reputational risk before you publish, pitch, or perform.

✨ Features

LogicShield combines adversarial argument simulation with structured NLP analysis to help users improve both logic and long-term communication safety.

  • 🧠 AI Debate Simulation – Real-time adversarial opponent with selectable personas (logical, aggressive, skeptical).
  • βš–οΈ Logical Fallacy Detection – Automatically identifies common fallacies using transformer-based ML models (ad hominem, strawman, false dilemma, slippery slope).
  • πŸ“Š Argument Strength Scoring – Quantifies coherence, evidence support, sentiment, and logical structure.
  • πŸ›‘οΈ Reputation Risk Estimation – Flags extreme phrasing, moral polarity, identity-sensitive language using toxicity and hate speech detection.
  • πŸ“ˆ Progress Analytics Dashboard – Track improvement across debate sessions.
  • πŸ“ Rewrite Suggestions – AI-powered refinement for stronger, clearer, safer arguments.

🎯 Use Cases

  • πŸŽ“ Students preparing for debates
  • βš–οΈ Law aspirants & legal professionals
  • 🎀 Public speakers & podcasters
  • 🏒 Executives preparing presentations
  • πŸ“’ Political commentators

βš™οΈ Platform Support

Platform Minimum Requirements Supported?
Web Application (Fully Responsive) Modern Browser (Chrome, Brave, Edge, Firefox, etc) βœ…

πŸ› οΈ Tech Stack

Frontend

  • Next.js 14
  • React 18
  • Tailwind CSS
  • TypeScript

Backend

  • Framework: FastAPI (Python)
  • ORM: SQLAlchemy 2.0
  • Database: SQLite (dev) / PostgreSQL (prod)
  • Authentication: JWT with python-jose

Backend Configuration

Copy .env.template to .env and configure:

Variable Description Default
DATABASE_URL Database connection URL sqlite:///./logicshield.db
USE_SQLITE Use SQLite (true/false) true
SECRET_KEY Secret key for JWT (auto-generated)
HF_TOKEN Hugging Face token (optional)
PORT Server port 8000
DEBUG Debug mode true

NLP & ML

  • Deep Learning: PyTorch 2.1+
  • Transformers: Hugging Face Transformers
    • facebook/bart-large-mnli - Fallacy detection
    • martin-ha/toxic-comment-model - Toxicity detection
    • facebook/roberta-hate-speech-dynabench-r4-target - Hate speech detection
    • distilbert-base-uncased-finetuned-sst-2-english - Sentiment analysis
  • Embeddings: Sentence-BERT (sentence-transformers/all-MiniLM-L6-v2)
  • ML: scikit-learn

πŸš€ Getting Started

1️⃣ Clone the Repository

git clone https://github.com/saad2134/logic-shield.git
cd logic-shield

2️⃣ Backend Setup

cd backend

# Create virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate  # Linux/Mac
# or: venv\Scripts\activate  # Windows

# Install dependencies
pip install -r requirements.txt

# Copy environment template and configure
cp .env.template .env

# Run the server
uvicorn main:app --reload

The API will be available at http://localhost:8000

  • API Docs: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

3️⃣ Frontend Setup

cd web
npm install
npm run dev

Open http://localhost:3000


πŸ“ Folder Structure

logic-shield/
β”‚
β”œβ”€β”€ web/                 # Next.js frontend
β”œβ”€β”€ backend/             # FastAPI backend
β”‚   β”œβ”€β”€ app/            # Application config
β”‚   β”œβ”€β”€ api/            # API routes & schemas
β”‚   β”œβ”€β”€ database/       # Database models & connection
β”‚   β”œβ”€β”€ services/       # NLP/ML services
β”‚   β”œβ”€β”€ main.py         # Application entry point
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── .env.template   # Environment variables template
β”‚
└── docs/               # Documentation

πŸ›οΈ Project Architecture

graph TB
    subgraph Client["Frontend (Web)"]
        UI[Next.js UI]
    end

    subgraph Backend["Backend (FastAPI)"]
        API[API Routes]
        Auth[JWT Auth]
        Config[Config]
    end

    subgraph Services["NLP/ML Services"]
        FD[Fallacy Detector]
        AS[Argument Strength]
        RR[Reputation Risk]
        DS[Debate Simulator]
    end

    subgraph MLModels["ML Models"]
        BART[BART-Large-MNLI]
        TOX[Toxicity Model]
        HATE[Hate Speech Model]
        SENT[Sentiment Model]
        EMB[Sentence-BERT]
    end

    subgraph DB["Database"]
        SQLite[(SQLite)]
        PG[(PostgreSQL)]
    end

    UI -->|HTTP| API
    API --> Auth
    API --> Services
    API --> DB
    
    Services --> MLModels
    FD --> BART
    RR --> TOX
    RR --> HATE
    AS --> SENT
    AS --> EMB
    
    Config -.->|Config| Services
Loading

See docs/BACKEND.md for detailed architecture documentation.


πŸ“± Screenshots

Coming Soon


πŸ“Š Project Stats

Repo Size Last Commit Open Issues License Forks Stars Contributors

⭐ Star History

Star History Chart

πŸ” Disclaimer

LogicShield provides probabilistic analysis based on NLP models. It does not guarantee real-world outcomes or predict future controversy with certainty.

✍️ Endnote

⭐ Star this repository if you find it useful. Build stronger arguments. Communicate responsibly.


🏷 Tags

nlp natural-language-processing transformers bert llm large-language-models argument-mining computational-argumentation logical-fallacy-detection fallacy-classification debate-ai debate-training argument-analysis critical-thinking reasoning-ai semantic-embeddings sentence-bert text-classification ai-webapp fastapi nextjs react machine-learning deep-learning reputation-analysis communication-intelligence ai-simulation adversarial-ai persuasion-analysis explainable-ai data-driven-feedback education-tech edtech-ai logicshield