CoolFace
Modelpublic

Kenpache/flame2

sourceHugging Faceapache-2.0updated 6mo agoView on Hugging Face
0likes25downloads
Model Card

FLAME2 — Financial Language Analysis for Multilingual Economics v2

One model. Ten languages. 150,000 headlines. Perspective-aware financial sentiment.

FLAME2 is a multilingual financial sentiment classifier that labels news headlines as Negative, Neutral, or Positive — but unlike other models, it does this from the local investor's perspective of each economy.

The same news can mean opposite things for different markets:

  • —"Oil prices fall to $65/barrel" → Negative for Arab markets (oil exporter) / Positive for India (oil importer)
  • —"Yen weakens to 155 per dollar" → Positive for Japan (helps exporters) / Neutral elsewhere

No other public model does this.


Key Numbers

Languages10 (Arabic, German, English, Spanish, French, Hindi, Japanese, Korean, Portuguese, Chinese)
Training data149,481 perspective-labeled financial headlines
Base modelXLM-RoBERTa-large (560M parameters)
LabelsNegative / Neutral / Positive
Accuracy84.11%
F1 (macro)84.20%

Quick Start

python
from transformers import pipeline

classifier = pipeline("text-classification", model="Kenpache/flame2")

# English — US investor perspective
classifier("[EN] Apple reported record quarterly revenue of $124 billion")
# [{'label': 'positive', 'score': 0.96}]

# Arabic — Gulf investor perspective
classifier("[AR] أسعار النفط تنخفض إلى 65 دولارا للبرميل")
# [{'label': 'negative', 'score': 0.93}]  (oil down = bad for exporters)

# Hindi — Indian investor perspective
classifier("[HI] तेल की कीमतें गिरकर 65 डॉलर प्रति बैरल हुईं")
# [{'label': 'positive', 'score': 0.91}]  (oil down = good for importers)

# Japanese
classifier("[JA] 日経平均株価が大幅下落、米中貿易摩擦の懸念で")
# [{'label': 'negative', 'score': 0.94}]

# Korean
classifier("[KO] 삼성전자 실적 호조에 코스피 상승")
# [{'label': 'positive', 'score': 0.92}]

# Chinese
classifier("[ZH] 中国央行降息50个基点,股市应声上涨")
# [{'label': 'positive', 'score': 0.95}]

# German
classifier("[DE] DAX erreicht neues Allzeithoch dank starker Bankenergebnisse")
# [{'label': 'positive', 'score': 0.93}]

# French
classifier("[FR] La Bourse de Paris chute de 3% après les tensions commerciales")
# [{'label': 'negative', 'score': 0.91}]

# Spanish
classifier("[ES] El beneficio neto de la compañía creció un 25% interanual")
# [{'label': 'positive', 'score': 0.94}]

# Portuguese
classifier("[PT] Ibovespa fecha em alta com otimismo sobre reforma tributária")
# [{'label': 'positive', 'score': 0.90}]

Important: Always use the [LANG] prefix ([EN], [AR], [HI], [JA], etc.) — this tells the model which market perspective to apply.


Supported Languages & Training Data

LanguageCodePrimary EconomyOil RoleTotalNegativeNeutralPositive
ArabicARGulf States (Saudi, UAE)Exporter14,4812,812 (19.4%)6,156 (42.5%)5,513 (38.1%)
GermanDEGermany / EurozoneImporter15,0003,544 (23.6%)6,636 (44.2%)4,820 (32.1%)
EnglishENUnited StatesMixed15,0003,088 (20.6%)7,649 (51.0%)4,263 (28.4%)
SpanishESSpain / Latin AmericaImporter15,0003,872 (25.8%)5,616 (37.4%)5,512 (36.7%)
FrenchFRFrance / EurozoneImporter15,0003,218 (21.5%)6,252 (41.7%)4,530 (30.2%)
HindiHIIndiaImporter15,0003,543 (23.6%)5,902 (39.3%)5,555 (37.0%)
JapaneseJAJapanImporter15,0003,472 (23.1%)5,897 (39.3%)5,631 (37.5%)
KoreanKOSouth KoreaImporter15,0003,290 (21.9%)6,648 (44.3%)5,062 (33.7%)
PortuguesePTBrazil / PortugalExporter15,0003,170 (21.1%)7,463 (49.8%)4,367 (29.1%)
ChineseZHChinaImporter15,0003,542 (23.6%)4,055 (27.0%)7,403 (49.4%)

Total: 149,481 labeled headlines across 10 languages.

Overall Class Distribution

ClassSamplesShare
Negative33,55122.4%
Neutral62,27441.7%
Positive52,65635.2%

Data sources include financial news sites, stock market reports, and economic news agencies — labeled with perspective-aware rules specific to each economy.


What Makes FLAME2 Different

The Problem

Existing financial sentiment models treat sentiment as universal. But financial sentiment is not universal — it depends on where you are:

  • —Oil prices drop? Bad for Saudi Arabia, great for India.
  • —Yen weakens? Good for Japanese exporters, bad for Korean competitors.
  • —Fed raises rates? Bad for US stocks, often neutral for European markets.

Our Solution: Perspective-Aware Labels

Every headline in our dataset was labeled from the perspective of a local investor in that language's primary economy. The model learns that [AR] means "Gulf investor" and [HI] means "Indian investor."

