---
language:
- en
license: apache-2.0
tags:
- sentence-transformers
- multi-vector
- colbert
- late-interaction
- generated_from_trainer
- dataset_size:3475
- loss:MultiVectorMultipleNegativesRankingLoss
base_model: vidore/colqwen2-v1.0-hf
widget:
- text: What is the aim of this book according to the introduction?
- text: What is the purpose of a wet-bulb thermometer in a sling psychrometer?
- text: What are the different switching states for DCC and FCC topologies of a converter?
- text: What is the topic discussed in this page?
- text: What do these graphs show?
datasets:
- vidore/syntheticDocQA_energy_train
pipeline_tag: feature-extraction
library_name: sentence-transformers
metrics:
- maxsim_accuracy@1
- maxsim_accuracy@3
- maxsim_accuracy@5
- maxsim_accuracy@10
- maxsim_precision@1
- maxsim_precision@3
- maxsim_precision@5
- maxsim_precision@10
- maxsim_recall@1
- maxsim_recall@3
- maxsim_recall@5
- maxsim_recall@10
- maxsim_ndcg@10
- maxsim_mrr@10
- maxsim_map@100
model-index:
- name: colqwen2-v1.0-hf finetuned on energy document pages
results:
- task:
type: multi-vector-information-retrieval
name: Multi Vector Information Retrieval
dataset:
name: energy dev
type: energy-dev
metrics:
- type: maxsim_accuracy@1
value: 0.935
name: Maxsim Accuracy@1
- type: maxsim_accuracy@3
value: 0.9675
name: Maxsim Accuracy@3
- type: maxsim_accuracy@5
value: 0.9725
name: Maxsim Accuracy@5
- type: maxsim_accuracy@10
value: 0.9825
name: Maxsim Accuracy@10
- type: maxsim_precision@1
value: 0.935
name: Maxsim Precision@1
- type: maxsim_precision@3
value: 0.3225
name: Maxsim Precision@3
- type: maxsim_precision@5
value: 0.1945
name: Maxsim Precision@5
- type: maxsim_precision@10
value: 0.09824999999999999
name: Maxsim Precision@10
- type: maxsim_recall@1
value: 0.935
name: Maxsim Recall@1
- type: maxsim_recall@3
value: 0.9675
name: Maxsim Recall@3
- type: maxsim_recall@5
value: 0.9725
name: Maxsim Recall@5
- type: maxsim_recall@10
value: 0.9825
name: Maxsim Recall@10
- type: maxsim_ndcg@10
value: 0.9592186005800499
name: Maxsim Ndcg@10
- type: maxsim_mrr@10
value: 0.9517777777777776
name: Maxsim Mrr@10
- type: maxsim_map@100
value: 0.952218176489611
name: Maxsim Map@100
---
# colqwen2-v1.0-hf finetuned on energy document pages
This is a [Multi-Vector Encoder](https://www.sbert.net/docs/multi_vector_encoder/usage/usage.html) model finetuned from [vidore/colqwen2-v1.0-hf](https://huggingface.co/vidore/colqwen2-v1.0-hf) on the [synthetic_doc_qa_energy_train](https://huggingface.co/datasets/vidore/syntheticDocQA_energy_train) dataset using the [sentence-transformers](https://www.SBERT.net) library. It maps inputs to sequences of 128-dimensional token-level vectors and scores them with late interaction (MaxSim), useful for semantic search with late interaction.
## Model Details
### Model Description
- **Model Type:** Multi-Vector Encoder
- **Base model:** [vidore/colqwen2-v1.0-hf](https://huggingface.co/vidore/colqwen2-v1.0-hf)
- **Maximum Sequence Length:** 32768 tokens
- **Output Dimensionality:** 128 dimensions
- **Similarity Function:** maxsim
- **Supported Modalities:** Text, Image
- **Training Dataset:**
- [synthetic_doc_qa_energy_train](https://huggingface.co/datasets/vidore/syntheticDocQA_energy_train)
- **Language:** en
- **License:** apache-2.0
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Documentation:** [Multi-Vector Encoder Documentation](https://www.sbert.net/docs/multi_vector_encoder/usage/usage.html)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
- **Hugging Face:** [Multi-Vector Encoders on Hugging Face](https://huggingface.co/models?library=sentence-transformers&other=multi-vector)
### Full Model Architecture
```
MultiVectorEncoder(
(0): Transformer({'transformer_task': 'retrieval', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'embeddings'}, 'image': {'method': 'forward', 'method_output_name': 'embeddings'}}, 'module_output_name': 'token_embeddings', 'architecture': 'ColQwen2ForRetrieval'})
(1): MultiVectorMask({'skiplist_words': [], 'keep_only_token_ids': None})
)
```
## Usage
### Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
```bash
pip install -U sentence-transformers
```
Then you can load this model and run inference.
```python
from sentence_transformers import MultiVectorEncoder
# Download from the 🤗 Hub
model = MultiVectorEncoder("tomaarsen/multivector-colqwen2-v1.0-hf-docqa-energy")
# Run inference: each input becomes a sequence of per-token vectors (variable length).
queries = [
'What topics are covered in this index?',
]
documents = [
'https://huggingface.co/tomaarsen/multivector-colqwen2-v1.0-hf-docqa-energy/resolve/main/assets/image_0.jpg',
'https://huggingface.co/tomaarsen/multivector-colqwen2-v1.0-hf-docqa-energy/resolve/main/assets/image_1.jpg',
'https://huggingface.co/tomaarsen/multivector-colqwen2-v1.0-hf-docqa-energy/resolve/main/assets/image_2.jpg',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings[0].shape, document_embeddings[0].shape)
# (20, 128) (759, 128)
# Get the MaxSim similarity scores
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[15.7523, 8.2611, 11.6049]])
```
## Evaluation
### Metrics
#### Multi Vector Information Retrieval
* Dataset: `energy-dev`
* Evaluated with [MultiVectorInformationRetrievalEvaluator](https://sbert.net/docs/package_reference/multi_vector_encoder/evaluation.html#sentence_transformers.multi_vector_encoder.evaluation.MultiVectorInformationRetrievalEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| maxsim_accuracy@1 | 0.935 |
| maxsim_accuracy@3 | 0.9675 |
| maxsim_accuracy@5 | 0.9725 |
| maxsim_accuracy@10 | 0.9825 |
| maxsim_precision@1 | 0.935 |
| maxsim_precision@3 | 0.3225 |
| maxsim_precision@5 | 0.1945 |
| maxsim_precision@10 | 0.0982 |
| maxsim_recall@1 | 0.935 |
| maxsim_recall@3 | 0.9675 |
| maxsim_recall@5 | 0.9725 |
| maxsim_recall@10 | 0.9825 |
| **maxsim_ndcg@10** | **0.9592** |
| maxsim_mrr@10 | 0.9518 |
| maxsim_map@100 | 0.9522 |
## Training Details
### Training Dataset
#### synthetic_doc_qa_energy_train
* Dataset: [synthetic_doc_qa_energy_train](https://huggingface.co/datasets/vidore/syntheticDocQA_energy_train) at [438dd85](https://huggingface.co/datasets/vidore/syntheticDocQA_energy_train/tree/438dd859839b0a48eba43c0e9f853195f2e61384)
* Size: 3,475 training samples
* Columns: query and image
* Approximate statistics based on the first 100 samples:
| | query | image |
|:---------|:-----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------|
| type | string | image |
| modality | text | image |
| details |
What is the objective of the research task related to reactor pressure vessel steels? |
|
| What recommendations does this study make regarding energy policy options? |
|
| What are the typical materials used for the cathode, electrolyte, and anode in conventional solid-state batteries? |
|
* Loss: [MultiVectorMultipleNegativesRankingLoss](https://sbert.net/docs/package_reference/multi_vector_encoder/losses.html#multivectormultiplenegativesrankingloss) with these parameters:
```json
{
"score_metric": "colbert_scores",
"scale": 1.0,
"score_mini_batch_size": null,
"size_average": true,
"gather_across_devices": false
}
```
### Evaluation Dataset
#### synthetic_doc_qa_energy_train
* Dataset: [synthetic_doc_qa_energy_train](https://huggingface.co/datasets/vidore/syntheticDocQA_energy_train) at [438dd85](https://huggingface.co/datasets/vidore/syntheticDocQA_energy_train/tree/438dd859839b0a48eba43c0e9f853195f2e61384)
* Size: 400 evaluation samples
* Columns: query and image
* Approximate statistics based on the first 100 samples:
| | query | image |
|:---------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------|
| type | string | image |
| modality | text | image |
| details | What topics are covered in this index? |
|
| What are the different funding sources for projects listed in the table? |
|
| What are the main sections covered in this report? |
|
* Loss: [MultiVectorMultipleNegativesRankingLoss](https://sbert.net/docs/package_reference/multi_vector_encoder/losses.html#multivectormultiplenegativesrankingloss) with these parameters:
```json
{
"score_metric": "colbert_scores",
"scale": 1.0,
"score_mini_batch_size": null,
"size_average": true,
"gather_across_devices": false
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `num_train_epochs`: 1
- `learning_rate`: 2e-05
- `warmup_steps`: 0.05
- `bf16`: True
- `save_only_model`: True
- `load_best_model_at_end`: True
#### All Hyperparameters