Spaces:
Paused
Paused
|
Download docs/ARCHITECTURE.md from shravan66/BeyondBinary: direct link, hf CLI and curl.
- Browser
- Download file 5.83 kB
-
https://huggingface.co/spaces/shravan66/BeyondBinary/resolve/main/docs/ARCHITECTURE.md
- Command line
-
hf download hf://spaces/shravan66/BeyondBinary/docs/ARCHITECTURE.md
-
curl -L -o ARCHITECTURE.md https://huggingface.co/spaces/shravan66/BeyondBinary/resolve/main/docs/ARCHITECTURE.md
5.83 kB
A newer version of the Gradio SDK is available: 6.31.0
BeyondBinary System Architecture & Technical Specifications
BeyondBinary is an Explainable Artificial Intelligence (XAI) media credibility and political bias analysis platform designed to mitigate polarization and automate forensic claim verification.
1. Directory Structure
BeyondBinary/
├── backend/ # Python Backend Services & Neural Inference
│ ├── __init__.py # Package initialization & path resolution
│ ├── main.py # FastAPI routers, endpoints, CORS & SPA serving
│ ├── verifier.py # RoBERTa-large-MNLI premise entailment engine
│ ├── claim_extractor.py # ClaimBuster DeBERTa-v2 check-worthiness extraction
│ ├── bias_detector.py # Political Bias BERT + AllSides 101-outlet grounding
│ ├── scorer.py # Calibrated multi-factor credibility scoring
│ ├── xai_explainer.py # Explainable AI semantic conflict & rationale engine
│ ├── search_provider.py # Multi-Tier search hierarchy (Brave API → Wiki → RSS)
│ ├── article_fetcher.py # Multi-tier web article ingestion & parsing
│ ├── playwright_fetcher.py # Playwright stealth headless browser crawler
│ ├── news_provider.py # GNews aggregator fallback
│ └── feed_parser.py # RSS XML feed parsing
│
├── frontend/ # Modern React + Vite + Tailwind CSS Application
│ ├── src/
│ │ ├── components/
│ │ │ ├── Analyzer/ # ArticleReader, ClaimsList, CredibilityGauge,
│ │ │ │ # EchoChamberArena, AnalysisProgressStepper, IngestionBar
│ │ │ ├── Trending/ # TrendingWire, ArticleCard (real-time newsfeed)
│ │ │ └── Navbar.tsx # Broadsheet editorial masthead navigation
│ │ ├── services/api.ts # REST API client
│ │ └── types/api.ts # TypeScript data contracts & XAI interfaces
│ ├── dist/ # Compiled production assets served by FastAPI
│ └── package.json
│
├── data/ # Static indices & Knowledge Bases
│ ├── fever_index.faiss # 384-dimensional FAISS index for semantic retrieval
│ ├── passages.pkl # Reference knowledge passages
│ ├── allsides_ratings.json # AllSides Media Intelligence database (101 outlets)
│
├── scripts/ # Maintenance & Evaluation Utilities
│ └── build_index.py # Offline FAISS index builder
│
├── docs/ # Formal Documentation
│ └── ARCHITECTURE.md # Technical specifications & mathematical models
│
├── main.py # Root entrypoint (forwards to backend.main:app)
├── requirements.txt # Python dependencies
├── .env.example # Environment variables specification
└── README.md # Primary setup guide & walkthrough
2. Core Processing Pipeline
flowchart TD
A["Raw Manuscript / URL"] --> B["Ingestion & Scraping (Playwright Stealth / Requests)"]
B --> C["Sentence Segmentation (spaCy)"]
C --> D["Check-Worthiness Classification (ClaimBuster DeBERTa-v2)"]
D --> E["Multi-Tier Evidence Retrieval (FAISS + Brave Search API + Wikipedia)"]
E --> F["Natural Language Inference (RoBERTa-large-MNLI)"]
F --> G["Explainable AI (XAI) Diagnostics (Semantic Entity / Timeline Diff)"]
B --> H["Political Bias & Framing Analysis (BERT + AllSides)"]
H --> I["Loaded Language & Rhetorical Density Analysis"]
G & F & H & I --> J["Calibrated Credibility Scoring (0 - 100)"]
J --> K["Forensic BroadSheet Dossier & Echo-Chamber Arena"]
3. Mathematical Models & Formulations
3.1 Composite Credibility Score
The credibility score $S \in [0, 100]$ evaluates factual entailment weighted by model confidence and penalizes sensationalist rhetoric:
Where:
- $v_i \in {\text{Supported}, \text{Refuted}, \text{Not Enough Info}}$ is the NLI verdict for claim $i$.
- $\mathbb{I}(\text{Supported}) = 1.0$, $\mathbb{I}(\text{Not Enough Info}) = 0.5$, $\mathbb{I}(\text{Refuted}) = 0.0$.
- $w_i = \text{confidence}_i$ from RoBERTa-large-MNLI softmax probability.
- $D_{\text{loaded}}$ is the percentage density of pejorative/sensationalist lexical markers.
- $\lambda = 0.5$ is the framing discount coefficient.
3.2 Polarization Index (Cross-Perspective Comparison)
The side-by-side Echo-Chamber Deck computes divergence between two articles reporting on the same event using Total Variation Distance (TVD) across stance distributions:
4. Explainable AI (XAI) Diagnostics
The xai_explainer.py engine performs deterministic token-level conflict detection:
- Temporal Consistency: Compares extracted 4-digit timeline years ($Y_{\text{claim}} \neq Y_{\text{evidence}}$).
- Quantitative Scale: Flags order-of-magnitude discrepancies in cited numbers or percentages.
- Polarity Inversion: Detects negation markers (
denied,rejected,false) in the evidence when the claim is affirmative. - Attributive Framing: Identifies pejorative rhetoric introducing unsubstantiated crisis.