Graduate Project  ·  CS 7641 Machine Learning  ·  Georgia Tech  ·  Aug – Dec 2025
NLP / Transformers Supervised Learning Unsupervised Learning Contrastive Learning Data Analysis Project Leadership

Political Bias
Detection in News

A multi-method ML study combining supervised classifiers, unsupervised clustering, and novel contrastive learning approaches to detect ideological framing in news articles — achieving 90% weighted F1 with SetFit.

01 — Project Overview

Detecting What Isn't Obvious

News media shape public understanding of politics, but bias often operates through subtle mechanisms — framing, selective coverage, and source attribution — rather than overt partisanship. This project asked: can we detect ideological bias beyond surface-level vocabulary?

Working as a 4-person team in Georgia Tech's CS 7641 Machine Learning course, we applied supervised classification, unsupervised clustering, and two novel contrastive learning methods (SimCSE and SetFit) to a corpus of 6,000+ politically-labelled news articles across five bias categories: Left, Lean Left, Center, Lean Right, and Right.

Project Coordinator

Managed team, coordinated deliverables across supervised and unsupervised tracks, and led Agile task planning and milestone reviews throughout the semester.

Agile Planning Task Delegation Milestone Tracking

Data Analysis & Visualisation

Led comparative analysis across all methods including bias distribution analysis, confusion matrix interpretation, ROC curve generation, and the clustering evaluation heatmap — translating model outputs into clear research narrative.

Metric Design Visualisation Result Interpretation

Report & Communication

Authored key sections of the project report including the comparative model analysis, next steps, and the SetFit vs. SimCSE comparison — ensuring technical findings were communicated accessibly.

Technical Writing Narrative Framing Stakeholder Clarity

02 — Development Process

Research Pipeline

Select any step to expand details — including decisions made, my specific contributions, and key tradeoffs.

Step 01 — Problem Scoping & Planning
Defining the Research Objectives & Team Structure

As project lead, I structured the semester-long project into parallel workstreams and facilitated early alignment on what we were trying to build and measure.

  • Framed the core research problem: move beyond surface-level lexical bias signals toward models that capture framing and ideological tone
  • Divided work into four parallel tracks — data preprocessing, unsupervised clustering, supervised classification, and novelty methods — assigning clear ownership
  • Established shared evaluation criteria: weighted F1, macro F1, confusion matrices, and ROC-AUC curves for consistency across all methods
  • Set up Agile milestone reviews at the midpoint and near final submission to catch blockers early and align on comparative narrative
Agile PlanningScope DefinitionTeam Leadership
Step 02 — Data Sourcing & Preprocessing
Building a Clean, Balanced Multi-Source Corpus

We combined four datasets to ensure robustness and coverage: AllSides (Kaggle), BASIL, GDELT, and Media Bias Fact Check (MBFC). My contribution was designing the preprocessing quality checklist and leading the analysis visualisations at each stage.

  • Loaded the AllSides dataset (8,112 articles), mapped 5 categorical bias labels to integer classes (0–4), and visualised distribution imbalance — identifying an over-representation of highly conservative articles early
  • Filtered short texts (under 50 characters), reducing the dataset to 6,209 usable articles — a deliberate tradeoff between quantity and signal quality
  • Applied a full cleaning pipeline: encoding fixes via ftfy, tokenisation and lemmatisation via spaCy's en_core_web_sm, lowercase normalisation, and punctuation removal
  • Produced and reviewed the four early distribution figures (text length histogram, bias category spread, source spread, and per-source content type) — these informed all subsequent modelling decisions
  • Generated TF-IDF features (5,000 features, unigrams + bigrams) and 384-dim Sentence Transformer embeddings (all-MiniLM-L6-v2) as dual feature representations
spaCyTF-IDFSentence TransformersData QA
Step 03 — Unsupervised Clustering
Exploring Latent Structure in Political Text

Before applying supervision, we asked whether ideological structure exists naturally in the embedding space. I led the multi-algorithm evaluation and produced the comparative metrics heatmap.

  • Applied PCA to reduce 384-dim embeddings to 50 components (91% variance retained) for clustering, and to 2 components for visualisation
  • Tested 9 clustering approaches: K-Means, Mini-Batch K-Means, GMM, Bayesian GMM, DBSCAN, HDBSCAN, OPTICS, Mean Shift, Agglomerative, Birch, and Spectral Clustering
  • Evaluated each method on 7 metrics: Silhouette Score, Calinski-Harabasz, Davies-Bouldin, ARI, NMI, Homogeneity, and V-Measure — producing the comparative normalised heatmap that ranked methods cleanly
  • DBSCAN, HDBSCAN, and Mean Shift emerged as the strongest performers on density-based metrics; Agglomerative, GMM, and Birch were weakest
  • Key insight: no clustering method produced clean ideological separation — confirming that bias categories rely on subtle supervised signals rather than naturally separable geometry
