Text Classification
Transformers
Safetensors
English
qwen3_5_text
text-generation
Rodinia
finance
financial-ai
decision-intelligence
typed-decisions
financial-classification
calibrated-probabilities
probability-calibration
risk-assessment
sentiment-analysis
portfolio-analysis
0.8b
sociodynamics-ai
Instructions to use NeoSapian/Rodinia with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NeoSapian/Rodinia with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="NeoSapian/Rodinia")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("NeoSapian/Rodinia") model = AutoModelForCausalLM.from_pretrained("NeoSapian/Rodinia", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -37,11 +37,11 @@ It uses a specialized classification interface built around three decision types
|
|
| 37 |
|
| 38 |
Nirnay uses next-token logits over predefined option tokens to calculate decision probabilities. It does not require free-form natural-language generation to produce its decisions.
|
| 39 |
|
| 40 |
-
The model is fine-
|
| 41 |
|
| 42 |
---
|
| 43 |
|
| 44 |
-
#
|
| 45 |
|
| 46 |
| Property | Description |
|
| 47 |
|---|---|
|
|
@@ -60,7 +60,7 @@ The model is fine-tuned from `Qwen/Qwen3.5-0.8B-Base` and uses temperature calib
|
|
| 60 |
| Primary language | English |
|
| 61 |
| Intended application | Financial text and state classification |
|
| 62 |
|
| 63 |
-
##
|
| 64 |
|
| 65 |
Nirnay follows a different approach from generative financial LLMs.
|
| 66 |
|
|
@@ -70,43 +70,43 @@ It evaluates the state against those questions and returns probability distribut
|
|
| 70 |
|
| 71 |
This makes the output suitable for downstream systems that need structured classification rather than unrestricted text generation.
|
| 72 |
|
| 73 |
-
|
| 74 |
|
| 75 |
```text
|
| 76 |
-
Financial State
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
Nirnay 0.8B
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
Typed Decision Interface
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
```
|
| 106 |
|
| 107 |
---
|
| 108 |
|
| 109 |
-
#
|
| 110 |
|
| 111 |
Nirnay is a full fine-tune of:
|
| 112 |
|
|
@@ -116,38 +116,70 @@ The model uses the base model's learned language representations to interpret fi
|
|
| 116 |
|
| 117 |
Its decision interface operates over predefined output tokens rather than relying on unrestricted text generation.
|
| 118 |
|
| 119 |
-
##
|
| 120 |
|
| 121 |
-
For an input state
|
| 122 |
|
| 123 |
-
For a choice task with candidate options
|
| 124 |
|
| 125 |
-
|
| 126 |
P(c_i \mid x,q) =
|
| 127 |
\frac{\exp(z_i/T)}
|
| 128 |
{\sum_{j=1}^{K}\exp(z_j/T)}
|
| 129 |
-
|
| 130 |
|
| 131 |
Where:
|
| 132 |
|
| 133 |
-
-
|
| 134 |
-
-
|
| 135 |
-
-
|
| 136 |
-
-
|
| 137 |
|
| 138 |
The selected decision is:
|
| 139 |
|
| 140 |
-
|
| 141 |
-
\hat{c} =
|
| 142 |
-
\
|
|
|
|
|
|
|
| 143 |
|
| 144 |
-
|
| 145 |
|
| 146 |
-
###
|
| 147 |
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
Example:
|
| 153 |
|
|
@@ -163,16 +195,16 @@ Example:
|
|
| 163 |
}
|
| 164 |
```
|
| 165 |
|
| 166 |
-
|
| 167 |
|
| 168 |
- Financial news categorization
|
| 169 |
- Event classification
|
| 170 |
- Economic topic identification
|
| 171 |
- Market event classification
|
| 172 |
|
| 173 |
-
###
|
| 174 |
|
| 175 |
-
|
| 176 |
|
| 177 |
Example:
|
| 178 |
|
|
@@ -188,7 +220,7 @@ Example:
|
|
| 188 |
}
|
| 189 |
```
|
| 190 |
|
| 191 |
-
|
| 192 |
|
| 193 |
- News severity classification
|
| 194 |
- Financial risk categorization
|
|
@@ -197,9 +229,9 @@ Possible applications:
|
|
| 197 |
|
| 198 |
The score represents a selected category, not a calibrated numerical probability of a future market outcome.
|
| 199 |
|
| 200 |
-
###
|
| 201 |
|
| 202 |
-
|
| 203 |
|
| 204 |
Example:
|
| 205 |
|
|
@@ -210,7 +242,7 @@ Example:
|
|
| 210 |
}
|
| 211 |
```
|
| 212 |
|
| 213 |
-
|
| 214 |
|
| 215 |
- Positive/negative news classification
|
| 216 |
- Binary financial event classification
|
|
@@ -219,11 +251,25 @@ Possible applications:
|
|
| 219 |
|
| 220 |
---
|
| 221 |
|
| 222 |
-
#
|
|
|
|
|
|
|
| 223 |
|
| 224 |
-
|
| 225 |
|
| 226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
|
| 228 |
| Dataset category | Training objective |
|
| 229 |
|---|---|
|
|
@@ -241,13 +287,20 @@ The training data includes:
|
|
| 241 |
|
| 242 |
Additional tweet and text datasets were included only when they passed the label audit.
|
| 243 |
|
| 244 |
-
##
|
|
|
|
|
|
|
| 245 |
|
| 246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
|
| 248 |
-
These
|
| 249 |
|
| 250 |
-
##
|
| 251 |
|
| 252 |
Synthetic datasets provide explicitly defined decision tasks with labels generated using deterministic rules or mathematical formulas.
|
| 253 |
|
|
@@ -264,19 +317,19 @@ However, performance on synthetic tasks should not be interpreted as equivalent
|
|
| 264 |
|
| 265 |
---
|
| 266 |
|
| 267 |
-
#
|
| 268 |
|
| 269 |
Nirnay provides a typed decision interface through `JevClassifier`.
|
| 270 |
|
| 271 |
It does not use conventional text-generation inference for its primary decision outputs.
|
| 272 |
|
| 273 |
-
##
|
| 274 |
|
| 275 |
```bash
|
| 276 |
pip install -U transformers torch huggingface_hub
|
| 277 |
```
|
| 278 |
|
| 279 |
-
##
|
| 280 |
|
| 281 |
```python
|
| 282 |
from huggingface_hub import hf_hub_download
|
|
@@ -285,13 +338,13 @@ import sys
|
|
| 285 |
|
| 286 |
MODEL_ID = "NeoSapian/nirnay"
|
| 287 |
|
| 288 |
-
# Download decision interface
|
| 289 |
p = hf_hub_download(
|
| 290 |
repo_id=MODEL_ID,
|
| 291 |
filename="jev_common.py"
|
| 292 |
)
|
| 293 |
|
| 294 |
-
# Load module
|
| 295 |
s = importlib.util.spec_from_file_location(
|
| 296 |
"jev_common",
|
| 297 |
p
|
|
@@ -303,11 +356,15 @@ sys.modules["jev_common"] = m
|
|
| 303 |
|
| 304 |
s.loader.exec_module(m)
|
| 305 |
|
| 306 |
-
# Initialize
|
| 307 |
clf = m.JevClassifier(MODEL_ID)
|
| 308 |
```
|
| 309 |
|
| 310 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
| 311 |
|
| 312 |
```python
|
| 313 |
result = clf.decide(
|
|
@@ -343,7 +400,15 @@ result = clf.decide(
|
|
| 343 |
print(result)
|
| 344 |
```
|
| 345 |
|
| 346 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
|
| 348 |
Nirnay can evaluate text or JSON-formatted state descriptions.
|
| 349 |
|
|
@@ -380,17 +445,24 @@ result = clf.decide(
|
|
| 380 |
print(result)
|
| 381 |
```
|
| 382 |
|
| 383 |
-
This
|
| 384 |
|
| 385 |
---
|
| 386 |
|
| 387 |
-
#
|
| 388 |
|
| 389 |
Nirnay was evaluated on a held-out test set containing 7,290 examples.
|
| 390 |
|
| 391 |
-
The evaluation covers
|
| 392 |
|
| 393 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 394 |
|
| 395 |
| Metric | Raw | Calibrated |
|
| 396 |
|---|---:|---:|
|
|
@@ -399,21 +471,18 @@ The evaluation covers overall accuracy, expected calibration error (ECE), Brier
|
|
| 399 |
| Brier Score | 0.1534 | 0.1431 |
|
| 400 |
| NLL | 0.3040 | 0.2624 |
|
| 401 |
|
| 402 |
-
|
| 403 |
-
<summary>Full overall evaluation</summary>
|
| 404 |
|
| 405 |
- Total evaluation examples: 7,290
|
| 406 |
- Raw accuracy: 89.63%
|
| 407 |
- Raw ECE: 0.0505
|
| 408 |
- Calibrated ECE: 0.0112
|
| 409 |
-
- Raw Brier: 0.1534
|
| 410 |
-
- Calibrated Brier: 0.1431
|
| 411 |
- Raw NLL: 0.3040
|
| 412 |
- Calibrated NLL: 0.2624
|
| 413 |
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
### 5.2 Performance by Decision Type
|
| 417 |
|
| 418 |
| Decision type | Samples | Accuracy | Raw ECE | Calibrated ECE |
|
| 419 |
|---|---:|---:|---:|---:|
|
|
@@ -421,21 +490,19 @@ The evaluation covers overall accuracy, expected calibration error (ECE), Brier
|
|
| 421 |
| Score | 2,043 | 79.15% | 0.0898 | 0.0326 |
|
| 422 |
| Noul | 3,823 | 95.27% | 0.0278 | 0.0077 |
|
| 423 |
|
| 424 |
-
###
|
| 425 |
-
|
| 426 |
-
**Choice — 89.54%**
|
| 427 |
|
| 428 |
The model demonstrates strong performance in selecting among predefined financial categories.
|
| 429 |
|
| 430 |
-
|
| 431 |
|
| 432 |
Ordinal classification is more challenging than binary classification. This remains an area for further improvement.
|
| 433 |
|
| 434 |
-
|
| 435 |
|
| 436 |
Binary decision classification achieves the highest accuracy among the three evaluated decision types.
|
| 437 |
|
| 438 |
-
##
|
| 439 |
|
| 440 |
| Type | Brier Raw | Brier Calibrated | NLL Raw | NLL Calibrated |
|
| 441 |
|---|---:|---:|---:|---:|
|
|
@@ -445,7 +512,7 @@ Binary decision classification achieves the highest accuracy among the three eva
|
|
| 445 |
|
| 446 |
---
|
| 447 |
|
| 448 |
-
#
|
| 449 |
|
| 450 |
The following table reports the held-out evaluation results by source category.
|
| 451 |
|
|
@@ -470,7 +537,7 @@ The following table reports the held-out evaluation results by source category.
|
|
| 470 |
| WCB Time | 117 | 86.32% |
|
| 471 |
| WCB Uncertain | 127 | 85.04% |
|
| 472 |
|
| 473 |
-
##
|
| 474 |
|
| 475 |
The results show different performance levels across financial classification tasks.
|
| 476 |
|
|
@@ -483,13 +550,13 @@ Notable observations:
|
|
| 483 |
- FOMC classification achieves 67.86%.
|
| 484 |
- WCB classification achieves 66.67%.
|
| 485 |
|
| 486 |
-
|
| 487 |
|
| 488 |
Some dataset slices are small. Their accuracy values should not be interpreted as stable estimates of generalization performance.
|
| 489 |
|
| 490 |
---
|
| 491 |
|
| 492 |
-
#
|
| 493 |
|
| 494 |
An important component of Nirnay is probability calibration.
|
| 495 |
|
|
@@ -499,7 +566,7 @@ For example, a model that predicts 90% confidence on 100 decisions should ideall
|
|
| 499 |
|
| 500 |
Nirnay uses temperature scaling to adjust the distribution of output probabilities.
|
| 501 |
|
| 502 |
-
##
|
| 503 |
|
| 504 |
| Metric | Before Calibration | After Calibration |
|
| 505 |
|---|---:|---:|
|
|
@@ -507,27 +574,27 @@ Nirnay uses temperature scaling to adjust the distribution of output probabiliti
|
|
| 507 |
| Brier Score | 0.1534 | 0.1431 |
|
| 508 |
| NLL | 0.3040 | 0.2624 |
|
| 509 |
|
| 510 |
-
##
|
| 511 |
|
| 512 |
-
|
| 513 |
|
| 514 |
Measures the difference between predicted confidence and observed accuracy across confidence groups.
|
| 515 |
|
| 516 |
-
Lower
|
| 517 |
|
| 518 |
-
|
| 519 |
|
| 520 |
Measures the squared error between predicted probabilities and actual outcomes.
|
| 521 |
|
| 522 |
-
Lower
|
| 523 |
|
| 524 |
-
|
| 525 |
|
| 526 |
Measures how much probability the model assigns to the correct outcomes.
|
| 527 |
|
| 528 |
-
Lower
|
| 529 |
|
| 530 |
-
##
|
| 531 |
|
| 532 |
Calibration was measured on a held-out distribution.
|
| 533 |
|
|
@@ -543,13 +610,13 @@ Calibration does not establish that the model understands future market behavior
|
|
| 543 |
|
| 544 |
---
|
| 545 |
|
| 546 |
-
#
|
| 547 |
|
| 548 |
Nirnay is intended to serve as a structured decision component inside larger financial software systems.
|
| 549 |
|
| 550 |
-
|
| 551 |
|
| 552 |
-
|
| 553 |
|
| 554 |
- Headline classification
|
| 555 |
- Financial sentiment classification
|
|
@@ -557,14 +624,18 @@ Potential applications include:
|
|
| 557 |
- News topic categorization
|
| 558 |
- Binary news assessments
|
| 559 |
|
| 560 |
-
##
|
|
|
|
|
|
|
| 561 |
|
| 562 |
- Predefined risk-category classification
|
| 563 |
- Ordinal severity assessment
|
| 564 |
- Portfolio state categorization
|
| 565 |
- Structured risk-screening workflows
|
| 566 |
|
| 567 |
-
##
|
|
|
|
|
|
|
| 568 |
|
| 569 |
- Portfolio concentration classification
|
| 570 |
- Portfolio drift categorization
|
|
@@ -573,7 +644,7 @@ Potential applications include:
|
|
| 573 |
|
| 574 |
For arithmetic-heavy portfolio calculations, use deterministic financial computation and use Nirnay as a classification layer.
|
| 575 |
|
| 576 |
-
##
|
| 577 |
|
| 578 |
Nirnay can be integrated into pipelines that combine:
|
| 579 |
|
|
@@ -586,7 +657,7 @@ Nirnay can be integrated into pipelines that combine:
|
|
| 586 |
|
| 587 |
---
|
| 588 |
|
| 589 |
-
#
|
| 590 |
|
| 591 |
Nirnay is not a conventional generative financial chatbot.
|
| 592 |
|
|
@@ -608,31 +679,31 @@ The model evaluates the supplied state against a defined classification question
|
|
| 608 |
|
| 609 |
---
|
| 610 |
|
| 611 |
-
#
|
| 612 |
|
| 613 |
Users should consider the following limitations before deploying Nirnay.
|
| 614 |
|
| 615 |
-
|
| 616 |
|
| 617 |
The model's performance depends on the similarity between deployment data and training data.
|
| 618 |
|
| 619 |
-
|
| 620 |
|
| 621 |
Portfolio and other synthetic tasks use rule-generated labels. High accuracy on those tasks does not independently establish real-world financial expertise.
|
| 622 |
|
| 623 |
-
|
| 624 |
|
| 625 |
Probability calibration is distribution-dependent and may degrade under distribution shift.
|
| 626 |
|
| 627 |
-
|
| 628 |
|
| 629 |
Exact financial calculations should be performed using deterministic code.
|
| 630 |
|
| 631 |
-
|
| 632 |
|
| 633 |
Choice and score outputs depend on the criteria and levels supplied by the user.
|
| 634 |
|
| 635 |
-
|
| 636 |
|
| 637 |
Nirnay should be used as a decision-support component, not as an autonomous investment authority.
|
| 638 |
|
|
@@ -640,7 +711,7 @@ Always independently validate high-impact financial decisions.
|
|
| 640 |
|
| 641 |
---
|
| 642 |
|
| 643 |
-
#
|
| 644 |
|
| 645 |
Nirnay is hosted on Hugging Face.
|
| 646 |
|
|
@@ -652,11 +723,20 @@ The repository contains the model implementation and supporting files required b
|
|
| 652 |
|
| 653 |
For deployment, use the provided `jev_common.py` implementation rather than assuming the model is compatible with a generic text-generation pipeline.
|
| 654 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 655 |
---
|
| 656 |
|
| 657 |
-
#
|
| 658 |
|
| 659 |
-
Nirnay explores a specialized model
|
| 660 |
|
| 661 |
Its development focuses on:
|
| 662 |
|
|
@@ -668,7 +748,9 @@ Its development focuses on:
|
|
| 668 |
- Synthetic rule-labelled decision tasks
|
| 669 |
- Efficient decision inference
|
| 670 |
|
| 671 |
-
Future
|
|
|
|
|
|
|
| 672 |
|
| 673 |
- Broader financial domain coverage
|
| 674 |
- Improved FOMC classification
|
|
@@ -683,24 +765,51 @@ These are development directions, not claims about currently implemented capabil
|
|
| 683 |
|
| 684 |
---
|
| 685 |
|
| 686 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 687 |
|
| 688 |
-
##
|
| 689 |
|
| 690 |
**Nirnay is developed by Sociodynamics AI.**
|
| 691 |
|
| 692 |
Nirnay is part of the organization's research into compact specialized AI systems and structured decision intelligence.
|
| 693 |
|
|
|
|
|
|
|
| 694 |
**Model:** Nirnay
|
| 695 |
**Parameters:** 0.8B
|
| 696 |
**Domain:** Financial Decision Intelligence
|
| 697 |
**Organization:** Sociodynamics AI
|
| 698 |
|
| 699 |
-
Hugging Face:
|
|
|
|
|
|
|
| 700 |
|
| 701 |
---
|
| 702 |
|
| 703 |
-
#
|
| 704 |
|
| 705 |
The model is distributed under the license specified in the repository.
|
| 706 |
|
|
@@ -716,6 +825,14 @@ Users are responsible for validating model outputs before using them in financia
|
|
| 716 |
|
| 717 |
---
|
| 718 |
|
| 719 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 720 |
|
| 721 |
-
|
|
|
|
| 37 |
|
| 38 |
Nirnay uses next-token logits over predefined option tokens to calculate decision probabilities. It does not require free-form natural-language generation to produce its decisions.
|
| 39 |
|
| 40 |
+
The model is a full fine-tune of `Qwen/Qwen3.5-0.8B-Base` and uses temperature calibration fitted on a held-out split.
|
| 41 |
|
| 42 |
---
|
| 43 |
|
| 44 |
+
# 1. Model Overview
|
| 45 |
|
| 46 |
| Property | Description |
|
| 47 |
|---|---|
|
|
|
|
| 60 |
| Primary language | English |
|
| 61 |
| Intended application | Financial text and state classification |
|
| 62 |
|
| 63 |
+
## 1.1 Design Philosophy
|
| 64 |
|
| 65 |
Nirnay follows a different approach from generative financial LLMs.
|
| 66 |
|
|
|
|
| 70 |
|
| 71 |
This makes the output suitable for downstream systems that need structured classification rather than unrestricted text generation.
|
| 72 |
|
| 73 |
+
### Core Architecture Flow
|
| 74 |
|
| 75 |
```text
|
| 76 |
+
Financial State
|
| 77 |
+
|
|
| 78 |
+
v
|
| 79 |
+
Nirnay 0.8B
|
| 80 |
+
|
|
| 81 |
+
v
|
| 82 |
+
Typed Decision Interface
|
| 83 |
+
|
|
| 84 |
+
+---------+---------+
|
| 85 |
+
| | |
|
| 86 |
+
v v v
|
| 87 |
+
Choice Score Noul
|
| 88 |
+
| | |
|
| 89 |
+
+---------+---------+
|
| 90 |
+
|
|
| 91 |
+
v
|
| 92 |
+
Option-token logits
|
| 93 |
+
|
|
| 94 |
+
v
|
| 95 |
+
Softmax calculation
|
| 96 |
+
|
|
| 97 |
+
v
|
| 98 |
+
Probability distributions
|
| 99 |
+
|
|
| 100 |
+
v
|
| 101 |
+
Temperature calibration
|
| 102 |
+
|
|
| 103 |
+
v
|
| 104 |
+
Structured decisions
|
| 105 |
```
|
| 106 |
|
| 107 |
---
|
| 108 |
|
| 109 |
+
# 2. Model Architecture
|
| 110 |
|
| 111 |
Nirnay is a full fine-tune of:
|
| 112 |
|
|
|
|
| 116 |
|
| 117 |
Its decision interface operates over predefined output tokens rather than relying on unrestricted text generation.
|
| 118 |
|
| 119 |
+
## 2.1 Decision Processing
|
| 120 |
|
| 121 |
+
For an input state $x$, the model processes a question $q$ and obtains logits over predefined answer tokens.
|
| 122 |
|
| 123 |
+
For a choice task with candidate options $C$, the probability distribution is calculated using temperature-scaled softmax:
|
| 124 |
|
| 125 |
+
$$
|
| 126 |
P(c_i \mid x,q) =
|
| 127 |
\frac{\exp(z_i/T)}
|
| 128 |
{\sum_{j=1}^{K}\exp(z_j/T)}
|
| 129 |
+
$$
|
| 130 |
|
| 131 |
Where:
|
| 132 |
|
| 133 |
+
- $z_i$: Logit associated with candidate option $i$.
|
| 134 |
+
- $T$: Calibration temperature.
|
| 135 |
+
- $K$: Number of candidate options.
|
| 136 |
+
- $P(c_i \mid x,q)$: Probability assigned to candidate option $i$.
|
| 137 |
|
| 138 |
The selected decision is:
|
| 139 |
|
| 140 |
+
$$
|
| 141 |
+
\hat{c} =
|
| 142 |
+
\underset{c_i \in C}{\operatorname{argmax}}
|
| 143 |
+
\; P(c_i \mid x,q)
|
| 144 |
+
$$
|
| 145 |
|
| 146 |
+
The model selects the candidate with the highest probability.
|
| 147 |
|
| 148 |
+
### Decision Processing Steps
|
| 149 |
|
| 150 |
+
1. Receive a financial state or text input.
|
| 151 |
+
2. Receive one or more typed decision questions.
|
| 152 |
+
3. Process the state and question using the model.
|
| 153 |
+
4. Extract logits corresponding to predefined answer tokens.
|
| 154 |
+
5. Calculate probability distributions.
|
| 155 |
+
6. Apply temperature calibration.
|
| 156 |
+
7. Return structured decision outputs.
|
| 157 |
|
| 158 |
+
## 2.2 Probability Calibration
|
| 159 |
+
|
| 160 |
+
Nirnay applies temperature scaling to adjust the confidence distribution of its predictions.
|
| 161 |
+
|
| 162 |
+
The calibrated probability is:
|
| 163 |
+
|
| 164 |
+
$$
|
| 165 |
+
P_T(c_i \mid x,q) =
|
| 166 |
+
\frac{\exp(z_i/T)}
|
| 167 |
+
{\sum_{j=1}^{K}\exp(z_j/T)}
|
| 168 |
+
$$
|
| 169 |
+
|
| 170 |
+
Where $T$ is the calibration temperature.
|
| 171 |
+
|
| 172 |
+
- $T > 1$: Produces a softer probability distribution.
|
| 173 |
+
- $T < 1$: Produces a sharper probability distribution.
|
| 174 |
+
- $T = 1$: Leaves the original softmax distribution unchanged.
|
| 175 |
+
|
| 176 |
+
Temperature scaling adjusts confidence without changing the ranking of candidate options when the same positive temperature is applied to all logits.
|
| 177 |
+
|
| 178 |
+
## 2.3 Typed Decision Interfaces
|
| 179 |
+
|
| 180 |
+
### A. Choice
|
| 181 |
+
|
| 182 |
+
Choice selects one option from a predefined collection.
|
| 183 |
|
| 184 |
Example:
|
| 185 |
|
|
|
|
| 195 |
}
|
| 196 |
```
|
| 197 |
|
| 198 |
+
Potential applications:
|
| 199 |
|
| 200 |
- Financial news categorization
|
| 201 |
- Event classification
|
| 202 |
- Economic topic identification
|
| 203 |
- Market event classification
|
| 204 |
|
| 205 |
+
### B. Score
|
| 206 |
|
| 207 |
+
Score classifies an input into predefined ordinal levels.
|
| 208 |
|
| 209 |
Example:
|
| 210 |
|
|
|
|
| 220 |
}
|
| 221 |
```
|
| 222 |
|
| 223 |
+
Potential applications:
|
| 224 |
|
| 225 |
- News severity classification
|
| 226 |
- Financial risk categorization
|
|
|
|
| 229 |
|
| 230 |
The score represents a selected category, not a calibrated numerical probability of a future market outcome.
|
| 231 |
|
| 232 |
+
### C. Noul
|
| 233 |
|
| 234 |
+
Noul is a binary decision interface for yes/no questions.
|
| 235 |
|
| 236 |
Example:
|
| 237 |
|
|
|
|
| 242 |
}
|
| 243 |
```
|
| 244 |
|
| 245 |
+
Potential applications:
|
| 246 |
|
| 247 |
- Positive/negative news classification
|
| 248 |
- Binary financial event classification
|
|
|
|
| 251 |
|
| 252 |
---
|
| 253 |
|
| 254 |
+
# 3. Training Methodology
|
| 255 |
+
|
| 256 |
+
Nirnay was trained using full fine-tuning of its base model.
|
| 257 |
|
| 258 |
+
The training process combines real-world financial classification datasets and synthetic, rule-labelled decision tasks.
|
| 259 |
|
| 260 |
+
## 3.1 Training Objectives
|
| 261 |
+
|
| 262 |
+
The primary training objectives include:
|
| 263 |
+
|
| 264 |
+
- Financial headline classification
|
| 265 |
+
- Financial sentiment classification
|
| 266 |
+
- Financial topic classification
|
| 267 |
+
- Monetary policy classification
|
| 268 |
+
- Binary financial decisions
|
| 269 |
+
- Ordinal decision classification
|
| 270 |
+
- Structured portfolio assessments
|
| 271 |
+
|
| 272 |
+
## 3.2 Training Data
|
| 273 |
|
| 274 |
| Dataset category | Training objective |
|
| 275 |
|---|---|
|
|
|
|
| 287 |
|
| 288 |
Additional tweet and text datasets were included only when they passed the label audit.
|
| 289 |
|
| 290 |
+
## 3.3 Real-World Financial Text
|
| 291 |
+
|
| 292 |
+
The model learns patterns from:
|
| 293 |
|
| 294 |
+
- Financial headlines
|
| 295 |
+
- News sentiment
|
| 296 |
+
- Financial phrase classification
|
| 297 |
+
- Social media financial content
|
| 298 |
+
- Monetary policy-related text
|
| 299 |
+
- Financial event topics
|
| 300 |
|
| 301 |
+
These datasets support financial text understanding and classification.
|
| 302 |
|
| 303 |
+
## 3.4 Synthetic Decision Data
|
| 304 |
|
| 305 |
Synthetic datasets provide explicitly defined decision tasks with labels generated using deterministic rules or mathematical formulas.
|
| 306 |
|
|
|
|
| 317 |
|
| 318 |
---
|
| 319 |
|
| 320 |
+
# 4. Inference and Usage
|
| 321 |
|
| 322 |
Nirnay provides a typed decision interface through `JevClassifier`.
|
| 323 |
|
| 324 |
It does not use conventional text-generation inference for its primary decision outputs.
|
| 325 |
|
| 326 |
+
## 4.1 Installation
|
| 327 |
|
| 328 |
```bash
|
| 329 |
pip install -U transformers torch huggingface_hub
|
| 330 |
```
|
| 331 |
|
| 332 |
+
## 4.2 Basic Initialization
|
| 333 |
|
| 334 |
```python
|
| 335 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 338 |
|
| 339 |
MODEL_ID = "NeoSapian/nirnay"
|
| 340 |
|
| 341 |
+
# Download the decision interface
|
| 342 |
p = hf_hub_download(
|
| 343 |
repo_id=MODEL_ID,
|
| 344 |
filename="jev_common.py"
|
| 345 |
)
|
| 346 |
|
| 347 |
+
# Load the Python module
|
| 348 |
s = importlib.util.spec_from_file_location(
|
| 349 |
"jev_common",
|
| 350 |
p
|
|
|
|
| 356 |
|
| 357 |
s.loader.exec_module(m)
|
| 358 |
|
| 359 |
+
# Initialize Nirnay
|
| 360 |
clf = m.JevClassifier(MODEL_ID)
|
| 361 |
```
|
| 362 |
|
| 363 |
+
## 4.3 Multi-Question Financial Evaluation
|
| 364 |
+
|
| 365 |
+
Nirnay can evaluate multiple decision questions against the same financial state.
|
| 366 |
+
|
| 367 |
+
Example:
|
| 368 |
|
| 369 |
```python
|
| 370 |
result = clf.decide(
|
|
|
|
| 400 |
print(result)
|
| 401 |
```
|
| 402 |
|
| 403 |
+
This example evaluates:
|
| 404 |
+
|
| 405 |
+
1. Whether the news is bearish.
|
| 406 |
+
2. Which financial topic it describes.
|
| 407 |
+
3. How severe the negative news is.
|
| 408 |
+
|
| 409 |
+
The model returns structured decision results rather than requiring a generated explanation.
|
| 410 |
+
|
| 411 |
+
## 4.4 Structured Financial State Evaluation
|
| 412 |
|
| 413 |
Nirnay can evaluate text or JSON-formatted state descriptions.
|
| 414 |
|
|
|
|
| 445 |
print(result)
|
| 446 |
```
|
| 447 |
|
| 448 |
+
This demonstrates the typed decision interface. The reliability of a portfolio assessment depends on the training distribution and should be independently validated against exact calculations.
|
| 449 |
|
| 450 |
---
|
| 451 |
|
| 452 |
+
# 5. Evaluation Methodology
|
| 453 |
|
| 454 |
Nirnay was evaluated on a held-out test set containing 7,290 examples.
|
| 455 |
|
| 456 |
+
The evaluation covers:
|
| 457 |
|
| 458 |
+
- Classification accuracy
|
| 459 |
+
- Expected Calibration Error (ECE)
|
| 460 |
+
- Brier Score
|
| 461 |
+
- Negative Log-Likelihood (NLL)
|
| 462 |
+
|
| 463 |
+
The evaluation includes overall performance, decision-type performance, and dataset-wise performance.
|
| 464 |
+
|
| 465 |
+
## 5.1 Overall Performance
|
| 466 |
|
| 467 |
| Metric | Raw | Calibrated |
|
| 468 |
|---|---:|---:|
|
|
|
|
| 471 |
| Brier Score | 0.1534 | 0.1431 |
|
| 472 |
| NLL | 0.3040 | 0.2624 |
|
| 473 |
|
| 474 |
+
### Overall Evaluation Summary
|
|
|
|
| 475 |
|
| 476 |
- Total evaluation examples: 7,290
|
| 477 |
- Raw accuracy: 89.63%
|
| 478 |
- Raw ECE: 0.0505
|
| 479 |
- Calibrated ECE: 0.0112
|
| 480 |
+
- Raw Brier Score: 0.1534
|
| 481 |
+
- Calibrated Brier Score: 0.1431
|
| 482 |
- Raw NLL: 0.3040
|
| 483 |
- Calibrated NLL: 0.2624
|
| 484 |
|
| 485 |
+
## 5.2 Performance by Decision Type
|
|
|
|
|
|
|
| 486 |
|
| 487 |
| Decision type | Samples | Accuracy | Raw ECE | Calibrated ECE |
|
| 488 |
|---|---:|---:|---:|---:|
|
|
|
|
| 490 |
| Score | 2,043 | 79.15% | 0.0898 | 0.0326 |
|
| 491 |
| Noul | 3,823 | 95.27% | 0.0278 | 0.0077 |
|
| 492 |
|
| 493 |
+
### Choice — 89.54%
|
|
|
|
|
|
|
| 494 |
|
| 495 |
The model demonstrates strong performance in selecting among predefined financial categories.
|
| 496 |
|
| 497 |
+
### Score — 79.15%
|
| 498 |
|
| 499 |
Ordinal classification is more challenging than binary classification. This remains an area for further improvement.
|
| 500 |
|
| 501 |
+
### Noul — 95.27%
|
| 502 |
|
| 503 |
Binary decision classification achieves the highest accuracy among the three evaluated decision types.
|
| 504 |
|
| 505 |
+
## 5.3 Complete Decision-Type Metrics
|
| 506 |
|
| 507 |
| Type | Brier Raw | Brier Calibrated | NLL Raw | NLL Calibrated |
|
| 508 |
|---|---:|---:|---:|---:|
|
|
|
|
| 512 |
|
| 513 |
---
|
| 514 |
|
| 515 |
+
# 6. Dataset-Wise Evaluation
|
| 516 |
|
| 517 |
The following table reports the held-out evaluation results by source category.
|
| 518 |
|
|
|
|
| 537 |
| WCB Time | 117 | 86.32% |
|
| 538 |
| WCB Uncertain | 127 | 85.04% |
|
| 539 |
|
| 540 |
+
## 6.1 Evaluation Observations
|
| 541 |
|
| 542 |
The results show different performance levels across financial classification tasks.
|
| 543 |
|
|
|
|
| 550 |
- FOMC classification achieves 67.86%.
|
| 551 |
- WCB classification achieves 66.67%.
|
| 552 |
|
| 553 |
+
Synthetic datasets have formula-generated or rule-generated labels and should be considered separately from real-world financial text benchmarks.
|
| 554 |
|
| 555 |
Some dataset slices are small. Their accuracy values should not be interpreted as stable estimates of generalization performance.
|
| 556 |
|
| 557 |
---
|
| 558 |
|
| 559 |
+
# 7. Probability Calibration
|
| 560 |
|
| 561 |
An important component of Nirnay is probability calibration.
|
| 562 |
|
|
|
|
| 566 |
|
| 567 |
Nirnay uses temperature scaling to adjust the distribution of output probabilities.
|
| 568 |
|
| 569 |
+
## 7.1 Calibration Results
|
| 570 |
|
| 571 |
| Metric | Before Calibration | After Calibration |
|
| 572 |
|---|---:|---:|
|
|
|
|
| 574 |
| Brier Score | 0.1534 | 0.1431 |
|
| 575 |
| NLL | 0.3040 | 0.2624 |
|
| 576 |
|
| 577 |
+
## 7.2 Calibration Metrics Explained
|
| 578 |
|
| 579 |
+
### Expected Calibration Error (ECE)
|
| 580 |
|
| 581 |
Measures the difference between predicted confidence and observed accuracy across confidence groups.
|
| 582 |
|
| 583 |
+
Lower ECE indicates better calibration.
|
| 584 |
|
| 585 |
+
### Brier Score
|
| 586 |
|
| 587 |
Measures the squared error between predicted probabilities and actual outcomes.
|
| 588 |
|
| 589 |
+
Lower Brier Score indicates better probabilistic accuracy.
|
| 590 |
|
| 591 |
+
### Negative Log-Likelihood (NLL)
|
| 592 |
|
| 593 |
Measures how much probability the model assigns to the correct outcomes.
|
| 594 |
|
| 595 |
+
Lower NLL indicates better probabilistic performance.
|
| 596 |
|
| 597 |
+
## 7.3 Calibration Limitations
|
| 598 |
|
| 599 |
Calibration was measured on a held-out distribution.
|
| 600 |
|
|
|
|
| 610 |
|
| 611 |
---
|
| 612 |
|
| 613 |
+
# 8. Intended Applications
|
| 614 |
|
| 615 |
Nirnay is intended to serve as a structured decision component inside larger financial software systems.
|
| 616 |
|
| 617 |
+
## 8.1 Financial News Intelligence
|
| 618 |
|
| 619 |
+
Potential applications:
|
| 620 |
|
| 621 |
- Headline classification
|
| 622 |
- Financial sentiment classification
|
|
|
|
| 624 |
- News topic categorization
|
| 625 |
- Binary news assessments
|
| 626 |
|
| 627 |
+
## 8.2 Financial Risk Classification
|
| 628 |
+
|
| 629 |
+
Potential applications:
|
| 630 |
|
| 631 |
- Predefined risk-category classification
|
| 632 |
- Ordinal severity assessment
|
| 633 |
- Portfolio state categorization
|
| 634 |
- Structured risk-screening workflows
|
| 635 |
|
| 636 |
+
## 8.3 Portfolio Analytics
|
| 637 |
+
|
| 638 |
+
Potential applications:
|
| 639 |
|
| 640 |
- Portfolio concentration classification
|
| 641 |
- Portfolio drift categorization
|
|
|
|
| 644 |
|
| 645 |
For arithmetic-heavy portfolio calculations, use deterministic financial computation and use Nirnay as a classification layer.
|
| 646 |
|
| 647 |
+
## 8.4 Financial Decision Pipelines
|
| 648 |
|
| 649 |
Nirnay can be integrated into pipelines that combine:
|
| 650 |
|
|
|
|
| 657 |
|
| 658 |
---
|
| 659 |
|
| 660 |
+
# 9. What Nirnay Is Not
|
| 661 |
|
| 662 |
Nirnay is not a conventional generative financial chatbot.
|
| 663 |
|
|
|
|
| 679 |
|
| 680 |
---
|
| 681 |
|
| 682 |
+
# 10. Limitations and Responsible Use
|
| 683 |
|
| 684 |
Users should consider the following limitations before deploying Nirnay.
|
| 685 |
|
| 686 |
+
### Training Distribution
|
| 687 |
|
| 688 |
The model's performance depends on the similarity between deployment data and training data.
|
| 689 |
|
| 690 |
+
### Synthetic Data
|
| 691 |
|
| 692 |
Portfolio and other synthetic tasks use rule-generated labels. High accuracy on those tasks does not independently establish real-world financial expertise.
|
| 693 |
|
| 694 |
+
### Calibration
|
| 695 |
|
| 696 |
Probability calibration is distribution-dependent and may degrade under distribution shift.
|
| 697 |
|
| 698 |
+
### Arithmetic
|
| 699 |
|
| 700 |
Exact financial calculations should be performed using deterministic code.
|
| 701 |
|
| 702 |
+
### Decision Definitions
|
| 703 |
|
| 704 |
Choice and score outputs depend on the criteria and levels supplied by the user.
|
| 705 |
|
| 706 |
+
### Financial Safety
|
| 707 |
|
| 708 |
Nirnay should be used as a decision-support component, not as an autonomous investment authority.
|
| 709 |
|
|
|
|
| 711 |
|
| 712 |
---
|
| 713 |
|
| 714 |
+
# 11. Model Deployment
|
| 715 |
|
| 716 |
Nirnay is hosted on Hugging Face.
|
| 717 |
|
|
|
|
| 723 |
|
| 724 |
For deployment, use the provided `jev_common.py` implementation rather than assuming the model is compatible with a generic text-generation pipeline.
|
| 725 |
|
| 726 |
+
### Deployment Considerations
|
| 727 |
+
|
| 728 |
+
- Load the model using its provided classifier interface.
|
| 729 |
+
- Use the correct tokenizer and model configuration.
|
| 730 |
+
- Preserve the typed decision interface.
|
| 731 |
+
- Apply the appropriate calibration configuration.
|
| 732 |
+
- Validate input and output formats.
|
| 733 |
+
- Independently validate high-impact decisions.
|
| 734 |
+
|
| 735 |
---
|
| 736 |
|
| 737 |
+
# 12. Research and Development
|
| 738 |
|
| 739 |
+
Nirnay explores a specialized model and inference approach for structured financial decision-making.
|
| 740 |
|
| 741 |
Its development focuses on:
|
| 742 |
|
|
|
|
| 748 |
- Synthetic rule-labelled decision tasks
|
| 749 |
- Efficient decision inference
|
| 750 |
|
| 751 |
+
### Future Development Directions
|
| 752 |
+
|
| 753 |
+
Potential future improvements include:
|
| 754 |
|
| 755 |
- Broader financial domain coverage
|
| 756 |
- Improved FOMC classification
|
|
|
|
| 765 |
|
| 766 |
---
|
| 767 |
|
| 768 |
+
# 13. Technical Summary
|
| 769 |
+
|
| 770 |
+
| Component | Specification |
|
| 771 |
+
|---|---|
|
| 772 |
+
| Model name | Nirnay |
|
| 773 |
+
| Model repository | NeoSapian/nirnay |
|
| 774 |
+
| Parameters | 0.8B |
|
| 775 |
+
| Base architecture | Qwen3.5-0.8B-Base |
|
| 776 |
+
| Fine-tuning | Full fine-tuning |
|
| 777 |
+
| Decision interface | Typed classification |
|
| 778 |
+
| Choice | Supported |
|
| 779 |
+
| Score | Supported |
|
| 780 |
+
| Noul | Supported |
|
| 781 |
+
| Probability output | Supported |
|
| 782 |
+
| Temperature calibration | Supported |
|
| 783 |
+
| Free-form text generation | Not the intended inference interface |
|
| 784 |
+
| Evaluation examples | 7,290 |
|
| 785 |
+
| Overall accuracy | 89.63% |
|
| 786 |
+
| Calibrated ECE | 0.0112 |
|
| 787 |
+
| Developer | Sociodynamics AI |
|
| 788 |
+
|
| 789 |
+
---
|
| 790 |
+
|
| 791 |
+
# 14. Developer
|
| 792 |
|
| 793 |
+
## Sociodynamics AI
|
| 794 |
|
| 795 |
**Nirnay is developed by Sociodynamics AI.**
|
| 796 |
|
| 797 |
Nirnay is part of the organization's research into compact specialized AI systems and structured decision intelligence.
|
| 798 |
|
| 799 |
+
The project explores how smaller language models can be adapted to perform specialized classification and decision tasks with structured probabilistic outputs.
|
| 800 |
+
|
| 801 |
**Model:** Nirnay
|
| 802 |
**Parameters:** 0.8B
|
| 803 |
**Domain:** Financial Decision Intelligence
|
| 804 |
**Organization:** Sociodynamics AI
|
| 805 |
|
| 806 |
+
Hugging Face:
|
| 807 |
+
|
| 808 |
+
https://huggingface.co/NeoSapian/nirnay
|
| 809 |
|
| 810 |
---
|
| 811 |
|
| 812 |
+
# 15. License and Disclaimer
|
| 813 |
|
| 814 |
The model is distributed under the license specified in the repository.
|
| 815 |
|
|
|
|
| 825 |
|
| 826 |
---
|
| 827 |
|
| 828 |
+
<div align="center">
|
| 829 |
+
|
| 830 |
+
# NIRNAY
|
| 831 |
+
|
| 832 |
+
### Structured Intelligence for Financial Decisions.
|
| 833 |
+
|
| 834 |
+
**Developed by Sociodynamics AI**
|
| 835 |
+
|
| 836 |
+
A compact 0.8B typed financial decision intelligence model.
|
| 837 |
|
| 838 |
+
</div>
|