Skip to content

Add examples for all HuggingFace models (#2102)#2247

Open
AlexCatarino wants to merge 5 commits intoQuantConnect:masterfrom
AlexCatarino:bug-2102-add-huggingface-examples
Open

Add examples for all HuggingFace models (#2102)#2247
AlexCatarino wants to merge 5 commits intoQuantConnect:masterfrom
AlexCatarino:bug-2102-add-huggingface-examples

Conversation

@AlexCatarino
Copy link
Member

@AlexCatarino AlexCatarino commented Mar 17, 2026

Summary

  • Add examples for Sentiment Analysis (06), Fill-Mask (07), Text Generation (08), and Chronos-Bolt (12) HuggingFace model categories
  • All 4 new example algorithms passed cloud backtesting
  • Add example links in Resources/machine-learning/hugging-face-table.html for the newly covered models
  • Remove Moirai, MOMENT, and Granite TTM sections — they require uni2ts, momentfm, and tsfm_public packages that are not available in QC Cloud (tracked in [Library Upgrade] uni2ts, momentfm, tsfm_public (Moirai, MOMENT, Granite TTM) Lean#9340)

Note: This PR does not resolve #2102. The remaining models (Moirai, MOMENT, Granite TTM) depend on QuantConnect/Lean#9340 to add their required packages to QC Cloud. Examples for those models will be added in a follow-up PR once the packages are available.

Model Backtest Results

Each example supports multiple interchangeable models. Results below use the same algorithm with different models swapped in.

Sentiment Analysis

Model Net Profit Drawdown Sharpe Ratio
mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis 8.187% 29.000% 0.591
ahmedrachid/FinancialBERT-Sentiment-Analysis 29.430% 29.000% 1.586
AventIQ-AI/sentiment-analysis-for-stock-market-sentiment -9.417% 16.700% -1.296
bardsai/finance-sentiment-fr-base 29.430% 29.000% 1.586
cardiffnlp/twitter-roberta-base-sentiment-latest 29.430% 29.000% 1.586
nickmuchi/deberta-v3-base-finetuned-finance-text-classification N/A — model not pre-cached in QC Cloud
nickmuchi/distilroberta-finetuned-financial-text-classification -9.417% 16.700% -1.296
nickmuchi/sec-bert-finetuned-finance-classification -9.417% 16.700% -1.296
StephanAkkerman/FinTwitBERT-sentiment -9.417% 16.700% -1.296

Fill-Mask

Model Net Profit Drawdown Sharpe Ratio
distilbert/distilbert-base-uncased pending
FacebookAI/roberta-base pending
google-bert/bert-base-uncased pending
microsoft/deberta-base pending

Text Generation

Model Net Profit Drawdown Sharpe Ratio
openai-community/gpt2 pending
google/gemma-7b pending
deepseek-ai/DeepSeek-R1-Distill-Llama-70B pending

Chronos-Bolt

Model Net Profit Drawdown Sharpe Ratio
autogluon/chronos-bolt-base pending

Fill-Mask, Text Generation, and Chronos-Bolt hit the QC Cloud daily project creation limit (100/day) during testing. Results will be added once the limit resets.

Test plan

  • Sentiment Analysis example backtested on QC Cloud — PASS (8/9 models; 1 model not pre-cached)
  • Fill-Mask example backtested on QC Cloud — PASS (integration test)
  • Text Generation example backtested on QC Cloud — PASS (integration test)
  • Chronos-Bolt example backtested on QC Cloud — PASS (integration test)
  • Fill-Mask per-model results pending (daily limit)
  • Text Generation per-model results pending (daily limit)
  • Chronos-Bolt per-model results pending (daily limit)
  • Verify the pages render correctly on quantconnect.com/docs
  • Check all links resolve

AlexCatarino and others added 2 commits March 17, 2026 19:31
Add documentation sections with algorithm examples for all HuggingFace
models in the popular models table that were missing examples:

- Sentiment Analysis: covers 8 text classification models
- Fill-Mask: covers BERT, DistilBERT, RoBERTa, DeBERTa
- Text Generation: covers GPT-2, Gemma, DeepSeek
- Moirai: time series forecasting (small/base/large)
- MOMENT: time series foundation model
- Granite TTM: IBM lightweight time series forecasting
- Chronos-Bolt: efficient Chronos variant

Update the model table to link every model to its example page.
Fix AventIQ-AI model category from Time Series Forecasting to
Text Classification.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ntConnect#2102)

- Change all example blocks from skip-test to testable
- Fix Chronos-Bolt to use predict() instead of predict_quantiles()
  to match the same pattern as Chronos-T5
- Rewrite Moirai, MOMENT, and Granite TTM examples to use their
  correct package APIs (uni2ts, momentfm, tsfm_public)

Sentiment Analysis, Fill-Mask, Text Generation, and Chronos-Bolt
examples pass cloud backtesting. Moirai, MOMENT, and Granite TTM
require uni2ts, momentfm, and tsfm_public packages respectively,
which need to be pre-installed in the cloud environment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AlexCatarino and others added 3 commits March 17, 2026 22:12
… entry (QuantConnect#2102)

- Delete 09 Moirai, 10 MOMENT, 11 Granite TTM sections (require uni2ts/momentfm/tsfm_public,
  not available in QC Cloud; tracked in QuantConnect/Lean#9340)
- Fix 00.json: correct Chronos-Bolt folder key from "09" to "12"
- Remove example links for Moirai, MOMENT, Granite TTM rows in hugging-face-table.html

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ct#2102)

Add EXAMPLES entries for sentiment-analysis, fill-mask, text-generation,
and chronos-bolt pages; regenerate the HTML table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…onnect#2102)

The mrm8488/distilroberta placeholder model takes >10 minutes to backtest
on QC Cloud due to model size and repeated inference over 4 months of data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Examples to All HuggingFace Models

1 participant