Run this model with HF Jobs

Run ArchitRastogi/BGE-Small-LegalEmbeddings-USCode on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/ArchitRastogi/BGE-Small-LegalEmbeddings-USCode. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/ArchitRastogi/BGE-Small-LegalEmbeddings-USCode on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

BGE-Small Fine-Tuned on USCode-QueryPairs

This is a fine-tuned version of the BGE Small embedding model, trained on the USCode-QueryPairs dataset, a subset of the USLawQA corpus. The model is optimized for generating embeddings for legal text, achieving 75% accuracy on the test set.

Overview

  • Base Model: BGE Small
  • Dataset: USCode-QueryPairs
  • Training Details:
    • Hardware: Google Colab (T4 GPU)
    • Training Time: 2 hours
  • Accuracy: 75% on the test set from USLawQA

Applications

This model is ideal for:

  • Legal Text Retrieval: Efficient semantic search across legal documents.
  • Question Answering: Answering legal queries based on context from the US Code.
  • Embeddings Generation: Generating high-quality embeddings for downstream legal NLP tasks.

Usage

The model can be used with model.encode for generating embeddings. Below is an example usage snippet:

# Load model directly
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("ArchitRastogi/BGE-Small-LegalEmbeddings-USCode")
model = AutoModel.from_pretrained("ArchitRastogi/BGE-Small-LegalEmbeddings-USCode")
text = "Duties of the president"
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
#Printing the Embeddings
print(outputs)

Evaluation

The model was evaluated on the test set of USLawQA and achieved the following metrics:

  • Accuracy: 75%
  • Task: Semantic similarity and legal question answering.

Related Resources

πŸ“§ Contact

For any inquiries, suggestions, or feedback, feel free to reach out:

Archit Rastogi
πŸ“§ architrastogi20@gmail.com


πŸ“œ License

This dataset is distributed under the Apache 2.0 License. Please ensure compliance with applicable copyright laws when using this dataset.

Downloads last month
88
Safetensors
Model size
33.4M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for ArchitRastogi/BGE-Small-LegalEmbeddings-USCode

Finetuned
(569)
this model

Dataset used to train ArchitRastogi/BGE-Small-LegalEmbeddings-USCode

Evaluation results