New
Introducing Compute Orchestration
November 10, 2023

8 Tips to Train and Fine-Tune Machine Learning Models

Table of Contents:

8 Tips to train and Fine-tune models in the Clarifai Platform

Model Training in machine learning is about building the best mathematical representation of the relationship between data features and target labels. For the models to perform consistently, you need to understand each model, and find the right data fit, and keep tweaking it to find the best combination of weights and biases for the model.

The Clarifai platform makes it easy to build AI models for your own business solutions. Whether you want to create your own model, fine-tune an existing one, or get started right away by using one of the pre-trained models from the community, the platform provides a user-friendly experience for all your AI needs.

Let's explore 8 valuable tips for training and fine-tuning machine learning models on the Clarifai platform.

First, let's begin by exploring various possible ways to add a model.

1. Add a model

You have four different options to add and use a model:

  • Finding Pre-Trained Models from the community: Explore hundreds of available models across text, audio, and vision that can be used directly.
  • You can train your own custom model: Build your model, perform Transfer Learning, Fine-tune it, or create a rule-based operator to chain multiple models.
  • Importing models from Hugging Face.
  • You also have the option to upload your own model to the platform.

2. Model Types

Clarifai offers a variety of powerful model types, each designed to generate meaningful outputs based on specific inputs. Whether you're working with images, videos, or text, there's a perfect model type for your needs.

Below, you can see different types of models we offer for image data, such as Transfer Learn, Visual Classifier, Visual Detector, Visual Segmenter, Visual Anomaly, Visual Embedder, and Clusterer. For a detailed look at these model points, check our documentation here.

  1. Transfer Learning Classifier: Utilizes a pre-trained model to classify images or texts, adapting to new tasks with minimal training data. Ideal for applications needing quick adaptation to new classification tasks without extensive data or computational resources.

  2. Visual Classifier: Classifies images and video frames into predefined categories or concepts. Useful for categorizing visual content in applications like photo organization, content moderation, or retail product identification.

  3. Visual Detector: Detects and locates objects within images or video frames, providing bounding box coordinates and classifications. Employed in surveillance, quality inspection, or augmented reality for identifying and tracking objects in real-time.

  4. Visual Segmenter: Performs pixel-level segmentation in images, identifying and classifying detailed regions or objects. Essential for detailed image analysis in medical imaging, autonomous vehicles, or precision agriculture.

  5. Visual Anomaly: Detects anomalies in visual data, providing an image-level score and localized anomaly heatmap. Applied in industrial inspection, quality control, or security to identify unusual or defective items.

  6. Visual Embedder: Converts images and video frames into high-level vector embeddings for advanced visual understanding. Facilitates visual search and similarity analysis in e-commerce, digital asset management, or recommendation systems.

  7. Clusterer: Clusters visually or semantically similar images and video frames in an embedding space. Ideal for organizing large visual datasets, enhancing visual search capabilities, or providing insights without explicit labeling.

By selecting the right model type, you can train or perform transfer learning on models for your own use cases.

Let’s look at one of the model types, Transfer Learn.

3. Transfer Learn - Model Type

Transfer Learn is one of the model types that you can use to classify images or texts based on the embedding model that has indexed into your Clarifai app.

Transfer learning leverages feature representations from a pre-trained model based on massive amounts of data, so you don't have to train a new model from scratch and can quickly learn new things with minimal training data.

To train a Transfer Learn Classifier, all you need to add is a Model Id, Training dataset, select the base embedding model, and specify the concepts that you want the model to predict. Check our blog for a detailed discussion of the concept of transfer learning, and check out this video to learn more about transfer learning on large language models (LLMs):


4. Deep Fine-Tuning Templates

While you can use  pre-built models to help you create AI solutions quickly and efficiently, there are many cases where accuracy and the ability to carefully target solutions takes priority over speed and ease of use.

For such cases, the option is to deep fine-tune your custom models. You can take advantage of a variety of templates that Clarifai offers when building your deep fine-tuned models. 

Templates give you the control to choose the specific architecture used by your neural network, and also define a set of hyperparameters that you can use to fine-tune.

To name a few there are Visual Classification, Visual Detection, Text Fine-Tuning Templates and others.

Learn more about Deep Fine-Tuning templates here.

5. Agent System Operators

Agent system operators are fixed-function operators that are non-trainable. They help you connect and direct your models within a workflow.

These operators can be chained together with models to automate tasks. Below, you can find different operators, such as a prompter, which is a pre-configured text used to instruct LLMs, an image cropper used to crop the input image according to each input region, and others.

Check out various operators and learn how to integrate them into your workflow here:

6. Managing Model Versions

Developing the best-performing machine learning models involves a lot of iterative work, as you may need to adjust hyperparameters, training data, or other parameters. Maintaining a history of these changes over time can assist you in reaching the objectives you initially envisioned for your machine learning models.

The Clarifai Portal allows you to track and manage different versions of your model. Utilizing the Portal for model version control can help you achieve several things, including versioned reproducibility, better collaboration and improved troubleshooting.

7. Evaluating Models

Once you have successfully trained the model, you may want to test its performance before deploying it in a production environment.

The model evaluation tools in the platform allows you to perform cross-validation on a specified model version. Once the evaluation is complete, you can view the various metrics that provide insights into the model’s performance.

8. Running Model Predictions on the Input Screen

You can run your model predictions directly on the inputs using the Clarifai portal. After uploading the input via the portal, the model will analyze it and provide predictions.

As mentioned earlier, for the machine learning models to work well, it's important to understand each model's parameters and find the right data fit. The Clarifai platform makes this easier by providing various model types, deep fine-tuning templates, agent system operators, version management, and evaluation tools. This allows users to easily integrate AI into their business solutions.