---
title: "Key Concepts"
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/key-concepts
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/key-concepts.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/31%20Machine%20Learning/04%20Hugging%20Face/01%20Key%20Concepts
modified: 2026-10-29
index: https://www.quantconnect.com/llms.txt
---

# Key Concepts

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Machine Learning > Hugging Face > Key Concepts

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

Hugging Face is a leading company in natural language processing (NLP), providing powerful tools and pre-trained models that can significantly enhance your trading algorithms on QuantConnect. By integrating Hugging Face's models, you can easily leverage advanced NLP capabilities for tasks such as sentiment analysis, news classification, and market forecasting without defining and training the model yourself. Hugging Face provides an easy way to leverage the research of community members to increase the sophistication of your trading algorithms.

## Supported Models

Hundreds of thousands of Hugging Face models are publicly available and ready to use. To view all of them, see the [Model Hub](https://huggingface.co/models) on the Hugging Face website. The **Model card** tab of each model repository explains an overview of how the model works, its requirements, and a quick start guide.

QuantConnect Cloud caches some of the most popular models to speed up your development workflow. The following table shows the cached models:

| Name | Category | Example |
| --- | --- | --- |
| [ahmedrachid/FinancialBERT-Sentiment-Analysis](https://huggingface.co/ahmedrachid/FinancialBERT-Sentiment-Analysis) | Text Classification | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/sentiment-analysis.md) |
| [amazon/chronos-t5-base](https://huggingface.co/amazon/chronos-t5-base) | Time Series Forecasting | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/chronos-t5.md) |
| [amazon/chronos-t5-large](https://huggingface.co/amazon/chronos-t5-large) | Time Series Forecasting | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/chronos-t5.md) |
| [amazon/chronos-t5-small](https://huggingface.co/amazon/chronos-t5-small) | Time Series Forecasting | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/chronos-t5.md) |
| [amazon/chronos-t5-tiny](https://huggingface.co/amazon/chronos-t5-tiny) | Time Series Forecasting | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/chronos-t5.md) |
| [autogluon/chronos-bolt-base](https://huggingface.co/autogluon/chronos-bolt-base) | Time Series Forecasting | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/chronos-bolt.md) |
| [autogluon/chronos-t5-base](https://huggingface.co/autogluon/chronos-t5-base) | Time Series Forecasting | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/chronos-t5.md) |
| [autogluon/chronos-t5-large](https://huggingface.co/autogluon/chronos-t5-large) | Time Series Forecasting | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/chronos-t5.md) |
| [autogluon/chronos-t5-tiny](https://huggingface.co/autogluon/chronos-t5-tiny) | Time Series Forecasting | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/chronos-t5.md) |
| [AutonLab/MOMENT-1-large](https://huggingface.co/AutonLab/MOMENT-1-large) | Time Series Forecasting |  |
| [AventIQ-AI/sentiment-analysis-for-stock-market-sentiment](https://huggingface.co/AventIQ-AI/sentiment-analysis-for-stock-market-sentiment) | Text Classification | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/sentiment-analysis.md) |
| [bardsai/finance-sentiment-fr-base](https://huggingface.co/bardsai/finance-sentiment-fr-base) | Text Classification | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/sentiment-analysis.md) |
| [cardiffnlp/twitter-roberta-base-sentiment-latest](https://huggingface.co/cardiffnlp/twitter-roberta-base-sentiment-latest) | Text Classification | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/sentiment-analysis.md) |
| [deepseek-ai/DeepSeek-R1-Distill-Llama-70B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-70B) | Text Generation | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/text-generation.md) |
| [distilbert/distilbert-base-cased-distilled-squad](https://huggingface.co/distilbert/distilbert-base-cased-distilled-squad) | Question Answering | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/distilbert.md) |
| [distilbert/distilbert-base-uncased](https://huggingface.co/distilbert/distilbert-base-uncased) | Fill-Mask | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/fill-mask.md) |
| [FacebookAI/roberta-base](https://huggingface.co/FacebookAI/roberta-base) | Fill-Mask | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/fill-mask.md) |
| [google-bert/bert-base-uncased](https://huggingface.co/google-bert/bert-base-uncased) | Fill-Mask | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/fill-mask.md) |
| [google/gemma-7b](https://huggingface.co/google/gemma-7b) | Text Generation | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/text-generation.md) |
| [ibm-granite/granite-timeseries-ttm-r1](https://huggingface.co/ibm-granite/granite-timeseries-ttm-r1) | Time Series Forecasting |  |
| [microsoft/deberta-base](https://huggingface.co/microsoft/deberta-base) | Fill-Mask | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/fill-mask.md) |
| [mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis](https://huggingface.co/mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis) | Text Classification | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/sentiment-analysis.md) |
| [nickmuchi/deberta-v3-base-finetuned-finance-text-classification](https://huggingface.co/nickmuchi/deberta-v3-base-finetuned-finance-text-classification) | Text Classification | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/sentiment-analysis.md) |
| [nickmuchi/distilroberta-finetuned-financial-text-classification](https://huggingface.co/nickmuchi/distilroberta-finetuned-financial-text-classification) | Text Classification | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/sentiment-analysis.md) |
| [nickmuchi/sec-bert-finetuned-finance-classification](https://huggingface.co/nickmuchi/sec-bert-finetuned-finance-classification) | Text Classification | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/sentiment-analysis.md) |
| [openai-community/gpt2](https://huggingface.co/openai-community/gpt2) | Text Generation | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/text-generation.md) |
| [ProsusAI/finbert](https://huggingface.co/ProsusAI/finbert) | Text Classification | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/finbert.md) |
| [Salesforce/moirai-1.0-R-base](https://huggingface.co/Salesforce/moirai-1.0-R-base) | Time Series Forecasting |  |
| [Salesforce/moirai-1.0-R-large](https://huggingface.co/Salesforce/moirai-1.0-R-large) | Time Series Forecasting |  |
| [Salesforce/moirai-1.0-R-small](https://huggingface.co/Salesforce/moirai-1.0-R-small) | Time Series Forecasting |  |
| [StephanAkkerman/FinTwitBERT-sentiment](https://huggingface.co/StephanAkkerman/FinTwitBERT-sentiment) | Text Classification | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/sentiment-analysis.md) |
| [yiyanghkust/finbert-tone](https://huggingface.co/yiyanghkust/finbert-tone) | Text Classification | [![Example](https://cdn.quantconnect.com/i/tu/internal-link.svg)](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/finbert.md) |

To see the commit hash of the cached models, run the following algorithm in QC Cloud and then [view the logs](https://www.quantconnect.com/docs/v2/writing-algorithms/logging.md#07-Get-Logs):

```python
# Scan and log all cached Hugging Face model revisions from the cache directory.
from huggingface_hub import scan_cache_dir

class HuggingFaceModelHashAlgorithm(QCAlgorithm):

    def initialize(self):
        cache_info = scan_cache_dir()
        cached_models_log = []
        for entry in cache_info.repos:
            revisions = [revision.commit_hash for revision in entry.revisions]
            cached_models_log.append(f'Repo: {entry.repo_id}. Revisions {str(revisions)}')
        self.quit('\n'.join(sorted(cached_models_log)))
```

## Train Models

Hugging Face models are pre-trained, so you can quickly load them into your algorithms and use their output to inform your trading decisions. To customize the model for your specific use case, you can fine-tune the pre-trained model with your own training data.

## Examples

You may refer to the following table for examples of popular Hugging Face models:

| Model Name | Model Type | Example |
| --- | --- | --- |
| Chronos-T5 | Pretrained Time Series Forecasting Transformer Model | [Example](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/chronos-t5.md#99-Examples) |
| FinBERT | Text Classification Transformer Model | [Example](https://www.quantconnect.com/docs/v2/writing-algorithms/machine-learning/hugging-face/popular-models/finbert.md#99-Examples) |