K-MeansDBSCAN / HDBSCANSpectral ClusteringPCAEvaluation Heatmap
Step 04 — Supervised Classification
MLP Baseline, Gaussian NB, and Fine-Tuned RoBERTa

Three supervised methods were implemented across increasing representational complexity. I designed the comparative framework and led the error analysis.

  • Gaussian Naïve Bayes: Used Sentence-BERT embeddings + PCA. Weighted F1: 0.45 — poor fit for sparse, high-dimensional text; established the floor
  • MLP + TF-IDF: Two hidden layers (256, 128), ReLU activation, Adam optimiser, early stopping. Weighted F1: 0.899, Macro F1: 0.873 — strongest traditional model; TF-IDF captured overt partisan vocabulary effectively
  • Fine-tuned RoBERTa: 12-layer roberta-base with a classification head (dropout + linear projection), fine-tuned on 80/10/10 split. Weighted F1: 0.824 — contextual embeddings helped with nuanced framing but struggled with fine-grained adjacent categories (lean right over-predicted, right class underperformed)
  • Designed and produced all confusion matrices and per-class performance tables, revealing systematic confusion among ideologically adjacent classes and informing next-step recommendations
MLP / TF-IDFRoBERTaConfusion MatrixROC-AUCError Analysis
Step 05 — Novel Methods: SimCSE & SetFit
Contrastive Learning for Political Bias

The novelty contribution of the project was applying two contrastive learning frameworks to political bias detection. I co-led the SetFit implementation and authored the comparative analysis between the two approaches.

  • SimCSE (unsupervised): Built a 300k+ sentence political corpus from CC-News, AG News, and GDELT; trained RoBERTa-base using dropout-augmented positive pairs and NT-Xent loss (τ=0.05); evaluated as frozen embeddings + logistic regression (weighted F1: 0.79) and fine-tuned (weighted F1: 0.84)
  • SetFit (few-shot supervised): Used all-mpnet-base-v2 backbone; generated N² contrastive pairs from N labelled examples, dramatically amplifying supervision density; two-stage training (contrastive embedding shaping → frozen classifier). Weighted F1: 0.901, Macro F1: 0.873 — best result across all methods
  • Authored the analysis explaining why SetFit outperforms SimCSE: supervised contrastive signal, task-aligned representation sculpting, stronger backbone, and dense supervision from limited labels
  • Documented key caveats: SetFit amplifies label noise, and "lean" categories remain semantically ambiguous requiring future hierarchical or multi-task approaches
SimCSESetFitContrastive LearningFew-Shot LearningNT-Xent Loss
Step 06 — Synthesis & Reporting
Comparative Analysis & Next Steps

The final phase synthesised results across all methods into a unified narrative and identified concrete improvement directions. I led this analysis and produced the comparative model table.

  • Constructed the full model comparison table (Gaussian NB at 0.45 → Fine-tuned RoBERTa at 0.82 → MLP+TF-IDF at 0.90 → SetFit at 0.90), framing performance progression in terms of representational complexity
  • Key conclusion: supervised models outperform clustering by learning discriminative patterns — bias categories rely on subtle linguistic cues that require supervision to model effectively
  • Identified three concrete next steps: class-balanced sampling to address minority class underperformance, larger RoBERTa variants for nuanced category distinction, and multi-label classification to capture mixed ideological content
  • Managed final report assembly and quality review across all team sections before submission
Comparative AnalysisReport WritingTechnical Communication

03 — Key Results

What the Models Revealed

Select a method to explore the findings. Performance improved consistently as representational power and supervision increased.

9
clustering algorithms tested — K-Means through Spectral Clustering
Top 3
DBSCAN, HDBSCAN, and Mean Shift — strongest on density-based metrics
Weak
No method cleanly separated all 5 bias classes — overlap was pervasive
7
evaluation metrics per algorithm — silhouette, ARI, NMI, and more

PCA reduced 384-dim embeddings to 50 components (91% variance) for clustering and 2 components for 2D visualisation. All nine methods showed overlapping clusters, indicating that the political bias categories are not naturally separable in the embedding geometry.

Key Insight: The clustering experiments confirmed a critical finding: ideological bias does not organise itself into clearly separable geometric clusters. This directly motivated the supervised approach — bias detection fundamentally requires learning discriminative patterns from labelled data, not just finding natural groupings.

0.45
Gaussian NB weighted F1 — floor; independence assumptions fail on text
0.82
Fine-tuned RoBERTa weighted F1 — contextual but constrained by dataset size
0.90
MLP + TF-IDF weighted F1 — strongest traditional method; 0.93 F1 on extreme classes
0.79
Lean Left F1 (MLP) — weakest class; ideologically adjacent confusion

The MLP with TF-IDF outperformed fine-tuned RoBERTa despite being architecturally simpler. TF-IDF's 5,000-feature vocabulary successfully captured overt partisan vocabulary differences, while RoBERTa's contextual power was constrained by the limited fine-tuning dataset size.

