Introduction to Pretrained Models Beginner
Pretrained models are AI models that have already been trained on large datasets and can be reused for new tasks. Instead of training a model from scratch (which requires massive data and compute), you can leverage existing models and adapt them to your specific needs.
What Are Pretrained Models?
A pretrained model is a neural network that has been trained on a large dataset to learn general features and patterns. These learned representations can then be applied to new, related tasks — a technique called transfer learning.
Transfer Learning
Transfer learning is the practice of taking a model trained on one task and reusing it (with or without modification) for a different task:
-
Feature Extraction
Use the pretrained model as a fixed feature extractor. Feed your data through the model and use its outputs as inputs to a simpler classifier. No retraining of the pretrained model is needed.
-
Fine-tuning
Start with the pretrained weights and continue training on your specific dataset. The model adapts its learned features to your task while retaining general knowledge.
-
Zero-shot / Few-shot
Modern large models can perform tasks they were never explicitly trained on, using natural language instructions or just a few examples.
Why Use Pretrained Models?
| Benefit | Details |
|---|---|
| Save time | Skip weeks or months of training. Use a model that is ready in minutes. |
| Less data needed | Fine-tune with hundreds of samples instead of millions. |
| Better performance | Pretrained models learn rich features from massive datasets that small custom models cannot match. |
| Lower cost | No need for expensive GPU clusters to train from scratch. |
| State-of-the-art | Access the same models used by top research labs and companies. |
Types of Pretrained Models
| Type | Tasks | Example Models |
|---|---|---|
| Vision | Image classification, object detection, segmentation, generation | ResNet, YOLO, SAM, Stable Diffusion |
| Language | Text generation, classification, translation, summarization, embeddings | GPT-2, Llama, BERT, T5, sentence-transformers |
| Audio | Speech-to-text, text-to-speech, music generation, audio classification | Whisper, Bark, MusicGen, wav2vec |
| Multi-Modal | Image+text understanding, text-to-image, video, document AI | CLIP, LLaVA, DALL-E, LayoutLM |
Where to Find Pretrained Models
| Platform | Models Available | URL |
|---|---|---|
| Hugging Face Hub | 900,000+ | huggingface.co/models |
| TensorFlow Hub | 1,000+ | tfhub.dev |
| PyTorch Hub | 100+ | pytorch.org/hub |
| Kaggle Models | 3,000+ | kaggle.com/models |
| ONNX Model Zoo | 100+ | github.com/onnx/models |
Model Formats
| Format | Framework | Use Case |
|---|---|---|
| PyTorch (.pt, .pth) | PyTorch | Most common in research |
| SafeTensors (.safetensors) | Framework-agnostic | Safe, fast loading (Hugging Face standard) |
| ONNX (.onnx) | Cross-framework | Optimized inference, deployment |
| GGUF (.gguf) | llama.cpp | Quantized LLMs for CPU inference |
| TensorFlow (.pb, SavedModel) | TensorFlow | TF Serving, TFLite deployment |
| Core ML (.mlmodel) | Apple | iOS/macOS deployment |
Ready to Explore?
Let's start by exploring the largest model hub in the world — Hugging Face.
Next: Hugging Face Hub →
Lilly Tech Systems