Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 14
How to use Thermostatic/qwen3-4b-embeddings-akkadian with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Thermostatic/qwen3-4b-embeddings-akkadian")
sentences = [
"a-na a-la-hi-im KIŠIB a-mur-IŠTAR",
"From Ennānum to Idnaya and Aššur- <big_gap> : In accordance with what I wrote to you with my orders that <big_gap> leads - urgent, pay attention and guard my goods and my donkeys like your own life as you are a gentleman. When Aššur-imittī went to the City he brought some 2 or 3 minas of silver on his own, and in the City Aššur-imittī took 0.5 mina of silver, the working capital of halgiaššu. Clear what textiles and tin he brings on his own and let it remain with him. Send me word. Also, carry out <big_gap> in accordance with my instructions I sent to you. Also, with respect to the interest(?) of Aššur-imittī he must not lie and make me angry at you.",
"To Ali-ahum; seal of Amur-Ištar.",
"To Ennam-Aššur from Ali-ahum and Amur-Ištar: Sadly, our father has died. It is not Šalim-Aššur who is our father, it is you who are our father. Take care there of our father's instructions and clear up the affairs. You shall not transfer any consignment of our father's to this place. One or two of our investors are staying here. Our dear father and lord, clear it up."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]How to use Thermostatic/qwen3-4b-embeddings-akkadian with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Thermostatic/qwen3-4b-embeddings-akkadian to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Thermostatic/qwen3-4b-embeddings-akkadian to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Thermostatic/qwen3-4b-embeddings-akkadian to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="Thermostatic/qwen3-4b-embeddings-akkadian",
max_seq_length=2048,
)This model was finetuned with Unsloth.
based on unsloth/Qwen3-Embedding-4B
This is a sentence-transformers model finetuned from unsloth/Qwen3-Embedding-4B. It maps sentences & paragraphs to a 2560-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
SentenceTransformer(
(0): Transformer({'max_seq_length': 1024, 'do_lower_case': False, 'architecture': 'PeftModelForFeatureExtraction'})
(1): Pooling({'word_embedding_dimension': 2560, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': True, 'include_prompt': True})
(2): Normalize()
)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("sentence_transformers_model_id")
# Run inference
sentences = [
'37 ku-ta-ni 34 {túg}šu-ru-tum a-na lá-qé-pí-im áp-qí-id IGI i-dí-{d}IŠKUR IGI i-dí-a-šur DUMU sú-e-ta-ta 7 TÚG.HI.A ša li-wi-tim IGI a-šùr-SIPA a-dí-šu-um',
"37 -textiles (and) 34 dark textiles I entrusted to Lā-qēpum in the presence of Iddin-Adad and of Iddin-Aššur, son of Suettata. 7 textiles for wrapping I gave him in the presence of Aššur-rē'ī.",
'To Ešarra and Ab-šalim from Ennam-Aššur: 10 shekels of silver and an undergarment sealed by me is for Ešarra. 10 shekels of silver and 2 sashes are for Ab-šalim and the girl. 2 shekels of silver is for <big_gap> sister Ištar-lamassī <big_gap>',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 2560]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.7541, 0.0110],
# [0.7541, 1.0000, 0.0221],
# [0.0110, 0.0221, 1.0000]])
akkadian_valEmbeddingSimilarityEvaluator| Metric | Value |
|---|---|
| pearson_cosine | 0.9124 |
| spearman_cosine | 0.8625 |
anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| anchor | positive |
|---|---|
1 ma-na KÙ.BABBAR big_gap 4 {túg}ku-ta-ni big_gap ni-ik-na-x- big_gap KÙ.BABBAR a-ha-ma big_gap 2 GÍN KÙ.BABBAR big_gap ša áb-na-tim kà-ú-nam big_gap áb-na-tim big_gap uk-ta-in big_gap KÙ.BABBAR i-za-az big_gap ŠU.NÍGIN 1 ma-na 2 GÍN KÙ.BABBAR i li-bi big_gap IGI pì-lá-ah- big_gap IGI a-šur-na-da šu-ma KÙ.BABBAR a-na big_gap lá iš-ta-qá-al big_gap iš-tù ha-mu-uš-tim ša a-šur-be-el-a-wa-tim 1 ma-na-um 3 GÍN.TA ṣí-ib-tám ú-ṣa-áb i-na ITU.KAM a-ma-nu-šu-um |
1 mina of silver 4 kutānu-textiles silver; further, 2 shekels of silver of the stones confirm He has confirmed the stones. The silver stands ready. In all: 1 mina 2 shekels of silver is owed by Witnessed by Pilah- , by Aššur-nādā. If he has not paid the silver in I shall count interest for him reckoned from the week of Aššur-bēl-awātim at the rate 3 shekels per mina per month. |
ŠU.NÍGIN KÙ.BABBAR-pì-kà 15 ma-na 10 GÍN lu ša AN.NA ú ṣú-ba-tí-kà ku-nu-ki-ni ṣí-li-a na-áš-a-ku-um |
Total of your silver: 15 minas 10 shekels, Ṣilliya brings you under our seal - both that from the tin and that from your textiles. |
1 ma-na 7.5 GÍN KÙ.BABBAR ṣa-ru-pá-am i-ṣé-er a-mur-IŠTAR DUMU da-da e-la-ma i-šu iš-tù ha-muš-tim ša a-la-hi-im ú {d}MAR.TU-ba-ni a-na 11 ha-am-ša-tim i-ša-qal šu-ma lá iš-qú-ul 1½ GÍN.TA ṣí-ib-tám a-na ma-na-im i-na ITU.1.KAM ú-ṣa-áb ITU.KAM ša sà-ra-tim li-mu-um ša qá-té DINGIR-šu-GAL DUMU ba-zi-a IGI im-dí-lim DUMU šu-lá-ba-an IGI e-me-me-i DUMU a-zu-ta-a |
1 mina 7.5 shekels of refined silver Āmur-Ištar, son of Dada, owes to Elamma. From the week of Ali-ahum and Amurrum-bāni he will pay in 11 weeks; if he does not pay he will add 1.5 shekel as interest per mina per month. Month II, eponymy of the successor of Ilšu-rabi, son of Baziya. In the presence of Imdī-ilum, son of Šu-Labān, of Ememe'i, son of Azutaya. |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim",
"gather_across_devices": false
}
eval_strategy: stepsper_device_train_batch_size: 32learning_rate: 2e-05lr_scheduler_type: cosinewarmup_ratio: 0.1bf16: Truedataloader_pin_memory: Falsebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 8per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 3max_steps: -1lr_scheduler_type: cosinelr_scheduler_kwargs: Nonewarmup_ratio: 0.1warmup_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: 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}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Falsedataloader_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: Falsehub_revision: Nonegradient_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: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | akkadian_val_spearman_cosine |
|---|---|---|---|
| 0.1389 | 5 | 2.402 | - |
| 0.2778 | 10 | 2.3992 | - |
| 0.4167 | 15 | 2.1648 | - |
| 0.5556 | 20 | 1.8975 | - |
| 0.6944 | 25 | 1.4115 | 0.7776 |
| 0.8333 | 30 | 1.0211 | - |
| 0.9722 | 35 | 0.6742 | - |
| 1.1111 | 40 | 0.4176 | - |
| 1.25 | 45 | 0.2966 | - |
| 1.3889 | 50 | 0.2419 | 0.8580 |
| 1.5278 | 55 | 0.2028 | - |
| 1.6667 | 60 | 0.1523 | - |
| 1.8056 | 65 | 0.1445 | - |
| 1.9444 | 70 | 0.106 | - |
| 2.0833 | 75 | 0.0906 | 0.8614 |
| 2.2222 | 80 | 0.1198 | - |
| 2.3611 | 85 | 0.0625 | - |
| 2.5 | 90 | 0.1019 | - |
| 2.6389 | 95 | 0.0474 | - |
| 2.7778 | 100 | 0.0945 | 0.8625 |
| 2.9167 | 105 | 0.1227 | - |
@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",
}
@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}
}