CoolFace
Apppublic

davideuler/small-model-chatbot

sourceHugging Facemitupdated 1y agoView on Hugging Face
1likes
App README

=======

Multi-Model Tiny Chatbot

A lightweight, multi-model chat application featuring several small language models optimized for different tasks. Built with Gradio for an intuitive web interface and designed for local deployment.

🌟 Features

  • β€”Multiple Model Support: Choose from 4 specialized small language models
  • β€”Lazy Loading: Models are loaded only when selected, optimizing memory usage
  • β€”Real-time Chat Interface: Smooth conversational experience with Gradio
  • β€”Lightweight: All models are under 200M parameters for fast inference
  • β€”Local Deployment: Run entirely on your local machine

πŸ€– Available Models

1. SmolLM2 (135M Parameters)

  • β€”Purpose: General conversation and instruction following
  • β€”Architecture: HuggingFace SmolLM2-135M-Instruct
  • β€”Best For: General Q&A, creative writing, coding help
  • β€”Language: English

2. NanoLM-25M (25M Parameters)

  • β€”Purpose: Ultra-lightweight instruction following
  • β€”Architecture: Mistral-based with chat template support
  • β€”Best For: Quick responses, simple tasks, resource-constrained environments
  • β€”Language: English

3. NanoTranslator-S (9M Parameters)

  • β€”Purpose: English to Chinese translation
  • β€”Architecture: LLaMA-based translation model
  • β€”Best For: Translating English text to Chinese
  • β€”Language: English β†’ Chinese

4. NanoTranslator-XL (78M Parameters)

  • β€”Purpose: Enhanced English to Chinese translation
  • β€”Architecture: LLaMA-based with improved accuracy
  • β€”Best For: High-quality English to Chinese translation
  • β€”Language: English β†’ Chinese

πŸš€ Quick Start

Prerequisites

  • β€”Python 3.8 or higher
  • β€”4GB+ RAM recommended
  • β€”Internet connection for initial model downloads

Installation

  1. 1.Run the application
bash
   uv run app.py
  1. 1.Open your browser
  2. 2.Navigate to http://localhost:7860
  3. 3.Select a model and start chatting!

🎯 Use Cases

General Conversation

  • β€”Use SmolLM2 or NanoLM-25M for general chat, Q&A, and assistance

Translation Tasks

  • β€”Use NanoTranslator-S for quick Englishβ†’Chinese translations
  • β€”Use NanoTranslator-XL for higher quality Englishβ†’Chinese translations

Resource-Constrained Environments

  • β€”NanoLM-25M (25M params) for ultra-lightweight deployment
  • β€”NanoTranslator-S (9M params) for minimal translation needs

πŸ’‘ Model Performance

ModelParametersUse CaseMemory UsageSpeed
SmolLM2135MGeneral Chat~500MBFast
NanoLM-25M25MLightweight Chat~100MBVery Fast
NanoTranslator-S9MQuick Translation~50MBVery Fast
NanoTranslator-XL78MQuality Translation~300MBFast

Model Sources

  • β€”SmolLM2: HuggingFaceTB/SmolLM2-135M-Instruct
  • β€”NanoLM-25M: Mxode/NanoLM-25M-Instruct-v1.1
  • β€”NanoTranslator-S: Mxode/NanoTranslator-S
  • β€”NanoTranslator-XL: Mxode/NanoTranslator-XL

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • β€”HuggingFace for the Transformers library and model hosting
  • β€”Mxode for the Nano series models
  • β€”Gradio for the amazing web interface framework