Views
No views yet
1import txtai
2
3embeddings = txtai.Embeddings(
4 path="neuml/colbert-muvera-small",
5 content=True
6)
7embeddings.index(documents())
8
9# Run a query
10embeddings.search("query to run")1from txtai.pipeline import Reranker, Similarity
2
3similarity = Similarity(path="neuml/colbert-muvera-small", lateencode=True)
4ranker = Reranker(embeddings, similarity)
5ranker("query to run")1from pylate import rank, models
2
3queries = [
4 "query A",
5 "query B",
6]
7
8documents = [
9 ["document A", "document B"],
10 ["document 1", "document C", "document B"],
11]
12
13documents_ids = [
14 [1, 2],
15 [1, 3, 2],
16]
17
18model = models.ColBERT(
19 model_name_or_path="neuml/colbert-muvera-small",
20)
21
22queries_embeddings = model.encode(
23 queries,
24 is_query=True,
25)
26
27documents_embeddings = model.encode(
28 documents,
29 is_query=False,
30)
31
32reranked_documents = rank.rerank(
33 documents_ids=documents_ids,
34 queries_embeddings=queries_embeddings,
35 documents_embeddings=documents_embeddings,
36)ColBERT(
(0): Transformer({'max_seq_length': 299, 'do_lower_case': False}) with Transformer model: BertModel
(1): Dense({'in_features': 384, 'out_features': 128, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity'})
)ndcg@10 and grouped into the following three categories.| Model | Parameters | ArguAna | NFCorpus | SciFact | Average |
|---|---|---|---|---|---|
| AnswerAI ColBERT Small v1 | 33M | 0.4440 | 0.3649 | 0.7423 | 0.5171 |
| ColBERT v2 | 110M | 0.4595 | 0.3165 | 0.6456 | 0.4739 |
| ColBERT MUVERA Micro | 4M | 0.3947 | 0.3235 | 0.6676 | 0.4619 |
| ColBERT MUVERA Small | 33M | 0.4455 | 0.3502 | 0.7145 | 0.5034 |
| GTE ModernColBERT v1 | 149M | 0.4946 | 0.3717 | 0.7529 | 0.5397 |
| Model | Parameters | ArguAna | NFCorpus | SciFact | Average |
|---|---|---|---|---|---|
| AnswerAI ColBERT Small v1 | 33M | 0.0317 | 0.1135 | 0.0836 | 0.0763 |
| ColBERT v2 | 110M | 0.4562 | 0.3025 | 0.6278 | 0.4622 |
| ColBERT MUVERA Micro | 4M | 0.3849 | 0.3095 | 0.6464 | 0.4469 |
| ColBERT MUVERA Small | 33M | 0.4451 | 0.3537 | 0.7148 | 0.5045 |
| GTE ModernColBERT v1 | 149M | 0.0265 | 0.1052 | 0.0556 | 0.0624 |
| Model | Parameters | ArguAna | NFCorpus | SciFact | Average |
|---|---|---|---|---|---|
| AnswerAI ColBERT Small v1 | 33M | 0.0024 | 0.0201 | 0.0047 | 0.0091 |
| ColBERT v2 | 110M | 0.3463 | 0.2356 | 0.5002 | 0.3607 |
| ColBERT MUVERA Micro | 4M | 0.2795 | 0.2348 | 0.4875 | 0.3339 |
| ColBERT MUVERA Small | 33M | 0.3850 | 0.2928 | 0.6357 | 0.4378 |
| GTE ModernColBERT v1 | 149M | 0.0003 | 0.0203 | 0.0013 | 0.0073 |
NanoBEIR_meanpylate.evaluation.nano_beir_evaluator.NanoBEIREvaluator| Metric | Value |
|---|---|
| MaxSim_accuracy@1 | 0.5995 |
| MaxSim_accuracy@3 | 0.7522 |
| MaxSim_accuracy@5 | 0.7984 |
| MaxSim_accuracy@10 | 0.8646 |
| MaxSim_precision@1 | 0.5995 |
| MaxSim_precision@3 | 0.3589 |
| MaxSim_precision@5 | 0.2732 |
| MaxSim_precision@10 | 0.1885 |
| MaxSim_recall@1 | 0.3574 |
| MaxSim_recall@3 | 0.5047 |
| MaxSim_recall@5 | 0.559 |
| MaxSim_recall@10 | 0.6365 |
| MaxSim_ndcg@10 | 0.617 |
| MaxSim_mrr@10 | 0.6868 |
| MaxSim_map@100 | 0.5394 |
eval_strategy: stepsgradient_accumulation_steps: 4learning_rate: 3e-06num_train_epochs: 1warmup_ratio: 0.05bf16: Trueoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 8per_device_eval_batch_size: 8per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 4eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 3e-06weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 1max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.05warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falseuse_ipex: Falsebf16: Truefp16: Falsefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torchoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportional1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084"
9}1@misc{PyLate,
2title={PyLate: Flexible Training and Retrieval for Late Interaction Models},
3author={Chaffin, Antoine and Sourty, Raphaël},
4url={https://github.com/lightonai/pylate},
5year={2024}
6}