--- language: - en library_name: sentence-transformers tags: - legal - document-retrieval - semantic-search - fine-tuned license: apache-2.0 datasets: - custom-legal-dataset model_name: Quintu/bge-m3-legal_retrieval pipeline_tag: feature-extraction --- # Quintu/bge-m3-legal_retrieval This repository contains the **Quintu/bge-m3-legal_retrieval**, a fine-tuned version of the **bge-m3** model optimized for legal document retrieval tasks. The model is specifically designed to handle the nuances of legal language, enabling accurate and efficient retrieval of relevant legal documents based on semantic similarity. ## Model Details - **Base Model**: [bge-m3](https://huggingface.co/BAAI/bge-m3-base) - **Task**: Legal Document Retrieval - **Fine-tuning Dataset**: Legal documents and associated queries from real-world legal scenarios. - **Framework**: [Sentence-Transformers](https://www.sbert.net/) ## Key Features - **Legal Language Understanding**: Optimized to understand legal terms, context, and phrases. - **Semantic Search**: Retrieves documents based on meaning, not just keywords. - **High Precision Retrieval**: Tailored for legal professionals and researchers. ## How to Use ### Load the Model You can easily load and use the model with the `SentenceTransformer` library: ```python from sentence_transformers import SentenceTransformer # Load the fine-tuned model model_tuned = SentenceTransformer("Quintu/bge-m3-legal_retrieval") # Example usage: Encode queries and documents queries = ["What are the key legal precedents for intellectual property disputes?"] documents = [ "This document discusses key precedents in intellectual property law.", "This document covers legal principles in criminal law." ] # Encode the queries and documents query_embeddings = model_tuned.encode(queries) document_embeddings = model_tuned.encode(documents) # Compute similarity (example with cosine similarity) from sklearn.metrics.pairwise import cosine_similarity similarity_scores = cosine_similarity(query_embeddings, document_embeddings) # Output similarity scores print(similarity_scores)