CoolFace
Modelpublic

nesoai/multivector-colqwen2-v1.0-hf-docqa-energy

sourceHugging Faceapache-2.0updated 12d agoView on Hugging Face
0likes20downloads
Model Card

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

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]])

<!--

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
MetricValue
maxsim_accuracy@10.935
maxsim_accuracy@30.9675
maxsim_accuracy@50.9725
maxsim_accuracy@100.9825
maxsim_precision@10.935
maxsim_precision@30.3225
maxsim_precision@50.1945
maxsim_precision@100.0982
maxsim_recall@10.935
maxsim_recall@30.9675
maxsim_recall@50.9725
maxsim_recall@100.9825
maxsim_ndcg@100.9592
maxsim_mrr@100.9518
maxsim_map@1000.9522

<!--

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:
json
  {
      "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:
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

<details><summary>Click to expand</summary>

  • —per_device_train_batch_size: 8
  • —num_train_epochs: 1
  • —max_steps: -1
  • —learning_rate: 2e-05
  • —lr_scheduler_type: linear
  • —lr_scheduler_kwargs: None
  • —warmup_steps: 0.05
  • —optim: adamwtorchfused
  • —optim_args: None
  • —weight_decay: 0.0
  • —adam_beta1: 0.9
  • —adam_beta2: 0.999
  • —adam_epsilon: 1e-08
  • —optim_target_modules: None
  • —gradient_accumulation_steps: 1
  • —average_tokens_across_devices: True
  • —max_grad_norm: 1.0
  • —label_smoothing_factor: 0.0
  • —bf16: True
  • —fp16: False
  • —bf16_full_eval: False
  • —fp16_full_eval: False
  • —tf32: None
  • —gradient_checkpointing: False
  • —gradient_checkpointing_kwargs: None
  • —torch_compile: False
  • —torch_compile_backend: None
  • —torch_compile_mode: None
  • —use_liger_kernel: False
  • —liger_kernel_config: None
  • —use_cache: False
  • —neftune_noise_alpha: None
  • —torch_empty_cache_steps: None
  • —auto_find_batch_size: False
  • —log_on_each_node: True
  • —logging_nan_inf_filter: True
  • —include_num_input_tokens_seen: no
  • —log_level: passive
  • —log_level_replica: warning
  • —disable_tqdm: False
  • —project: huggingface
  • —trackio_space_id: None
  • —trackio_bucket_id: None
  • —trackio_static_space_id: None
  • —per_device_eval_batch_size: 8
  • —prediction_loss_only: True
  • —eval_on_start: False
  • —eval_do_concat_batches: True
  • —eval_use_gather_object: False
  • —eval_accumulation_steps: None
  • —include_for_metrics: []
  • —batch_eval_metrics: False
  • —save_only_model: True
  • —save_on_each_node: False
  • —enable_jit_checkpoint: False
  • —push_to_hub: False
  • —hub_private_repo: None
  • —hub_model_id: None
  • —hub_strategy: every_save
  • —hub_always_push: False
  • —hub_revision: None
  • —load_best_model_at_end: True
  • —ignore_data_skip: False
  • —restore_callback_states_from_checkpoint: False
  • —full_determinism: False
  • —seed: 42
  • —data_seed: None
  • —use_cpu: False
  • —accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • —parallelism_config: None
  • —dataloader_drop_last: False
  • —dataloader_num_workers: 0
  • —dataloader_pin_memory: True
  • —dataloader_persistent_workers: False
  • —dataloader_prefetch_factor: None
  • —remove_unused_columns: True
  • —label_names: None
  • —train_sampling_strategy: random
  • —length_column_name: length
  • —ddp_find_unused_parameters: None
  • —ddp_bucket_cap_mb: None
  • —ddp_broadcast_buffers: False
  • —ddp_static_graph: None
  • —ddp_backend: None
  • —ddp_timeout: 1800
  • —fsdp: None
  • —fsdp_config: None
  • —deepspeed: None
  • —debug: []
  • —skip_memory_metrics: True
  • —do_predict: False
  • —resume_from_checkpoint: None
  • —warmup_ratio: None
  • —local_rank: -1
  • —prompts: None
  • —batch_sampler: batch_sampler
  • —multi_dataset_batch_sampler: proportional
  • —router_mapping: {}
  • —learning_rate_mapping: {}
  • —max_length: None

</details>

Training Logs

EpochStepTraining LossValidation Lossenergy-dev_maxsim_ndcg@10
-1-1--0.9571
0.011550.0964--
0.0230100.0489--
0.0345150.1147--
0.0460200.0682--
0.0575250.0311--
0.0690300.0563--
0.0805350.0086--
0.0920400.0599--
0.101144-0.06060.9554
0.1034450.0014--
0.1149500.0163--
0.1264550.0684--
0.1379600.0364--
0.1494650.0973--
0.1609700.0744--
0.1724750.0444--
0.1839800.0047--
0.1954850.1064--
0.202388-0.05160.9548
0.2069900.1071--
0.2184950.0783--
0.22991000.0627--
0.24141050.0181--
0.25291100.0073--
0.26441150.0430--
0.27591200.0013--
0.28741250.0500--
0.29891300.0044--
0.3034132-0.04420.9548
0.31031350.0891--
0.32181400.0260--
0.33331450.0302--
0.34481500.0229--
0.35631550.1208--
0.36781600.0367--
0.37931650.0361--
0.39081700.0409--
0.40231750.0103--
0.4046176-0.04270.9559
0.41381800.0072--
0.42531850.0649--
0.43681900.0405--
0.44831950.0026--
0.45982000.0352--
0.47132050.0342--
0.48282100.0098--
0.49432150.0057--
0.50572200.02350.04160.9567
0.51722250.0026--
0.52872300.0119--
0.54022350.0013--
0.55172400.0417--
0.56322450.0118--
0.57472500.0060--
0.58622550.0069--
0.59772600.0620--
0.6069264-0.04100.9583
0.60922650.0700--
0.62072700.0287--
0.63222750.1266--
0.64372800.0015--
0.65522850.0147--
0.66672900.0145--
0.67822950.0976--
0.68973000.0027--
0.70113050.0341--
0.7080308-0.04040.9583
0.71263100.0570--
0.72413150.0302--
0.73563200.0047--
0.74713250.0238--
0.75863300.0514--
0.77013350.0022--
0.78163400.0579--
0.79313450.0030--
0.80463500.0407--
0.8092352-0.04040.9577
0.81613550.0363--
0.82763600.0570--
0.83913650.0031--
0.85063700.0603--
0.86213750.0067--
0.87363800.0022--
0.88513850.0129--
0.89663900.0072--
0.90803950.0052--
0.9103396-0.04050.9574
0.91954000.0165--
0.93104050.0060--
0.94254100.0020--
0.95404150.0144--
0.96554200.0572--
0.97704250.1479--
0.98854300.0381--
1.04350.03370.04050.9592
-1-1--0.9592
  • —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
bibtex
@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
bibtex
@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. -->