nesoai/multivector-colqwen2-v1.0-hf-docqa-energy
colqwen2-v1.0-hf finetuned on energy document pages
This is a Multi-Vector Encoder model finetuned from vidore/colqwen2-v1.0-hf on the synthetic_doc_qa_energy_train dataset using the sentence-transformers 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 <!-- at revision 0d3e414967fde994dd99a0ccc29bcb34b5355712 -->
- Maximum Sequence Length: 32768 tokens
- Output Dimensionality: 128 dimensions
- Similarity Function: maxsim
- Supported Modalities: Text, Image
- Training Dataset:
- synthetic_doc_qa_energy_train
- Language: en
- License: apache-2.0
Model Sources
- Documentation: Sentence Transformers Documentation
- Documentation: Multi-Vector Encoder Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Multi-Vector Encoders on Hugging Face
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:
pip install -U sentence-transformersThen you can load this model and run inference.
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]])<!--
Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details> -->
<!--
Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details> -->
<!--
Out-of-Scope Use
List how the model may foreseeably be misused and address what users ought not to do with the model. -->
Evaluation
Metrics
Multi Vector Information Retrieval
- Dataset:
energy-dev - Evaluated with <code>MultiVectorInformationRetrievalEvaluator</code>
<!--
Bias, Risks and Limitations
What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->
<!--
Recommendations
What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->
Training Details
Training Dataset
syntheticdocqaenergytrain
- Dataset: synthetic_doc_qa_energy_train at 438dd85
- Size: 3,475 training samples
- Columns: <code>query</code> and <code>image</code>
- Approximate statistics based on the first 100 samples: | | query | image | |:---------|:-----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------| | type | string | image | | modality | text | image | | details | <ul><li>min: 18 tokens</li><li>mean: 28.12 tokens</li><li>max: 48 tokens</li></ul> | <ul><li>min: 932x312 px</li><li>mean: 1717x2057 px</li><li>max: 3200x2339 px</li></ul> |
- Samples: | query | image | |:--------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------| | <code>What is the objective of the research task related to reactor pressure vessel steels?</code> | <img src="https://huggingface.co/tomaarsen/multivector-colqwen2-v1.0-hf-docqa-energy/resolve/main/assets/exampleimage0.jpg" width="200"> | | <code>What recommendations does this study make regarding energy policy options?</code> | <img src="https://huggingface.co/tomaarsen/multivector-colqwen2-v1.0-hf-docqa-energy/resolve/main/assets/exampleimage1.jpg" width="200"> | | <code>What are the typical materials used for the cathode, electrolyte, and anode in conventional solid-state batteries?</code> | <img src="https://huggingface.co/tomaarsen/multivector-colqwen2-v1.0-hf-docqa-energy/resolve/main/assets/exampleimage2.jpg" width="200"> |
- Loss: <code>MultiVectorMultipleNegativesRankingLoss</code> with these parameters:
{
"score_metric": "colbert_scores",
"scale": 1.0,
"score_mini_batch_size": null,
"size_average": true,
"gather_across_devices": false
}Evaluation Dataset
syntheticdocqaenergytrain
- Dataset: synthetic_doc_qa_energy_train at 438dd85
- Size: 400 evaluation samples
- Columns: <code>query</code> and <code>image</code>
- Approximate statistics based on the first 100 samples: | | query | image | |:---------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------| | type | string | image | | modality | text | image | | details | <ul><li>min: 18 tokens</li><li>mean: 27.27 tokens</li><li>max: 44 tokens</li></ul> | <ul><li>min: 827x1125 px</li><li>mean: 1728x2103 px</li><li>max: 3400x3042 px</li></ul> |
- Samples: | query | image | |:--------------------------------------------------------------------------------------|:-------------------------------------------| | <code>What topics are covered in this index?</code> | <img src="https://huggingface.co/tomaarsen/multivector-colqwen2-v1.0-hf-docqa-energy/resolve/main/assets/image0.jpg" width="200"> | | <code>What are the different funding sources for projects listed in the table?</code> | <img src="https://huggingface.co/tomaarsen/multivector-colqwen2-v1.0-hf-docqa-energy/resolve/main/assets/image1.jpg" width="200"> | | <code>What are the main sections covered in this report?</code> | <img src="https://huggingface.co/tomaarsen/multivector-colqwen2-v1.0-hf-docqa-energy/resolve/main/assets/image_2.jpg" width="200"> |
- Loss: <code>MultiVectorMultipleNegativesRankingLoss</code> with these parameters:
{
"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: 1learning_rate: 2e-05warmup_steps: 0.05bf16: Truesave_only_model: Trueload_best_model_at_end: True
All Hyperparameters
<details><summary>Click to expand</summary>
per_device_train_batch_size: 8num_train_epochs: 1max_steps: -1learning_rate: 2e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0.05optim: adamwtorchfusedoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1.0label_smoothing_factor: 0.0bf16: Truefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 8prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Truesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Trueignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 0dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Noneremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: Nonefsdp_config: Nonedeepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonewarmup_ratio: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}max_length: None
</details>
Training Logs
- The bold row denotes the saved checkpoint.
Training Time
- Training: 14.2 minutes
- Evaluation: 24.0 minutes
- Total: 38.2 minutes
Framework Versions
- Python: 3.11.13
- Sentence Transformers: 5.7.0.dev0
- Transformers: 5.14.1
- PyTorch: 2.11.0+cu128
- Accelerate: 1.5.2
- Datasets: 3.5.0
- Tokenizers: 0.22.2
Citation
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}MultiVectorMultipleNegativesRankingLoss
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}<!--
Glossary
Clearly define terms in order to be accessible across audiences. -->
<!--
Model Card Authors
Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->
<!--
Model Card Contact
Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->
