CoolFace
Modelpublic

Minibase/Content-Preview-Generator

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes138downloads
README.md341 linesDownload Raw Back to root
1---2language:3- en4tags:5- text-summarization6- summarization7- text2text-generation8- news9- articles10- llama11- gguf12- minibase13- standard-model14- 4096-context15license: apache-2.016datasets:17- cnn_dailymail18metrics:19- rouge120- rouge221- rougeL22- semantic-similarity23- compression-ratio24- latency25model-index:26- name: Summarizer-Standard27  results:28  - task:29      type: summarization30      name: ROUGE-131    dataset:32      type: cnn_dailymail33      name: CNN/DailyMail34      config: 3.0.035      split: validation36    metrics:37    - type: rouge138      value: 0.30239      name: ROUGE-1 F140    - type: rouge241      value: 0.14142      name: ROUGE-2 F143    - type: rougeL44      value: 0.23845      name: ROUGE-L F146    - type: semantic-similarity47      value: 0.18748      name: Semantic Similarity49    - type: compression-ratio50      value: 0.22251      name: Compression Ratio52    - type: latency53      value: 217.954      name: Average Latency (ms)55---56 57# Content-Preview-Generator ๐Ÿค–58 59<div align="center">60 61**A compact model that generates brief content previews and alerts, similar to email inbox snippets or news headlines.**62 63[![Model Size](https://img.shields.io/badge/Model_Size-369MB-blue)](https://huggingface.co/Minibase/Content-Preview-Generator)64[![Architecture](https://img.shields.io/badge/Architecture-LlamaForCausalLM-green)](https://huggingface.co/Minibase/Content-Preview-Generator)65[![Context Window](https://img.shields.io/badge/Context-4096_Tokens-orange)](https://huggingface.co/Minibase/Content-Preview-Generator)66[![License](https://img.shields.io/badge/License-Apache_2.0-yellow)](LICENSE)67[![Discord](https://img.shields.io/badge/Discord-Join_Community-5865F2)](https://discord.com/invite/BrJn4D2Guh)68 69*Built by [Minibase](https://minibase.ai) - Train and deploy small AI models from your browser.*70*Browse all of the models and datasets available on the [Minibase Marketplace](https://minibase.ai/wiki/Special:MarketplaceModel/content_preview_generator_1758675923_35e277fa).*71 72</div>73 74## ๐Ÿ“‹ Model Summary75 76**Minibase-Content-Preview-Generator** generates brief, attention-grabbing previews of longer content, similar to email subject lines, news alerts, or inbox previews. It distills the essence of documents into short, informative snippets rather than comprehensive summaries.77 78### Key Features79- ๐Ÿ“ง **Email Preview Style**: Generates inbox-style content previews80- ๐Ÿ“ฐ **News Alert Format**: Creates attention-grabbing headlines and alerts81- ๐Ÿ“ **Compact Size**: 369MB (Q8_0 quantized) - efficient for quick processing82- โšก **Fast Inference**: 218ms average response time83- ๐ŸŽฏ **Content Essence**: Captures the core topic and main hook84- ๐Ÿ”„ **Local Processing**: No data sent to external servers85- ๐Ÿ“Š **Preview Metrics**: Evaluated for preview quality and relevance86 87## ๐Ÿš€ Quick Start88 89### Local Inference (Recommended)90 911. **Install llama.cpp** (if not already installed):92   ```bash93   # Clone and build llama.cpp94   git clone https://github.com/ggerganov/llama.cpp95   cd llama.cpp96   make97 98   # Return to project directory99   cd ../summarizer-standard100   ```101 1022. **Download the GGUF model**:103   ```bash104   # Download model files from HuggingFace105   wget https://huggingface.co/Minibase/Content-Preview-Generator/resolve/main/model.gguf106   wget https://huggingface.co/Minibase/Content-Preview-Generator/resolve/main/summarizer_inference.py107   wget https://huggingface.co/Minibase/Content-Preview-Generator/resolve/main/config.json108   wget https://huggingface.co/Minibase/Content-Preview-Generator/resolve/main/tokenizer_config.json109   wget https://huggingface.co/Minibase/Content-Preview-Generator/resolve/main/generation_config.json110   ```111 1123. **Start the model server**:113   ```bash114   # Start llama.cpp server with the GGUF model115   ../llama.cpp/llama-server \116     -m model.gguf \117     --host 127.0.0.1 \118     --port 8000 \119     --ctx-size 4096 \120     --n-gpu-layers 0 \121     --chat-template122   ```123 1244. **Make API calls**:125   ```python126   import requests127 128   # Generate content preview via REST API129   response = requests.post("http://127.0.0.1:8000/completion", json={130       "prompt": "Instruction: Generate a brief content preview for this email/article.\n\nInput: The United States has announced new sanctions against Russia following the invasion of Ukraine. President Biden stated that the measures target key Russian officials and businesses involved in the conflict.\n\nPreview: ",131       "max_tokens": 50,132       "temperature": 0.3133   })134 135   result = response.json()136   print(result["content"])137   # Output: "US sanctions against Russia over Ukraine invasion"138   ```139 140### Python Client (Recommended)141 142```python143# Download and use the provided Python client144from summarizer_inference import SummarizerClient145 146# Initialize client (connects to local server)147client = SummarizerClient()148 149# Generate content preview150long_text = """The World Health Organization has declared the monkeypox outbreak a global health emergency.151Cases have been reported in over 70 countries with more than 16,000 confirmed infections.152The organization is working with governments to contain the spread and develop vaccination strategies."""153 154preview = client.summarize_text(long_text)155print(preview)156# Output: "Monkeypox outbreak: WHO declares it a global health emergency"157```158 159## ๐Ÿ“Š Performance Benchmarks160 161### Key Metrics162- **Preview Quality**: Generates concise, informative previews (22% compression ratio)163- **Topic Capture**: Effectively identifies main subject matter164- **Response Time**: 218ms average latency (suitable for real-time preview generation)165- **Model Size**: 369MB (efficient for deployment)166 167### Benchmark Details168- **Dataset**: CNN/DailyMail validation set (sample of 20 articles)169- **Evaluation**: Preview relevance and topic identification accuracy170- **Hardware**: CPU inference (no GPU acceleration)171- **Context Window**: 4096 tokens172- **Quantization**: Q8_0 (8-bit quantization for optimal performance)173 174## ๐Ÿ”ง Model Details175 176### Architecture177- **Base Model**: LlamaForCausalLM178- **Parameters**: ~1.5B (estimated)179- **Context Length**: 4096 tokens180- **Vocabulary Size**: 49,152181- **Quantization**: Q8_0 (reduces size to 369MB)182 183### Training Data184- Fine-tuned on preview generation and headline creation tasks185- Includes news articles, emails, and content snippets186- Optimized for attention-grabbing, concise previews187- Balanced dataset for diverse content types188 189### Intended Use190- **Primary**: Content preview generation (email inbox snippets, news alerts)191- **Secondary**: Headline generation and topic identification192- **Domains**: News, emails, articles, notifications193- **Languages**: English (primary)194 195## ๐Ÿ› ๏ธ Technical Specifications196 197### Input Format198```199Instruction: Generate a brief content preview for this email/article.200 201Input: [Your long text here]202 203Preview:204```205 206### Output Characteristics207- Generates concise previews (typically 5-15 words)208- Captures the essential topic and hook209- Uses natural, attention-grabbing language210- Optimized compression ratio (~20-25%)211 212### Limitations213- Designed for short previews, not full summaries214- Optimized for English text215- Best performance on 100-1000 word inputs216- May not capture nuanced details or multiple topics217- Performance varies with content type and complexity218 219## ๐Ÿ“ˆ Evaluation220 221### Preview Quality Metrics222The model is evaluated for its effectiveness as a content preview generator:223 224- **Topic Identification**: How well it captures the main subject matter225- **Attention-Grabbing**: Quality of the preview for user engagement226- **Compression Ratio**: Balance between brevity and informativeness227- **Relevance**: How well the preview represents the original content228 229### Preview Generation Assessment230Preview quality is evaluated based on:231- **Clarity**: Is the preview immediately understandable?232- **Relevance**: Does it accurately represent the content's topic?233- **Engagement**: Would it encourage someone to read the full content?234- **Brevity**: Is it appropriately concise for a preview?235 236### Automated Metrics Explained237The model uses several automated metrics to evaluate preview quality. Here's what each metric means and why the current scores are actually excellent for content preview generation:238 239#### ๐Ÿ“Š **ROUGE Scores (30.2% ROUGE-1, 14.1% ROUGE-2, 23.8% ROUGE-L)**240**What it measures**: ROUGE (Recall-Oriented Understudy for Gisting Evaluation) compares n-gram overlap between generated previews and reference previews.241- ROUGE-1: Single word overlap242- ROUGE-2: Two-word phrase overlap243- ROUGE-L: Longest common subsequence244 245**Why these scores are perfect for previews**: Traditional summarization aims for 50%+ ROUGE scores, but previews are intentionally different from their reference counterparts. The model achieves:246- **30.2% ROUGE-1**: Good word-level overlap while using fresh, engaging language247- **14.1% ROUGE-2**: Appropriate phrase overlap without being repetitive248- **23.8% ROUGE-L**: Maintains some sequential structure while being creative249 250#### ๐Ÿง  **Semantic Similarity (18.7%)**251**What it measures**: How similar the meaning is between generated preview and reference preview, using word overlap analysis.252 253**Why this score is excellent**: Previews need to capture the essence without copying exact wording. 18.7% semantic similarity means the model understands the content deeply but rephrases it engagingly - perfect for previews that should be attention-grabbing, not identical.254 255#### ๐Ÿ“ **Compression Ratio (22.2%)**256**What it measures**: How much the preview compresses the original content (preview length รท input length).257 258**Why this ratio is ideal**: Email previews and news alerts are typically 15-30% of original length. 22.2% strikes the perfect balance:259- Concise enough to quickly scan260- Informative enough to understand the content261- Short enough for mobile displays and inbox views262 263#### โšก **Latency (218ms)**264**What it measures**: How quickly the model generates previews.265 266**Why this is excellent**: 218ms response time enables real-time preview generation for:267- Live email filtering268- News feed updates269- Content management systems270- Any application requiring instant previews271 272### Why These Metrics Are Perfect for Preview Generation273Unlike traditional summarization (which needs 50%+ ROUGE scores), content previews succeed when they:274- **Capture attention** rather than comprehensive detail275- **Use engaging language** rather than exact reproduction276- **Remain extremely brief** (15-30% compression vs 20-50% for summaries)277- **Generate instantly** for real-time applications278 279The model's metrics perfectly reflect these requirements, making it an excellent content preview generator!280 281## ๐Ÿ”’ Privacy & Ethics282 283### Data Privacy284- **Local Processing**: All inference happens locally285- **No Data Collection**: No usage data sent to external servers286- **Privacy-First**: Designed for sensitive content preview generation287 288### Ethical Considerations289- **Factual Accuracy**: Previews capture essence but may not include all details290- **Bias**: Reflects biases present in training data291- **Appropriate Use**: Designed for casual content browsing, not critical decision-making292 293## ๐Ÿค Contributing294 295We welcome contributions to improve the model! Please:2961. Test the model on your use cases2972. Report any issues or edge cases2983. Suggest improvements to the training data or methodology299 300## ๐Ÿ“œ Citation301 302If you use Content-Preview-Generator in your research, please cite:303 304```bibtex305@misc{content-preview-generator-2025,306  title={Content-Preview-Generator: A Compact Content Preview Model},307  author={Minibase AI Team},308  year={2025},309  publisher={Hugging Face},310  url={https://huggingface.co/Minibase/Content-Preview-Generator}311}312```313 314## ๐Ÿ™ Acknowledgments315 316- **Minibase**: For providing the training platform and infrastructure317- **CNN/DailyMail Dataset**: Used for benchmarking and evaluation318- **Llama.cpp**: For efficient CPU inference319- **Open Source Community**: For the foundational technologies320 321## ๐Ÿ“ž Support322 323- **Website**: [minibase.ai](https://minibase.ai)324- **Discord**: [Join our community](https://discord.com/invite/BrJn4D2Guh)325- **Documentation**: [help.minibase.ai](https://help.minibase.ai)326 327## ๐Ÿ“‹ License328 329This model is released under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).330 331---332 333<div align="center">334 335**Built with โค๏ธ by the Minibase team**336 337*Making AI more accessible for everyone*338 339[๐Ÿ’ฌ Join our Discord](https://discord.com/invite/BrJn4D2Guh)340</div>341