Oil Price Rules
Market TypeOil Price FallsOil Price RisesOPEC+ Output Increase
Exporters (AR, PT)NegativePositiveNegative
Importers (HI, KO, DE, FR, ES, JA, ZH)PositiveNegativePositive
Mixed (EN/US)PositiveContext-dependentPositive
Currency Rules
LanguageLocal Currency StrengthensLocal Currency Weakens
AR, PT, HI, KO, ZHPositiveNegative
JA (export-driven)Negative (hurts exporters)Positive (helps exporters)
EN, DE, FR, ESNeutralNeutral
Central Bank Rules
  • —Home central bank: rate cut = Positive, rate hike = Negative, hold = Neutral
  • —Foreign central bank: Neutral (unless headline explicitly links to local market impact)

Labels

LabelIDExamples
negative0Stock decline, losses, layoffs, downgrades, sanctions, bankruptcy
neutral1Factual reporting, mixed signals, foreign data without local impact
positive2Revenue growth, market rally, upgrades, new launches, rate cuts

Results

Overall

MetricScore
Accuracy84.11%
F1 (macro)84.20%

Per-Language Performance

LanguageCodeAccuracyF1 MacroTest Samples
HindiHI89.33%89.15%1,125
SpanishES85.44%85.31%1,573
JapaneseJA84.42%84.23%1,489
FrenchFR84.06%84.24%2,579
EnglishEN83.84%83.74%1,875
KoreanKO83.54%83.71%3,280
GermanDE83.56%83.96%1,928
ChineseZH83.50%81.43%1,751
PortuguesePT83.28%82.95%1,639
ArabicAR83.18%83.26%2,569

Per-Class Performance

ClassPrecisionRecallF1Support
Negative0.810.870.844,487
Neutral0.860.780.828,398
Positive0.840.900.876,923

Training Pipeline

FLAME2 was built in two stages:

Stage 1: Supervised Fine-Tuning

XLM-RoBERTa-large was fine-tuned on ~150,000 perspective-labeled headlines with:

  • —Focal Loss (gamma=2.0) — focuses training on hard, misclassified examples instead of easy ones
  • —Class weights to handle label imbalance across languages
  • —Label smoothing (0.1) to handle ~3-5% annotation noise
  • —Language prefix [LANG] injected before each headline for perspective routing
  • —GroupShuffleSplit by news source domain — no article from the same source appears in both train and test (prevents data leakage)
  • —Gradient clipping (max_norm=1.0) for training stability

Stage 2: Live Stochastic Weight Averaging (SWA)

After epoch 12, the learning rate switches to a constant low rate (1e-5) and an AveragedModel maintains a running average of weights updated every epoch. This produces smoother, more generalizable predictions than any single checkpoint.

Training Details

ParameterValue
Base modelxlm-roberta-large (560M params)
Fine-tuning data~150,000 labeled headlines
Languages10
Loss functionFocal Loss (gamma=2.0)
Learning rate2e-5 (→ 1e-5 SWA phase)
Label smoothing0.1
Batch size32
Max sequence length128 tokens
PrecisionFP16 (mixed precision)
Train/Val/Test split70% / 15% / 15%
Split strategyGroupShuffleSplit by source domain
SWALive averaging from epoch 12

Batch Processing

python
from transformers import pipeline

classifier = pipeline("text-classification", model="Kenpache/flame2", device=0)

texts = [
    "[EN] Stocks rallied after the Fed signaled a pause in rate hikes.",
    "[EN] The company filed for Chapter 11 bankruptcy protection.",
    "[DE] DAX erreicht neues Allzeithoch dank starker Bankenergebnisse",
    "[FR] La Bourse de Paris chute de 3% après les tensions commerciales",
    "[ES] El beneficio neto de la compañía creció un 25% interanual",
    "[ZH] 中国央行降息50个基点,股市应声上涨",
    "[PT] Ibovespa fecha em alta com otimismo sobre reforma tributária",
    "[AR] ارتفاع مؤشر السوق السعودي بنسبة 2% بعد إعلان أرباح أرامكو",
    "[HI] भारतीय रिजर्व बैंक ने रेपो रेट में 25 बीपीएस की कटौती की",
    "[JA] トヨタ自動車の純利益が前年比30%増加",
    "[KO] 삼성전자 실적 호조에 코스피 상승",
]

results = classifier(texts, batch_size=32)
for text, result in zip(texts, results):
    print(f"{result['label']:>8} ({result['score']:.2f})  {text[:70]}")

Use Cases

  • —Global News Monitoring — real-time sentiment classification across 10 markets
  • —Algorithmic Trading — perspective-aware signals: same event, different trades per market
  • —Portfolio Risk Management — track sentiment shifts across international holdings
  • —Cross-Market Arbitrage — detect when markets react differently to the same news
  • —Financial NLP Research — first multilingual perspective-aware sentiment benchmark

Limitations

  • —Optimized for news headlines (short text, 1-2 sentences). May underperform on long articles or social media.
  • —Perspective rules cover major economic patterns (oil, currency, central banks). Niche sector-specific effects may not be captured.
  • —Labels reflect the perspective of the primary economy for each language (e.g., AR = Gulf States, not all Arabic-speaking countries).

Citation

bibtex
@misc{flame2_2026,
  title={FLAME2: Financial Language Analysis for Multilingual Economics v2},
  author={Kenpache},
  year={2026},
  url={https://huggingface.co/Kenpache/flame2}
}

License

Apache 2.0