Instructions to use hravi/laya-finance with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Laya
How to use hravi/laya-finance with Laya:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Laya-Finance
A fine-tuned version of Laya (ModernBERT-large decision encoder) for financial text decisions: sentiment, topic, central-bank stance, headline direction, finance terminology and trading-approach classification.
Derived from the original Laya (Apache-2.0). Fine-tuned on public financial datasets and a private corpus. This is the third public checkpoint; it replaces the second.
Intended use: educational and research purposes only. Not for commercial use. The restriction comes from the terms of some of the training data. The original Laya code and weights remain under Apache-2.0.
Usage
import laya
agent = laya.load("hravi/laya-finance")
q = {"type": "choice",
"instructions": "What is the sentiment of this financial text toward the stock price or company outlook?",
"criteria": {"bearish": "negative for the stock price or outlook",
"neutral": "no clear price impact, or purely factual",
"bullish": "positive for the stock price or outlook"}}
out = agent.predict_batch(["Operating profit rose to EUR 13.1 mn from EUR 8.7 mn."], {"a": q})
print(out[0]["answers"]["a"]["probabilities"])
Keep the criteria order fixed: it defines the label index. The model answers any multiple-choice question about a financial text, but it was tuned on the tasks below, and works best with the label sets used there.
Benchmarks
Held-out test accuracy, fp32, one forward pass per item. Laya-Finance runs at roughly 5 to 32 ms per item on an integrated GPU; the zero-shot LLM takes roughly 2 to 3 s per item.
| Task | ProsusAI/finbert | Laya (original, zero-shot) | Laya-Finance | gpt-oss-20b (zero-shot) |
|---|---|---|---|---|
| Sentiment, PhraseBank | 0.893 | 0.879 | 0.920 | 0.812 |
| Sentiment, Twitter | 0.725 | 0.767 | 0.895 | 0.740 |
| Sentiment, FiQA | 0.472 | 0.528 | 0.731 | 0.824 |
| Topic | n/a | 0.477 | 0.861 | 0.652 |
| Headline direction | n/a | 0.758 | 0.948 | 0.784 |
| Central-bank stance | n/a | 0.458 | 0.661 | 0.680 |
| Finance terminology (domain) | n/a | 0.604 | 0.877 | 0.834 |
| Trading approach (style) | n/a | 0.442 | 0.786 | 0.728 |
Notes:
- Laya-Finance beats FinBERT on all three sentiment sets. PhraseBank is the fair comparison, since FinBERT was trained on it. The Twitter and FiQA gains are partly from in-domain training data FinBERT never saw.
- The zero-shot LLM is clearly better on FiQA and slightly better on central-bank stance. On terminology and trading-approach macro-F1, Laya-Finance is level with or slightly ahead of it (0.810 vs 0.805 and 0.690 vs 0.670).
- Terminology and trading-approach test labels were produced and cross-checked by strong language models, not human annotators, so treat those two rows as indicative.
- FinBERT only supports sentiment, so other cells are marked n/a.
Using it as a first-pass gate
Laya-Finance is fast enough to screen every item, and its confidence is informative: the more confident it is, the more often it is right. A practical pattern is to accept confident answers and send the rest to a larger model or a person. Measured on the held-out test sets, ranking items from most to least confident:
| Task | All items | Accuracy of the 80% most confident | Share of items answerable at 95% precision |
|---|---|---|---|
| Headline direction | 0.948 | 0.991 | 100% |
| Sentiment, PhraseBank | 0.920 | 0.972 | 90% |
| Sentiment, Twitter | 0.895 | 0.957 | 83% |
| Topic | 0.861 | 0.936 | 74% |
| Finance terminology | 0.877 | 0.946 | 79% |
| Trading approach (style) | 0.786 | 0.849 | 48% |
| Sentiment, FiQA | 0.731 | 0.799 | 27% |
| Central-bank stance | 0.661 | 0.717 | 18% |
Read this as a best case: the confidence cut-off that gives each figure was chosen on the test set itself, so in practice choose it on held-out data. Confidence separates good from bad answers well for headline direction, short-text sentiment, topic and terminology, and poorly for FiQA and central-bank stance, where most items should go to a larger model. The combined pipeline with a larger model has not been evaluated here. Nuanced or long inputs (FiQA-style news, long documents, summaries, reasoning) are better handled by a larger model.
Limitations
- English text only; short passages (a few hundred words at most).
- Classifies text. It makes no claim to improve trading returns, and nothing here is financial advice.
- The zero-shot LLM is well ahead on FiQA (0.824 vs 0.731) and slightly ahead on central-bank stance.
- The rarest trading-approach classes have only 4 to 10 test items each, so their scores are noisy.
- Scores on the tasks above come from one training run, so differences of about one point are within noise.
- Downloads last month
- 39
Model tree for hravi/laya-finance
Base model
convaiinnovations/laya