Downloads · 30 days
10
12% of all-time downloads
adammoood/finance-minilm-l6-v2
finance-minilm-l6-v2 is a feature extraction model from adammoood. Use it when you need embeddings to search or compare text. It is set up for transformers. The card lists the license as apache-2.0.
A vocabulary-expanded version of sentence-transformers/all-MiniLM-L6-v2 adapted to the finance domain via embedding surgery.
Downloads · 30 days
10
12% of all-time downloads
All-time downloads
84
Public
Parameters
22.7M
90.9 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors90.9 MB · 99%
From the Hugging Face model README
A vocabulary-expanded version of sentence-transformers/all-MiniLM-L6-v2 adapted to the finance domain via embedding surgery.
The base model's 30,522-token WordPiece vocabulary splits core finance terminology into subword fragments (e.g. securitization → sec ##uri ##ti ##zation). This model adds 15 finance terms as single tokens with their own embeddings, leaving everything else untouched.
securitization, collateralized, counterparty, underwriting, hedging, liquidity, volatility, amortization, refinancing, receivables, covenants, tranche, escrow, annuity, actuarial
| Base model | This model | |
|---|---|---|
| Vocabulary size | 30,522 | 30,537 |
securitization | sec ##uri ##ti ##zation | securitization |
counterparty | counterpart ##y | counterparty |
tokenizer.add_tokens(...) expanded the vocabulary; model.resize_token_embeddings(...) grew the embedding matrix.No further fine-tuning has been applied; the new embeddings are initializations intended as a starting point for domain fine-tuning.
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("adammoood/finance-minilm-l6-v2")
model = AutoModel.from_pretrained("adammoood/finance-minilm-l6-v2")
model.eval()
sentences = ["The bank improved its liquidity through securitization of receivables."]
enc = tokenizer(sentences, padding=True, truncation=True, return_tensors="pt")
with torch.no_grad():
out = model(**enc)
# Mean pooling + normalization, as in the base model
mask = enc["attention_mask"].unsqueeze(-1).float()
embeddings = F.normalize((out.last_hidden_state * mask).sum(1) / mask.sum(1), dim=1)
tokenizer.tokenize("The tranche was collateralized to reduce counterparty risk.")
# ['the', 'tranche', 'was', 'collateralized', 'to', 'reduce', 'counterparty', 'risk', '.']