File size: 5,287 Bytes
fec845c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
07e900f
24d6ee9
2d3cd81
 
 
09ef70f
24d6ee9
09ef70f
24d6ee9
09ef70f
24d6ee9
09ef70f
 
 
 
 
 
24d6ee9
09ef70f
24d6ee9
 
09ef70f
24d6ee9
09ef70f
24d6ee9
 
 
 
 
 
09ef70f
24d6ee9
 
09ef70f
 
24d6ee9
 
 
09ef70f
24d6ee9
 
 
 
 
 
09ef70f
24d6ee9
09ef70f
24d6ee9
09ef70f
24d6ee9
09ef70f
24d6ee9
c902cdc
24d6ee9
09ef70f
24d6ee9
 
 
09ef70f
 
 
 
 
 
 
 
 
 
 
 
 
24d6ee9
 
09ef70f
24d6ee9
 
 
 
 
 
 
 
09ef70f
24d6ee9
09ef70f
24d6ee9
09ef70f
24d6ee9
09ef70f
24d6ee9
09ef70f
24d6ee9
09ef70f
24d6ee9
09ef70f
 
6d82af7
09ef70f
 
 
 
 
24d6ee9
09ef70f
24d6ee9
09ef70f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
license: mit
datasets:
- sujet-ai/Sujet-Financial-RAG-FR-Dataset
language:
- fr
metrics:
- accuracy
pipeline_tag: sentence-similarity
tags:
- finance
- embedding
- embedding model
- financial qa
- french embedding model
- sentence transformers
- financial rag
---
# Marsilia-Embeddings-FR-Large 🚀

<img src="eval_fr.jpg" width="1500" height="1000">


## Introduction 🌟

Marsilia-Embeddings-FR-Large is a state-of-the-art French language embedding model specifically designed for financial domain tasks. This model serves as a proof of concept, demonstrating the critical importance of fine-tuning embedding models for specific tasks in Retrieval-Augmented Generation (RAG) applications. 

By focusing on the financial domain, Marsilia-Embeddings-FR-Large achieves performance that surpasses even closed-source models like OpenAI's embeddings, while offering a more cost-effective solution. This showcases how targeted fine-tuning can dramatically enhance the capabilities of open-source models, making them competitive with or even superior to proprietary alternatives in specialized domains.

## Model Details 📊

- **Model Name:** Marsilia-Embeddings-FR-Large
- **Model Type:** Sentence Embedding Model
- **Language:** French 🇫🇷
- **Base Model:** [OrdalieTech/Solon-embeddings-large-0.1](https://huggingface.co/OrdalieTech/Solon-embeddings-large-0.1)
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 1024
- **Similarity Function:** Cosine Similarity

## Usage 💻

To use this model with the Sentence Transformers library:

```python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("sujet-ai/Marsilia-Embeddings-FR-Large")

# Run inference
sentences = [
    'Quelles mesures à caractère non strictement comptable sont mentionnées dans le rapport financier de Vivendi ?',
    "mercredi 8 mars 2023 Rapport financier et États financiers consolidés audités de l'exercice clos le 31 décembre 2022 Vivendi / 6 I- Rapport financier de l'exercice 2022 Notes préliminaires : Le 6 mars 2023, le présent rapport financier et les états financiers consolidés audités de l'exercice clos le 31 décembre 2022 ont été arrêtés par le Directoire. Après avis du Comité d'audit qui s'est réuni le 6 mars 2023, le Conseil de surveillance du 8 mars 2023 a exa miné le rapport financier et les états financiers consolidés audités de l'exercice clos le 31 décembre 2022, tels qu'arrêtés par le Directoire du 6 mars 2023. Les états financiers consolidés de l'exercice clos le 31 décembre 2022 sont audités et certifiés sans réserve par les Commissai res aux comptes. Leur rapport sur la certification des états financiers consolidés est présenté en préambule des états financiers.",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [2, 1024]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
```

## Intended Use 🎯

This model is designed for generating sentence embeddings for French text, particularly in the financial domain. It can be used for various natural language processing tasks such as semantic search, clustering, and information retrieval.

## Training Data 📚

The model was fine-tuned on the [sujet-ai/Sujet-Financial-RAG-FR-Dataset](https://huggingface.co/datasets/sujet-ai/Sujet-Financial-RAG-FR-Dataset). This dataset consists of question-context pairs in French, focusing on financial topics.

- **Training Set Size:** 28,880 samples

## Training Procedure 🛠️

### Training Hyperparameters

- **Loss Function:** MultipleNegativesRankingLoss
  - Scale: 20.0
  - Similarity Function: Cosine Similarity
- **Evaluation Strategy:** Steps
- **Per Device Train Batch Size:** 32
- **Gradient Accumulation Steps:** 16
- **Per Device Eval Batch Size:** 16
- **TF32:** True
- **BF16:** True
- **Number of Train Epochs:** 5
- **Batch Sampler:** no_duplicates
- **Multi Dataset Batch Sampler:** round_robin
- **Scheduler:** warmupcosine

### Framework Versions

- Python: 3.10.13
- Sentence Transformers: 3.0.1
- Transformers: 4.42.3
- PyTorch: 2.5.0.dev20240704+cu124
- Accelerate: 0.32.1
- Datasets: 2.20.0
- Tokenizers: 0.19.1

## Evaluation 📈

The model was evaluated using the `InformationRetrievalEvaluator` on the test split of the sujet-ai/Sujet-Financial-RAG-FR-Dataset. Specific evaluation metrics are not provided in the given information.

## Limitations ⚠️

The model is specifically trained on French financial texts and may not perform optimally on other domains or languages. Users should be aware of potential biases present in the training data.

## Citation 📄

If you use this model in your research, please cite:

```bibtex
@software{Marsilia-Embeddings-FR-Large,
  author = {Sujet AI, Allaa Boutaleb, Hamed Rahimi},
  title = {Marsilia-Embeddings-FR-Large: A fine-tuned French embedding model for financial texts},
  year = {2024},
  url = {https://huggingface.co/sujet-ai/Marsilia-Embeddings-FR-Large}
}
```

## Contact Information 📧

For questions, feedback, or collaborations, please reach out to us on [LinkedIn](https://www.linkedin.com/company/sujet-ai/) or visit our website [https://sujet.ai](https://sujet.ai).