deberta-v3-company-relevance (private)

What it is for. Whether a short financial-news text is about a given company (the company is in the facts the text presents) or not (absent, a passing mention, or the facts are about another company or the market). It is a natural-language inference classifier: premise = the text, hypothesis = This text is mainly about <company>.; the probability of class 0 (entailment) is the relevance score. In the project's pipeline it (1) picks the main company of a summary or a sub-news among the companies found by NER (every company over a threshold is main, PLAN D39 (i)) and (2) is stacked with the sentiment model (gamug/FinBERT-company-sentiment) to fix its weak class (neutral).

Not for: raw article bodies, texts without a company name to test, other languages, or as a sentiment model.

How it was trained

  • Start: MoritzLaurer/deberta-v3-base-zeroshot-v2.0@8e7e5af5983a0ddb1a5b45a38b129ab69e2258e8 (the project's zero-shot category model).
  • Labels derived from the sentiment tags: relevant = the owner marked a direction (positive or negative), not relevant = the owner marked neutral. So "not relevant" carries the same mixture as neutral: it includes texts that do name the company but state no fact about its price. This is a limit of the labels, not a separate annotation.
  • Recipe: 3 epochs, learning rate 2e-5, batch 16, weight decay 0.01, 10% warm-up, max length 320, float32 weights with bf16 autocast, seed 1; trained on all 809 rows (no validation slice). Cross-entropy on two classes.

Data. 809 rows, each a text (a short summary of a financial-news article, about 330 characters on average, English, published 2022 to 2026; written by sshleifer/distilbart-cnn-12-6) and a company (228 companies of the project's tracked universe of 507). The labels were made by one person, the project owner, who read each text for that company: the sentiment an investor would read on the company's price (relevant = positive or negative: 607; not relevant = neutral: 202). The rule: if the company is in the facts the text presents, the mark is the sentiment about it; if the text gives no fact about the company (it is absent, mentioned in passing, or the facts are about another company or the market), the mark is neutral. The rows come from two draws balanced by what an earlier model predicted (not by the owner's classes), so every figure below is weighted back to the pool each draw came from. The marks and their texts are tracked in the project repository gamug/portfolio-nlp (gold/sentiment_train.csv, gold/sentiment_train_2.csv, gold/texts/); this model repository holds no news text.

Figures (cross-validation, not an exam)

5-fold x 2 cross-validation over the same 809 rows, every text scored by a model that did not train on it, weighted: AUC of the relevance score for "relevant" = 0.902 and 0.890 (mean 0.896). For comparison: the same model zero-shot 0.743 (the best of nine wordings, chosen on these same texts), and the sentiment model's own 1 - p(neutral) 0.795. Stacked with the sentiment model the score goes from 0.737 to 0.814 (see gamug/FinBERT-company-sentiment).

The 180-text gold has not been scored. The relevance score was never evaluated on texts the project did not tag, and not on sub-news (shorter pieces cut by the extractor): it was trained on summaries, so its use there is an open risk (task T-170).

Assumptions and limits

  • The labels are derived (a direction means relevant) from one annotator; neutral-but-about-the-company rows teach the model that "not mainly about" can include "about, no direction".
  • Weighted figures estimate the pools of two sampling designs, not the corpus.
  • The threshold for "main company" is not set (task T-169/T-172): it is chosen from the out-of-fold scores before use.
  • The final model saw all rows; the figures are for the recipe.

Use

import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
tok = AutoTokenizer.from_pretrained("gamug/deberta-v3-company-relevance")
model = AutoModelForSequenceClassification.from_pretrained("gamug/deberta-v3-company-relevance").eval()
x = tok("Apple shares fell 5% after weak iPhone sales.", "This text is mainly about Apple.", truncation="only_first", max_length=320, return_tensors="pt")
relevance = torch.softmax(model(**x).logits, -1)[0, 0].item()      # class 0 = entailment = relevant
Downloads last month
23
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for gamug/deberta-v3-company-relevance

Finetuned
(13)
this model