FinBERT Sentiment Analysis (INT8 ONNX Quantized)

INT8 quantized ONNX export of ProsusAI/finbert for 3-class financial sentiment classification (positive, negative, neutral).

Unlike other quantized FinBERT models that only export embeddings, this model preserves the classification head for direct sentiment inference.

Optimized for Node.js backends, edge environments, and in-browser inference using @huggingface/transformers (v3+).

Model Summary

Property Value
Base Model ProsusAI/finbert
Task Text Classification (3-class sentiment)
Format ONNX (INT8 dynamic quantization)
Model Size ~110 MB (vs ~438 MB FP32)
Size Reduction ~75%
Target Hardware ARM64 & x86_64 CPUs

Quick Start

Installation

npm install @huggingface/transformers

Node.js / ESM

import { pipeline } from '@huggingface/transformers';

const classifier = await pipeline(
  'text-classification',
  'nicechester/finbert-sentiment-onnx-quantized',
  { model_file_name: 'model', dtype: 'q8' }
);

const result = await classifier('Revenue exceeded expectations by 15%.');
console.log(result);
// [{ label: 'positive', score: 0.9631 }]

Batch Inference

const results = await classifier([
  'Strong quarterly earnings driven by cloud growth.',
  'Company announces layoffs amid declining sales.',
  'Board approved regular dividend payment.'
]);
console.log(results);
// [
//   { label: 'positive', score: 0.9245 },
//   { label: 'negative', score: 0.8872 },
//   { label: 'neutral', score: 0.7654 }
// ]

Local Model (Offline)

import { pipeline, env } from '@huggingface/transformers';

env.localModelPath = '/path/to/models';
env.allowRemoteModels = false;

const classifier = await pipeline(
  'text-classification',
  'finbert-sentiment-onnx-quantized',  // folder name under localModelPath
  { model_file_name: 'model', dtype: 'q8' }
);

Required folder structure:

/path/to/models/finbert-sentiment-onnx-quantized/
β”œβ”€β”€ config.json
β”œβ”€β”€ tokenizer.json
β”œβ”€β”€ tokenizer_config.json
β”œβ”€β”€ vocab.txt
└── onnx/
    └── model_quantized.onnx

Output Format

// Single text
[{ label: 'positive' | 'negative' | 'neutral', score: number }]

// Batch
[
  { label: 'positive', score: 0.92 },
  { label: 'negative', score: 0.85 },
  ...
]

Use Cases

  • Financial news sentiment analysis
  • Earnings call transcript classification
  • Market update sentiment scoring
  • SEC filing analysis
  • Real-time trading signal generation

Limitations

  • English only - trained on English financial text
  • Short/medium text - optimized for sentence-level classification (up to 512 tokens)
  • Financial domain - may not generalize well to non-financial text

Model Conversion

Exported and quantized using Hugging Face Optimum:

# 1. Export to ONNX with classification head
optimum-cli export onnx \
  --model ProsusAI/finbert \
  --task text-classification \
  ./finbert-onnx/

# 2. Quantize to INT8
optimum-cli onnxruntime quantize \
  --onnx_model ./finbert-onnx/ \
  --arm64 \
  -o ./finbert-quantized/

Citation

@article{araci2019finbert,
  title={FinBERT: Financial Sentiment Analysis with Pre-Trained Language Models},
  author={Araci, Dogu},
  journal={arXiv preprint arXiv:1908.10063},
  year={2019}
}

License

Apache 2.0 (same as base model)

Downloads last month
88
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for nicechester/finbert-sentiment-onnx-quantized

Base model

ProsusAI/finbert
Quantized
(8)
this model

Paper for nicechester/finbert-sentiment-onnx-quantized