YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

SAMSum BART Dialogue Summarization

A fine-tuned BART-large-CNN model for abstractive dialogue summarization on the SAMSum conversational dataset.

The model takes a multi-speaker dialogue as input and generates a concise natural-language summary capturing the main information discussed in the conversation.

πŸš€ Model Overview

Property Details
Task Abstractive Dialogue Summarization
Base Model facebook/bart-large-cnn
Dataset knkarthick/samsum
Architecture BART Encoder–Decoder
Framework PyTorch + Hugging Face Transformers
Language English
Maximum Input Length 512 tokens
Maximum Summary Length 96 tokens
Generation Beam Search
Number of Beams 4

πŸ“Š Evaluation Results

The model was evaluated on the official SAMSum test split containing 819 examples.

Metric Score
ROUGE-1 40.58
ROUGE-2 20.12
ROUGE-L 31.03
ROUGE-Lsum 31.05

Baseline Comparison

The fine-tuned model was compared against the original facebook/bart-large-cnn checkpoint on the same test set.

Metric BART Baseline Fine-tuned Improvement
ROUGE-1 31.03 40.58 +9.55
ROUGE-2 10.36 20.12 +9.76
ROUGE-L 23.34 31.02 +7.67
ROUGE-Lsum 23.34 31.05 +7.71

The results demonstrate a substantial improvement in conversational summarization after fine-tuning, particularly in ROUGE-2.

πŸ—‚οΈ Dataset

The model was fine-tuned on the SAMSum Corpus, a human-annotated dataset of messenger-style conversations and corresponding summaries.

Dataset splits:

  • Train: 14,731
  • Validation: 818
  • Test: 819

The dataset contains English conversations involving multiple speakers and human-written abstractive summaries.

Dataset: knkarthick/samsum

Dataset license: CC BY-NC-ND 4.0 (non-commercial).

βš™οΈ Training Configuration

The model was fine-tuned using the Hugging Face Transformers training framework.

Base Model: facebook/bart-large-cnn

Epochs: 3
Learning Rate: 5e-5
Weight Decay: 0.01
Warmup Steps: 500

Per-device Batch Size: 4
Gradient Accumulation Steps: 4
Effective Batch Size: 16

FP16: Enabled
Gradient Checkpointing: Enabled

Evaluation Strategy: Epoch
Generation During Evaluation: Enabled
Number of Beams: 4

Maximum Source Length: 512
Maximum Target Length: 96

Early Stopping Patience: 2
Best Model Metric: ROUGE-L

Training was performed using a NVIDIA Tesla T4 GPU.

🧠 Generation Configuration

The recommended generation configuration is:

num_beams=4
max_length=96
min_length=8
early_stopping=True
no_repeat_ngram_size=3
length_penalty=1.0

The model also uses explicit BART generation token configuration for reliable standalone inference.

πŸ’» Usage

Install the required packages:

pip install torch transformers sentencepiece safetensors

Load the model directly from Hugging Face:

import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

MODEL_ID = "AbdelrahmanAkl/SAMSum-BART-Dialogue-Summarization"

device = torch.device(
    "cuda" if torch.cuda.is_available() else "cpu"
)

tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)

model = AutoModelForSeq2SeqLM.from_pretrained(
    MODEL_ID
)

model.to(device)
model.eval()

Generate a Summary

dialogue = """
Hannah: Do you have Betty's number?
Amanda: I can't find it. Ask Larry.
Hannah: I don't know Larry.
Amanda: He's very nice.
Hannah: Okay, I'll text him.
"""

inputs = tokenizer(
    dialogue,
    max_length=512,
    truncation=True,
    return_tensors="pt"
)

inputs = {
    key: value.to(device)
    for key, value in inputs.items()
}

with torch.no_grad():
    generated_ids = model.generate(
        **inputs,
        max_length=96,
        min_length=8,
        num_beams=4,
        early_stopping=True,
        no_repeat_ngram_size=3,
        length_penalty=1.0,
    )

summary = tokenizer.decode(
    generated_ids[0],
    skip_special_tokens=True
)

print(summary)

Example output:

Hannah will text Larry about Betty's number.

🎯 Intended Use

This model is intended for:

  • Dialogue summarization
  • Conversational AI research
  • NLP experimentation
  • Meeting/chat summarization prototypes
  • Educational and portfolio projects
  • Text generation research

It can be used as a foundation for applications that need to transform multi-speaker conversations into concise summaries.

⚠️ Limitations

The model has several known limitations.

Over-generation

Qualitative and quantitative analysis showed that generated summaries are often longer than the human reference summaries.

On the test set:

  • Reference mean length: 20.02
  • Prediction mean length: 43.90
  • Mean prediction/reference length ratio: approximately 2.89Γ—
  • Potential over-generation cases: 601 / 819 (73.4%)

This metric should not be interpreted as a hallucination rate. Reference summaries can be highly compressed, so a longer generated summary is not necessarily incorrect.

Attribution and Unsupported Details

Some examples showed occasional:

  • Attribution errors
  • Unsupported details
  • Excessive generation

Therefore, generated summaries should be reviewed when factual precision is important.

Domain Limitation

The model was trained specifically on English conversational data from SAMSum and may not generalize equally well to:

  • Other languages
  • Highly technical conversations
  • Specialized professional domains
  • Long-form meetings
  • Conversations significantly different from the training distribution

πŸ”¬ Qualitative Evaluation

Manual evaluation across representative examples indicated:

  • Content understanding: Strong
  • Compression: Good
  • Fluency: Good to very good
  • Key information preservation: Good
  • Over-generation: Main weakness
  • Attribution errors: Occasional
  • Unsupported details: Occasional

πŸ—οΈ Project Architecture

User Dialogue
      β”‚
      β–Ό
Input Tokenization
      β”‚
      β–Ό
Fine-tuned BART Encoder
      β”‚
      β–Ό
BART Decoder + Beam Search
      β”‚
      β–Ό
Generated Summary

The model is served through a Streamlit application that loads the model directly from this Hugging Face repository.

🌐 Demo & Resources

πŸš€ Live Demo

https://samsum-bart-dialogue-summarization.streamlit.app/

πŸ’» GitHub Repository

https://github.com/AbdelrhmanAkl/SAMSum-BART-Dialogue-Summarization

πŸ€— Hugging Face Model

https://huggingface.co/AbdelrahmanAkl/SAMSum-BART-Dialogue-Summarization

πŸ› οΈ Tech Stack

  • Python
  • PyTorch
  • Hugging Face Transformers
  • Hugging Face Datasets
  • SentencePiece
  • Safetensors
  • Streamlit
  • ROUGE
  • CUDA

πŸ“š References

BART

Lewis et al., BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension.

Base model:

facebook/bart-large-cnn

The original BART checkpoint is distributed under the MIT license.

SAMSum

Gliwa et al., SAMSum Corpus: A Human-annotated Dialogue Dataset for Abstractive Summarization, 2019.

Dataset:

knkarthick/samsum

The dataset is distributed under a non-commercial CC BY-NC-ND 4.0 license.

πŸ‘€ Author

Abdelrahman Akl

AI Engineer | NLP | LLMs | Deep Learning | Computer Vision

GitHub:

https://github.com/AbdelrhmanAkl


Note: This model is a fine-tuned research/portfolio model and should not be considered a production-grade factuality guarantee. Always validate generated summaries in high-stakes applications.

Downloads last month
5
Safetensors
Model size
0.4B params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support