Views
No views yet
| Model | Language | Description | Query Prefix |
|---|---|---|---|
| CSI-lab/Washington-state-law-embedding-model-Large | English | Fine-tuned large model (1024d) for WA State RCWs. Best performance. | Represent this sentence for searching relevant passages: |
| CSI-lab/Washington-state-law-embedding-model-Base | English | Fine-tuned base model (768d) for WA State RCWs. Faster inference. | Represent this sentence for searching relevant passages: |
BAAI/bge-large-en-v1.5large architectureWashington-state-law-embedding-model-Large was fine-tuned using a synthetic, high-variance dataset.overwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 32per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 4max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_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: Falsefp16: Truefp16_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: 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: 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: Falseneftune_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: Falseprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}bge-large model.| Metric | Base Model (Untrained Large) | Fine-Tuned (Peak @ 3.02) | Absolute Improvement |
|---|---|---|---|
| Recall@10 | 0.5684 | 0.8354 | + 26.7% |
| Recall@5 | 0.2842 | 0.4255 | + 14.13% |
| NDCG@10 | 0.2509 | 0.3828 | + 12.38% |
| MRR@10 | 0.1569 | 0.2487 | + 9.18% |
sentence-transformers"Represent this sentence for searching relevant passages:"1import torch
2from sentence_transformers import SentenceTransformer, util
3
4# 1. Load the fine-tuned model
5model = SentenceTransformer('CSI-lab/Washington-state-law-embedding-model-Large')
6
7# 2. Define the laws (Your Vector Database)
8laws = [
9 "RCW 9A.56.030: Theft in the first degree. A person is guilty of theft in the first degree if he or she commits theft of property or services which exceed(s) five thousand dollars in value.",
10 "RCW 46.61.502: Driving under the influence. A person is guilty of driving while under the influence of intoxicating liquor...",
11 "RCW 9A.36.011: Assault in the first degree. A person is guilty of assault in the first degree if he or she..."
12]
13
14# 3. Define the user's search query
15user_query = "What dollar amount makes a theft a first degree felony?"
16
17# 4. CRITICAL: Add the required BGE prefix to the query ONLY
18query_prefix = "Represent this sentence for searching relevant passages: "
19formatted_query = query_prefix + user_query
20
21# 5. Encode the documents and the query
22law_embeddings = model.encode(laws, convert_to_tensor=True)
23query_embedding = model.encode(formatted_query, convert_to_tensor=True)
24
25# 6. Calculate Cosine Similarity
26cosine_scores = util.cos_sim(query_embedding, law_embeddings)
27
28# 7. Print the top result
29best_idx = cosine_scores.argmax().item()
30print(f"Top Match: {laws[best_idx]}")
31print(f"Similarity Score: {cosine_scores[0][best_idx]:.4f}")@misc{washington_state_law_embedding_Large_2026,
title={Washington-state-law-embedding-model-Large: Fine-Tuned Dense Retrieval for Washington State Law},
author={Tomar, Shlok},
year={2026},
publisher={Hugging Face}
howpublished={\url{https://huggingface.co/CSI-lab/Washington-state-law-embedding-model-Large}},
note={Hugging Face Model Repository}
}1@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{henderson2017efficient,
2 title={Efficient Natural Language Response Suggestion for Smart Reply},
3 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},
4 year={2017},
5 eprint={1705.00652},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}