CoolFace
Apppublic

argyrotsipi/ParliaBench

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes
App README

๐Ÿ›๏ธ ParliaBench โ€” UK Parliamentary Speech Generation

Interactive inference demo for ParliaBench, a benchmark framework for evaluating LLM-generated UK parliamentary speeches.

Paper: ParliaBench: An Evaluation and Benchmarking Framework for LLM-Generated Parliamentary Speech Authors: Marios Koniaris, Argyro Tsipi, Panayiotis Tsanakas ยท NTUA arXiv: 2511.08247


What This Space Does

  1. 1.Generate synthetic parliamentary speeches conditioned on party, EuroVoc topic, parliamentary section, house, and political orientation
  2. 2.Inspect the exact prompt sent to each model (chat template tokens included)
  3. 3.Browse curated samples โ€” synthetic vs real ParlaMint-GB speeches side by side
  4. 4.Tune generation parameters (temperature, top-p, repetition penalty)

Models

Five LLMs fine-tuned on ParlaMint-GB via QLoRA (Unsloth framework):

Display nameBase model (Unsloth 4-bit)Fine-tuned repo
Mistral-7Bunsloth/mistral-7b-v0.3-bnb-4bit`argyrotsipi/parliabench-unsloth-mistral-7b-v0.3`
Llama-3.1-8Bunsloth/Meta-Llama-3.1-8B-bnb-4bit`argyrotsipi/parliabench-unsloth-llama-3.1-8b`
Gemma-2-9Bunsloth/gemma-2-9b-bnb-4bit`argyrotsipi/parliabench-unsloth-gemma-2-9b`
Qwen2-7Bunsloth/Qwen2-7B-bnb-4bit`argyrotsipi/parliabench-unsloth-qwen-2-7b`
Yi-1.5-6Bunsloth/Yi-1.5-6B-bnb-4bit`argyrotsipi/parliabench-unsloth-yi-1.5-6b`

Baseline (non-fine-tuned) versions are also selectable for direct comparison.


Datasets

RepoContents
`argyrotsipi/train-dataset`ParlaMint-GB training split (preprocessed)
`argyrotsipi/generated-dataset`27 560 generated speeches + evaluation results

LoRA Training Configuration

ParameterValue
LoRA rank (r)16
LoRA alpha16
Target modulesq, k, v, o, gate, up, down projections
Dropout0
Batch size64
Learning rate2e-4
OptimizerAdamW fused
Max steps11 194 (~2 epochs)
Warmup steps336
Max seq length1 024
FrameworkUnsloth + SFTTrainer (TRL)

Prompt Structure

System prompt (generation):

You are a seasoned UK parliamentary member. Generate a coherent speech of
{min_words}-{max_words} words in standard English (no Unicode artifacts, no special characters).
Use proper British parliamentary language appropriate for the specified House.
The speech should reflect the political orientation and typical positions of the
specified party on the given topic.

Context string (pipe-separated, matches generation code exactly):

EUROVOC TOPIC: {topic} | SECTION: {section} | PARTY: {party} | POLITICAL ORIENTATION: {orientation} | HOUSE: {house}

Each model wraps these in its own chat template (Mistral [INST], Llama header tokens, Gemma <start_of_turn>, Qwen/Yi ChatML).


Generation Parameters (thesis defaults)

ParameterValueNotes
Temperature0.7Balances coherence and diversity
Top-p0.85Nucleus sampling
Repetition penalty1.2Penalises redundant phrasing
Max new tokens8501.33 ร— P90 speech length
Min words (P10)43Lower quality threshold
Max words (P90)635Upper quality threshold
Batch size32Used in full generation runs

Evaluation Framework

27 560 speeches evaluated across three dimensions:

Linguistic Quality

Perplexity ยท Self-BLEU ยท Distinct-n ยท GRUEN Score ยท BERTScore ยท MoverScore

Semantic Coherence

LLM-as-a-Judge (coherence, conciseness, relevance) via FlowJudge-v0.1 (3.8B)

Political Authenticity โ† novel metrics

  • โ€”Political Spectrum Alignment (PSA) โ€” embedding cosine similarity to spectrum axis
  • โ€”Party Alignment โ€” cosine similarity to real party speech embeddings
  • โ€”LLM-as-a-Judge (authenticity, political appropriateness, overall quality)

Statistical analysis: paired t-tests, independent t-tests, one-way ANOVA, Bonferroni correction.


Space File Structure

argyrotsipi/ParliaBench/
โ”œโ”€โ”€ app.py               # Gradio UI + inference pipeline
โ”œโ”€โ”€ utils.py             # Party data, topic lists, validator (from SpeechValidator)
โ”œโ”€โ”€ prompt_templates.py  # Model-specific chat templates (exact from speech_generator.py)
โ”œโ”€โ”€ sample_data.json     # 7 curated demo speeches
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

Training code โ†’ GitHub Datasets โ†’ `argyrotsipi/train-dataset` ยท `argyrotsipi/generated-dataset`


Citation

bibtex
@article{koniaris2025parliabench,
  title   = {ParliaBench: An Evaluation and Benchmarking Framework for
             LLM-Generated Parliamentary Speech},
  author  = {Koniaris, Marios and Tsipi, Argyro and Tsanakas, Panayiotis},
  journal = {arXiv preprint arXiv:2511.08247},
  year    = {2025},
  url     = {https://arxiv.org/abs/2511.08247}
}