Live Application: dialectic-ai-ahdhkarxnqe9m7bddt5jhw.streamlit.app
Dialectic AI is a RAG based application that leverages LangGraph to orchestrate a multi agent debate system designed to transform polarized news into objective and fact grounded synthesis. The system utilizes a stateful workflow of specialized AI agents including Debaters that argue opposing perspectives, a Fact Checker that grounds claims using external search and penalizes contradictions via DeBERTa, a Fallacy Checker that flags logical inconsistencies, and a Mediator that evaluates the debate to generate a final, neutral summary. By structuring this interaction as a directed graph, the project provides an interactive streamlit dashboard where users can monitor the reasoning pipeline, track source credibility via quantitative metrics like Authority Scores and read an unbiased distillation of complex current events.
Inspired by the Hegelian Dialectic (Thesis + Antithesis = Synthesis), this project moves beyond simple summarization. Modern news is often polarized, Dialectic AI neutralizes this by forcing two specialized agents into a controlled debate:
- The Supporter (Thesis): Defends the core claims of the input text.
- The Challenger (Antithesis): Scrutinizes biases, identifying logical leaps and omissions.
- The Mediator (Synthesis): Evaluates the debate, prioritizes factually grounded arguments, and produces a final, objective synthesis.
Built on LangGraph, the system operates as a multi agent state machine. Unlike a linear prompt chain, Dialectic AI features cyclic reasoning and autonomous Reflexion loops.
- Analyst Node: Dynamically assigns professional personas to the agents based on the article's topic.
- Adversarial Nodes: Challenger and Supporter agents generate contrasting summaries of the news.
- Fact Checker Node: An algorithmic engine that performs deep linguistic cross referencing between the AI's claims and the source.
- Fallacy Detector: A node that uses LLM as Judge to critique the agents' logic.
- Router Logic: If an agent's Authority Score is too low, the graph autonomously loops back for a Reflexion rewrite.
- Mediator Node: Synthesizes the final report using the most verified points from both sides.
This project utilizes a multi layered Retrieval Augmented Generation (RAG) pipeline:
- Automatically fetches and cleans HTML from live article links.
- During verification, if an agent brings in a fact not in the source text, the system invokes the DuckDuckGo Search API in real time to distinguish between helpful context and hallucination.
- Inference Cloud: Groq (Llama 3.3-70b & Qwen-32b) for high reasoning debate rounds.
- NER Engine: spaCy (en_core_web_md) for localized entity tracking.
- Semantic Verification: DeBERTa-v3-small CrossEncoder for Natural Language Inference (NLI), detecting contradictions between AI claims and source data.
- Quantified Truth: Calculation of ROUGE (Information Conservation) and Sentiment Neutrality metrics.
This app is optimized for Streamlit Cloud deployment.
- Fork this repository.
- Connect to Streamlit Cloud.
- Add your GROQ_API_KEY to the Secrets management on the Streamlit dashboard.
- Clone the repository:
git clone https://github.com/Prateek-845/Dialectic-AI.git cd Dialectic-AI - Install dependencies:
pip install -r requirements.txt python -m spacy download en_core_web_md
- Set environment variables: Create a .env file with your GROQ_API_KEY.
- Run the application:
python -m streamlit run app.py
Dialectic AI provides a visual Confidence Map using color coded HTML highlights:
- Verified: Claim was found directly in the source text.
- Web Verified: Claim was confirmed via real time DuckDuckGo RAG search.
- Unverified: Potential hallucination - heavily penalized in the Authority Score.
