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

Check out the documentation for more information.

BART CNN/DailyMail Text Summarization

A fine-tuned BART-base Transformer model for abstractive text summarization, trained on a curated subset of the CNN/DailyMail 3.0.0 dataset.

The model is designed to transform long-form English articles into concise summaries while preserving the main information of the source text.

Model Details

Property Value
Base Model facebook/bart-base
Architecture BART
Task Abstractive Text Summarization
Language English
Dataset CNN/DailyMail 3.0.0
Parameters 139,420,416
Training Examples 8,000
Validation Examples 1,000
Test Examples 1,000
Maximum Input Length 1024 tokens
Maximum Target Length 128 tokens
Training Epochs 2
Learning Rate 5e-5
Train Batch Size 2
Gradient Accumulation 8
Effective Batch Size 16
Weight Decay 0.01
Random Seed 42

Intended Use

This model is intended for:

  • Abstractive summarization of English articles
  • NLP experimentation and research
  • Educational demonstrations
  • Portfolio and machine learning applications
  • Integration into lightweight summarization applications

The model is particularly suitable for demonstrating an end-to-end Transformer summarization workflow, including fine-tuning, evaluation, model packaging, and deployment.

A live Streamlit application is available for interactive inference:

Live Demo


Training Data

The model was fine-tuned using a controlled subset of the CNN/DailyMail 3.0.0 dataset.

The full dataset contains:

  • 287,113 training examples
  • 13,368 validation examples
  • 11,490 test examples

For this project, the following fixed subset was used:

Split Examples
Train 8,000
Validation 1,000
Test 1,000

The selected data was shuffled using seed 42 for reproducibility.

Input and Target Processing

Articles were tokenized using the BART tokenizer with:

max_input_length = 1024

Reference summaries were tokenized with:

max_target_length = 128

Articles exceeding the maximum input length were truncated.


Training Procedure

The model was fine-tuned using Hugging Face Transformers and Seq2SeqTrainer.

Training Configuration

Base Model: facebook/bart-base
Epochs: 2
Learning Rate: 5e-5
Train Batch Size: 2
Gradient Accumulation Steps: 8
Effective Batch Size: 16
Weight Decay: 0.01
Warmup Steps: 100
FP16: Enabled
Gradient Checkpointing: Enabled
Evaluation Interval: Every 500 steps
Random Seed: 42

The best checkpoint was selected according to validation loss.

Best Checkpoint

checkpoint-1000

Validation loss:

1.757423

The selected checkpoint was independently reloaded and validated before final model packaging.


Generation Configuration

Generation parameters were optimized on the validation set while keeping the test set isolated for final evaluation.

The selected configuration was:

num_beams = 4
length_penalty = 1.0
no_repeat_ngram_size = 3
max_length = 128
early_stopping = True

The no_repeat_ngram_size=3 configuration produced the strongest validation ROUGE-Lsum among the tested generation configurations.


Evaluation

The final model was evaluated on 1,000 held-out CNN/DailyMail test examples.

Fine-tuning Impact

To measure the effect of fine-tuning independently from generation optimization, the original pretrained facebook/bart-base was compared with the original fine-tuned model using the original generation configuration.

Metric Base BART Original Fine-tuned Absolute Change
ROUGE-1 0.392200 0.406423 +0.014223
ROUGE-2 0.176266 0.180911 +0.004645
ROUGE-L 0.245521 0.276005 +0.030484
ROUGE-Lsum 0.319560 0.374562 +0.055002

Generation Optimization Impact

After generation optimization, the final configuration produced:

Metric Original Fine-tuned Final Optimized Absolute Change
ROUGE-1 0.406423 0.407043 +0.000620
ROUGE-2 0.180911 0.181450 +0.000539
ROUGE-L 0.276005 0.276308 +0.000303
ROUGE-Lsum 0.374562 0.374985 +0.000423

Final Test Results

ROUGE-1     0.407043
ROUGE-2     0.181450
ROUGE-L     0.276308
ROUGE-Lsum  0.374985

The final reported metrics use the optimized generation configuration.

ROUGE measures lexical overlap between generated and reference summaries. It should not be interpreted as a direct measure of factual accuracy, hallucination rate, coherence, or overall summary quality.