Key Insight: Extreme categories (Left and Right) were easiest to classify — F1 of 0.93 each. Centrist and "lean" categories caused the most confusion, reflecting genuine semantic proximity between ideologically adjacent positions. This pattern appeared across all supervised methods and directly motivated the contrastive approaches.

300k+
Political sentences in the training corpus (CC-News, AG News, GDELT)
0.79
Weighted F1 — SimCSE frozen embeddings + logistic regression
0.84
Weighted F1 — SimCSE + fine-tuned classification head (+5% improvement)
0.05
NT-Xent temperature — encourages alignment and uniformity in embedding space

SimCSE used dropout noise as augmentation — each sentence produced two slightly different representations via different dropout masks, forming positive contrastive pairs without labels. Trained on 300k+ political sentences, this unsupervised approach created a semantically rich foundation for bias classification.

Key Insight: SimCSE demonstrated that unsupervised contrastive pre-training on domain-specific political text produces useful representations for downstream classification. However, it learns broad semantics rather than class-discriminative signals — task-specific fine-tuning adds meaningful lift (+5%), but supervised contrastive pairing (as in SetFit) yields even greater gains.

0.901
Weighted F1 — best result across all methods
0.873
Macro F1 — strong balanced performance across all 5 classes
Contrastive pairs generated from N labelled samples — high supervision density
2-stage
Contrastive embedding shaping, then frozen classification head — prevents catastrophic forgetting

SetFit (all-mpnet-base-v2 backbone) amplified supervision by generating N² contrastive pairs from N labelled examples. Stage 1 shaped the embedding space around bias labels using pair-based contrastive loss; Stage 2 froze the encoder and trained a lightweight classifier on the learned representations.

Key Insight: SetFit's performance advantage over SimCSE comes from four compounding factors: supervised contrastive signal directly aligned to bias labels, task-specific representation sculpting, a stronger sentence encoder backbone, and dense supervision with few labels. The two-stage design also prevents the catastrophic forgetting that plagues standard fine-tuning on small datasets.

Placing all methods side-by-side shows a clear performance progression from simple statistical models to contrastive transformers. The pattern reflects increasing representational power — but also the importance of matching model architecture to dataset characteristics.

0.45
Gaussian NB — floor; independence assumptions fail on dense text embeddings
0.82
Fine-tuned RoBERTa — contextual but constrained by small fine-tuning set
0.90
MLP + TF-IDF — strong lexical baseline; matched SetFit on weighted F1
0.90
SetFit — best Macro F1 (0.873); superior on centrist and adjacent classes

Overall Conclusion: Supervised models consistently outperformed unsupervised clustering by learning discriminative patterns from labelled data. The highest macro F1 came from SetFit, confirming that label-efficient contrastive learning outperforms both simple lexical features and standard transformer fine-tuning when labelled data is limited. MLP + TF-IDF remains a strong, computationally cheap alternative when computational resources are constrained.

04 — Skills Demonstrated

What This Project Highlights

This project required end-to-end ownership across leadership, technical ML, data analysis, and communication — across a semester-long team environment.

Project Leadership & Management

  • Led a 4-person team across 6 months of parallel ML workstreams
  • Structured Agile milestone reviews and maintained delivery cadence
  • Coordinated report assembly and cross-section quality review
  • Managed tradeoff decisions on model selection and dataset scope
  • Delegated and tracked ownership across supervised and unsupervised tracks

Data Analysis & Visualisation

  • Produced all bias distribution and data quality figures at preprocessing stage
  • Designed the 9-method clustering evaluation heatmap for cross-algorithm comparison
  • Generated and interpreted all confusion matrices and per-class performance tables
  • Produced one-vs-rest AUROC curves across all supervised and novel methods
  • Translated visualisation findings into actionable model improvement decisions

ML Research & Analysis

  • Implemented and evaluated MLP + TF-IDF baseline (weighted F1: 0.90)
  • Co-designed SetFit implementation and authored comparative rationale
  • Conducted error analysis identifying systematic confusion in adjacent ideological classes
  • Framed next steps: class-balanced sampling, larger models, multi-label extension
  • Wrote the unified cross-method performance comparison narrative

Key Takeaways

Bias is subtle — and requires supervised learning to detect reliably

No unsupervised method produced clean ideological clusters. Bias categories rely on linguistic cues that only become discriminable under supervision. This is a practically important finding for any system trying to automate media analysis.

Simpler models can match complex ones when features are well-chosen

MLP + TF-IDF matched SetFit on weighted F1 despite being architecturally far simpler. The right feature representation — lexical in this case — can close the gap to transformer-scale models at a fraction of the compute cost.

Label efficiency matters more than model scale in constrained settings

SetFit's N² pair amplification achieved the best macro F1 without needing large labelled datasets. For real-world political bias detection, where labelling is expensive and subjective, label-efficient methods are not just practical — they are essential.

Visualisation is an analytical tool, not just a presentation layer

The clustering heatmap, confusion matrices, and AUROC curves weren't generated after decisions were made — they drove them. Producing clear, comparable visualisations at each stage was central to how the team navigated method selection and identified failure modes.