sentence-transformers
Safetensors
English
Malay
xlm-roberta
embedding
retrieval
rag
malaysian
manglish
multilingual
Instructions to use rekabytes/Aranda-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use rekabytes/Aranda-v1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("rekabytes/Aranda-v1") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- 1_Pooling/config.json +5 -0
- README.md +109 -0
- config.json +31 -0
- config_sentence_transformers.json +14 -0
- model.safetensors +3 -0
- modules.json +14 -0
- sentence_bert_config.json +10 -0
- tokenizer.json +3 -0
- tokenizer_config.json +22 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
1_Pooling/config.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"embedding_dimension": 768,
|
| 3 |
+
"pooling_mode": "mean",
|
| 4 |
+
"include_prompt": true
|
| 5 |
+
}
|
README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
- ms
|
| 5 |
+
tags:
|
| 6 |
+
- sentence-transformers
|
| 7 |
+
- embedding
|
| 8 |
+
- retrieval
|
| 9 |
+
- rag
|
| 10 |
+
- malaysian
|
| 11 |
+
- manglish
|
| 12 |
+
- multilingual
|
| 13 |
+
license: mit
|
| 14 |
+
model_type: sentence-transformers
|
| 15 |
+
base_model: paraphrase-multilingual-mpnet-base-v2
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Aranda-v1
|
| 19 |
+
|
| 20 |
+
Aranda-v1 is a sentence embedding model specialized for **Malaysian text retrieval**, including Bahasa Malaysia, Manglish (Malaysian English code-switching), and cross-lingual BM↔English matching. It outperforms the base model on all retrieval metrics across all four language categories.
|
| 21 |
+
|
| 22 |
+
## Training
|
| 23 |
+
|
| 24 |
+
Two-phase contrastive curriculum:
|
| 25 |
+
|
| 26 |
+
**Phase 1 — Breadth:** MultipleNegativesRankingLoss on 1M Malaysian positive pairs (paraphrases, social media, news, QA). LR=1e-5, 1000 steps.
|
| 27 |
+
|
| 28 |
+
**Phase 2 — Discrimination:** Fine-tuned on 58K diverse hard-negative triplets (Lowyat, Twitter, Facebook, formal BM QA, English anchors, cross-lingual pairs) with explicit mined hard negatives. LR=2e-6, 2000 steps.
|
| 29 |
+
|
| 30 |
+
Base model: `paraphrase-multilingual-mpnet-base-v2`
|
| 31 |
+
|
| 32 |
+
## Evaluation
|
| 33 |
+
|
| 34 |
+
Tested on 4,149 retrieval queries (BM, Manglish, English, Cross-lingual) with ~25 candidates per query.
|
| 35 |
+
|
| 36 |
+
### Overall Retrieval
|
| 37 |
+
|
| 38 |
+
| Model | Recall@1 | Recall@5 | Recall@10 | MRR |
|
| 39 |
+
|---|---:|---:|---:|---:|
|
| 40 |
+
| mpnet-base | 0.8631 | 0.9937 | 0.9973 | 0.9200 |
|
| 41 |
+
| multilingual-e5-base | 0.8470 | 0.9940 | 0.9988 | 0.9091 |
|
| 42 |
+
| **Aranda-v1** | **0.8891** | **0.9961** | **0.9998** | **0.9364** |
|
| 43 |
+
|
| 44 |
+
### Per-Language Recall@1
|
| 45 |
+
|
| 46 |
+
| Model | BM | Manglish | English | Cross-lingual |
|
| 47 |
+
|---|---:|---:|---:|---:|
|
| 48 |
+
| mpnet-base | 0.8200 | 0.8988 | 0.8577 | 0.8267 |
|
| 49 |
+
| **Aranda-v1** | **0.8431** | **0.9290** | **0.8792** | **0.8500** |
|
| 50 |
+
|
| 51 |
+
### Additional Metrics
|
| 52 |
+
|
| 53 |
+
| Metric | mpnet-base | Aranda-v1 |
|
| 54 |
+
|---|---:|---:|
|
| 55 |
+
| Mesolitica NDCG@10 | 0.4699 | **0.4706** |
|
| 56 |
+
| English STS Spearman | **0.8682** | 0.8369 |
|
| 57 |
+
| Manglish Heuristic Spearman | 0.3937 | **0.4536** |
|
| 58 |
+
|
| 59 |
+
## Usage
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
from sentence_transformers import SentenceTransformer
|
| 63 |
+
|
| 64 |
+
model = SentenceTransformer("rekabytes/Aranda-v1")
|
| 65 |
+
|
| 66 |
+
# Encode texts
|
| 67 |
+
embeddings = model.encode([
|
| 68 |
+
"macam mana nak renew lesen memandu",
|
| 69 |
+
"how to renew driving license",
|
| 70 |
+
"saya nak makan nasi lemak"
|
| 71 |
+
], normalize_embeddings=True)
|
| 72 |
+
|
| 73 |
+
# Cosine similarity
|
| 74 |
+
similarities = embeddings @ embeddings.T
|
| 75 |
+
print(similarities)
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
### With RAG / vector search
|
| 79 |
+
|
| 80 |
+
```python
|
| 81 |
+
# Encode your document corpus (do this once)
|
| 82 |
+
doc_embeddings = model.encode(documents, normalize_embeddings=True)
|
| 83 |
+
|
| 84 |
+
# At query time
|
| 85 |
+
query_embedding = model.encode([query], normalize_embeddings=True)
|
| 86 |
+
scores = query_embedding @ doc_embeddings.T
|
| 87 |
+
top_k = scores.argsort()[0][-5:][::-1]
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## Intended Use
|
| 91 |
+
|
| 92 |
+
- **RAG context retrieval** for Malaysian applications
|
| 93 |
+
- **Semantic search** over BM/Manglish/English document corpora
|
| 94 |
+
- **Cross-lingual matching** (BM ↔ English)
|
| 95 |
+
- **Dense retrieval** in hybrid search pipelines (paired with BM25)
|
| 96 |
+
|
| 97 |
+
## Limitations
|
| 98 |
+
|
| 99 |
+
- English STS performance is below the base model (0.8369 vs 0.8682) — the model specialized for Malaysian text
|
| 100 |
+
- Not a reranker — use a cross-encoder for second-stage reranking
|
| 101 |
+
- Tested on Malaysian web data; performance may vary on other Southeast Asian languages
|
| 102 |
+
|
| 103 |
+
## Model Details
|
| 104 |
+
|
| 105 |
+
- **Architecture:** XLM-RoBERTa (base)
|
| 106 |
+
- **Embedding dimension:** 768
|
| 107 |
+
- **Max sequence length:** 128
|
| 108 |
+
- **Pooling:** Mean
|
| 109 |
+
- **Normalization:** L2
|
config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"XLMRobertaModel"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"eos_token_id": 2,
|
| 11 |
+
"gradient_checkpointing": false,
|
| 12 |
+
"hidden_act": "gelu",
|
| 13 |
+
"hidden_dropout_prob": 0.1,
|
| 14 |
+
"hidden_size": 768,
|
| 15 |
+
"initializer_range": 0.02,
|
| 16 |
+
"intermediate_size": 3072,
|
| 17 |
+
"is_decoder": false,
|
| 18 |
+
"layer_norm_eps": 1e-05,
|
| 19 |
+
"max_position_embeddings": 514,
|
| 20 |
+
"model_type": "xlm-roberta",
|
| 21 |
+
"num_attention_heads": 12,
|
| 22 |
+
"num_hidden_layers": 12,
|
| 23 |
+
"output_past": true,
|
| 24 |
+
"pad_token_id": 1,
|
| 25 |
+
"position_embedding_type": "absolute",
|
| 26 |
+
"tie_word_embeddings": true,
|
| 27 |
+
"transformers_version": "5.12.1",
|
| 28 |
+
"type_vocab_size": 1,
|
| 29 |
+
"use_cache": true,
|
| 30 |
+
"vocab_size": 250002
|
| 31 |
+
}
|
config_sentence_transformers.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"__version__": {
|
| 3 |
+
"pytorch": "2.7.0+cu128",
|
| 4 |
+
"sentence_transformers": "5.6.0",
|
| 5 |
+
"transformers": "5.12.1"
|
| 6 |
+
},
|
| 7 |
+
"default_prompt_name": null,
|
| 8 |
+
"model_type": "SentenceTransformer",
|
| 9 |
+
"prompts": {
|
| 10 |
+
"document": "",
|
| 11 |
+
"query": ""
|
| 12 |
+
},
|
| 13 |
+
"similarity_fn_name": "cosine"
|
| 14 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9223161ac53fb61da63546d63c8ae3ce8f474c968ed24ea8914b05ae7916070a
|
| 3 |
+
size 1112197096
|
modules.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"idx": 0,
|
| 4 |
+
"name": "0",
|
| 5 |
+
"path": "",
|
| 6 |
+
"type": "sentence_transformers.base.modules.transformer.Transformer"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"idx": 1,
|
| 10 |
+
"name": "1",
|
| 11 |
+
"path": "1_Pooling",
|
| 12 |
+
"type": "sentence_transformers.sentence_transformer.modules.pooling.Pooling"
|
| 13 |
+
}
|
| 14 |
+
]
|
sentence_bert_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"transformer_task": "feature-extraction",
|
| 3 |
+
"modality_config": {
|
| 4 |
+
"text": {
|
| 5 |
+
"method": "forward",
|
| 6 |
+
"method_output_name": "last_hidden_state"
|
| 7 |
+
}
|
| 8 |
+
},
|
| 9 |
+
"module_output_name": "token_embeddings"
|
| 10 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cad551d5600a84242d0973327029452a1e3672ba6313c2a3c3d69c4310e12719
|
| 3 |
+
size 17082987
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": true,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"cls_token": "<s>",
|
| 6 |
+
"eos_token": "</s>",
|
| 7 |
+
"is_local": true,
|
| 8 |
+
"local_files_only": false,
|
| 9 |
+
"mask_token": "<mask>",
|
| 10 |
+
"max_length": 128,
|
| 11 |
+
"model_max_length": 128,
|
| 12 |
+
"pad_to_multiple_of": null,
|
| 13 |
+
"pad_token": "<pad>",
|
| 14 |
+
"pad_token_type_id": 0,
|
| 15 |
+
"padding_side": "right",
|
| 16 |
+
"sep_token": "</s>",
|
| 17 |
+
"stride": 0,
|
| 18 |
+
"tokenizer_class": "XLMRobertaTokenizer",
|
| 19 |
+
"truncation_side": "right",
|
| 20 |
+
"truncation_strategy": "longest_first",
|
| 21 |
+
"unk_token": "<unk>"
|
| 22 |
+
}
|