Example

Input

Artificial intelligence is transforming the way organizations operate across industries. Companies are increasingly adopting machine learning and natural language processing systems to automate repetitive tasks, analyze large volumes of information, and support employees in making faster decisions. In healthcare, AI systems can help doctors analyze medical images and identify patterns that may require further investigation.

Generated Summary

Artificial intelligence is transforming the way organizations operate across industries. Companies are increasingly adopting machine learning and natural language processing systems to automate repetitive tasks, analyze large volumes of information, and support employees in making faster decisions. In healthcare, AI systems can help doctors analyze medical images and identify patterns that may require further investigation.

This example demonstrates inference behavior and is not intended to represent the overall benchmark performance of the model.


Usage

Transformers Pipeline

from transformers import pipeline

summarizer = pipeline(
    "summarization",
    model="AbdelrahmanAkl/bart-cnn-dailymail-summarization"
)

text = """
Artificial intelligence is transforming the way organizations operate
across industries. Companies are increasingly adopting machine learning
and natural language processing systems to automate repetitive tasks,
analyze large volumes of information, and support employees in making
faster decisions.
"""

result = summarizer(
    text,
    max_length=128,
    num_beams=4,
    length_penalty=1.0,
    no_repeat_ngram_size=3,
    early_stopping=True
)

print(result[0]["summary_text"])

Direct Model Loading

from transformers import BartForConditionalGeneration, BartTokenizer

model_id = "AbdelrahmanAkl/bart-cnn-dailymail-summarization"

tokenizer = BartTokenizer.from_pretrained(model_id)
model = BartForConditionalGeneration.from_pretrained(model_id)

inputs = tokenizer(
    text,
    return_tensors="pt",
    max_length=1024,
    truncation=True
)

outputs = model.generate(
    **inputs,
    num_beams=4,
    length_penalty=1.0,
    no_repeat_ngram_size=3,
    max_length=128,
    early_stopping=True
)

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

print(summary)

Deployment

This model is used by an interactive Streamlit application that supports both local and hosted inference.

Deployment Flow

User
  β”‚
  β–Ό
Streamlit Application
  β”‚
  β”œβ”€β”€ Local model available
  β”‚       β”‚
  β”‚       └── Load local model
  β”‚
  └── Otherwise
          β”‚
          β–Ό
   Hugging Face Hub
          β”‚
          β–Ό
   Fine-tuned BART
          β”‚
          β–Ό
   Generated Summary

Live application:

bart-cnn-dailymail-summarization.streamlit.app

Source repository:

GitHub Repository


Limitations

  • The model was fine-tuned on 8,000 examples rather than the full CNN/DailyMail training set.
  • Articles longer than 1024 tokens are truncated.
  • Summaries are limited to a maximum generation length of 128 tokens.
  • ROUGE does not fully measure factual consistency, coherence, or hallucination.
  • The model is primarily evaluated for English summarization.
  • The model may reproduce or omit information from the source depending on article structure and input length.
  • CPU inference can be relatively slow for long inputs.
  • The model has not been evaluated as a production-critical summarization system.

Users should independently verify generated summaries when factual accuracy is important.


Ethical and Safety Considerations

This model is intended for text summarization and should not be treated as a source of independently verified information.

Generated summaries may contain omissions, inaccurate statements, or other generation errors. Human review is recommended for high-stakes applications.

The model should not be used as the sole basis for decisions involving medical, legal, financial, safety-critical, or other high-impact information.


Reproducibility

The project uses:

Random Seed: 42
Base Model: facebook/bart-base
Dataset: CNN/DailyMail 3.0.0
Train Size: 8,000
Validation Size: 1,000
Test Size: 1,000

The complete training workflow and evaluation process are documented in the accompanying GitHub repository.


Project Resources


Citation

If you use this model in a project or demonstration, please reference the model repository:

Abdelrahman Akl.
BART CNN/DailyMail Text Summarization.
Fine-tuned BART-base model for abstractive text summarization.
Hugging Face Model Hub.

License

This model card documents a portfolio and educational machine learning project. Please review the licensing terms of the underlying base model and dataset before redistributing or using the model in other contexts.

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