Model reference · open weights
finance-embeddings-investopedia is an open-weight embedding model from FinLang. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.
Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.
What it is
| Released by | FinLang |
|---|---|
| Type | Embedding models |
| Task | Embeddings |
| Parameters (lead) | 109M |
| Context | 512 tokens |
| Runs with | sentence-transformers |
| Released | 2024-04-22 |
| Popularity | 12k downloads / month |
| Licence | Commercial licence needed |
About
This is the Investopedia embedding for finance application by the FinLang team. The model is trained using our open-sourced finance dataset from https://huggingface.co/datasets/FinLang/investopedia-embedding-dataset
This is a finetuned embedding model on top of BAAI/bge-base-en-v1.5. It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search in RAG applications.
This project is for research purposes only. Third-party datasets may be subject to additional terms and conditions under their associated licenses.
Simply specify the Finlang embedding during the indexing procedure for your Financial RAG applications.
from llama_index.embeddings import HuggingFaceEmbedding
embed_model = HuggingFaceEmbedding(model_name="FinLang/investopedia_embedding")
Using this model becomes easy when you have sentence-transformers installed (see https://huggingface.co/sentence-transformers):
pip install -U sentence-transformers
Then you can use the model like this:
from sentence_transformers import SentenceTransformer
sentences = ["This is an example sentence", "Each sentence is converted"]
model = SentenceTransformer('FinLang/investopedia_embedding')
embeddings = model.encode(sentences)
print(embeddings)
Example code testing:
from sentence_transformers import SentenceTransformer, util
model = SentenceTransformer("FinLang/investopedia_embedding")
query_1 = "What is a potential concern with allowing someone else to store your cryptocurrency keys, and is it possible to decrypt a private key?"
query_2 = "A potential concern is that the entity holding your keys has control over your cryptocurrency in a custodial relationship. While it is theoretically possible to decrypt a private key, with current technology, it would take centuries or millennia for the 115 quattuorvigintillion possibilities. Most hacks and thefts occur in wallets, where private keys are stored."
embedding_1 = model.encode(query_1)
embedding_2 = model.encode(query_2)
scores = (embedding_1*embedding_2).sum()
print(scores) # 0.862
We evaluate our model on unseen pairs of sentences for similarity and unseen shuffled pairs of sentences for dissimilarity. Our evaluation suite contains sentence pairs from: Investopedia (to test for proficiency on finance), and Gooaq, MSMARCO,stackexchange_duplicate_questions_title_title, yahoo_answers_title_answer (to evaluate models ability to avoid forgetting after finetuning).
Since non-commercial datasets are used for fine-tuning, we release this model as cc-by-nc-4.0.
From the published model card. Full card on the HuggingFace links in the sidebar.
Using it via the API
Once AxForge deploys finance-embeddings-investopedia for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (finance-embeddings-investopedia below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/embeddings \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"finance-embeddings-investopedia","input":"text to embed"}'
Create an account — your API key is available in the console. 3M free tokens every 30 days with every new account.