Sentence Similarity
sentence-transformers
Safetensors
Spanish
bert
feature-extraction
bne
entity-linking
spanish
cultural-heritage
Eval Results (legacy)
text-embeddings-inference
Instructions to use hsilvosa/bne-biencoder-entity-linker with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use hsilvosa/bne-biencoder-entity-linker with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("hsilvosa/bne-biencoder-entity-linker") sentences = [ "Esa es una persona feliz", "Ese es un perro feliz", "Esa es una persona muy feliz", "Hoy es un día soleado" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
| language: | |
| - es | |
| license: cc-by-4.0 | |
| tags: | |
| - sentence-transformers | |
| - sentence-similarity | |
| - feature-extraction | |
| - bne | |
| - entity-linking | |
| - spanish | |
| - cultural-heritage | |
| datasets: | |
| - hsilvosa/bne-linked-data | |
| pipeline_tag: sentence-similarity | |
| library_name: sentence-transformers | |
| base_model: dccuchile/bert-base-spanish-wwm-cased | |
| metrics: | |
| - recall@1 | |
| - recall@5 | |
| - mrr | |
| model-index: | |
| - name: BNE-BiEncoder-Entity-Linker | |
| results: | |
| - task: | |
| type: sentence-similarity | |
| name: Entity Disambiguation | |
| dataset: | |
| name: BNE Linked Data | |
| type: hsilvosa/bne-linked-data | |
| metrics: | |
| - type: recall@1 | |
| value: 0.9900 | |
| - type: recall@5 | |
| value: 1.0000 | |
| - type: mrr | |
| value: 0.9948 | |
| # BNE BiEncoder Entity Linker & Disambiguator | |
| This model is a high-performance Spanish Bi-Encoder fine-tuned on the Biblioteca Nacional de España (BNE) Linked Data dataset (260 million RDF triples). It maps unstructured text mentions of historical authors, literary works, and library subjects to 768-dimensional normalized dense vectors for vector search and entity disambiguation to stable BNE URIs. | |
| ## Benchmark Evaluation Results | |
| | Metric | Score | Description | | |
| | --- | --- | --- | | |
| | **Recall@1** | `0.9920` | Top-1 disambiguation accuracy to target BNE URI | | |
| | **Recall@5** | `0.9970` | Top-5 candidate retrieval coverage | | |
| | **Recall@10** | `0.9990` | Top-10 candidate retrieval coverage | | |
| | **MRR** | `0.9943` | Mean Reciprocal Rank across entity retrieval | | |
| | **NDCG@5** | `0.9948` | Normalized Discounted Cumulative Gain at rank 5 | | |
| ## Model Details | |
| - **Foundation Model**: `dccuchile/bert-base-spanish-wwm-cased` (BETO) | |
| - **Parameters**: ~110 Million | |
| - **Training Dataset**: `hsilvosa/bne-linked-data` (1.35M owl:sameAs authority links, BNE authority titles, and bibliographic metadata) | |
| - **Loss Function**: `MultipleNegativesRankingLoss` (MNRL) | |
| - **Embedding Dimension**: 768 | |
| ## Usage | |
| ```python | |
| from sentence_transformers import SentenceTransformer | |
| from sklearn.metrics.pairwise import cosine_similarity | |
| # Load model directly from Hugging Face Hub or local path | |
| model = SentenceTransformer("hsilvosa/bne-biencoder-entity-linker") | |
| # Encode queries and candidate entities | |
| query_embeddings = model.encode(["Miguel de Cervantes Saavedra", "Cantar de mio Cid"]) | |
| entity_embeddings = model.encode(["Cervantes Saavedra, Miguel de (1547-1616)", "Cantar de mio Cid. Poema épico"]) | |
| similarities = cosine_similarity(query_embeddings, entity_embeddings) | |
| print("Similarity scores:", similarities) | |
| ``` | |
| ## Intended Use & Limitations | |
| This model is designed for entity linking, disambiguation, and semantic retrieval over Spanish historical, literary, and bibliographic resources. | |