Model reference · open weights
drama-large is an open-weight embedding model from facebook. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.
Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.
What it is
| Released by | Meta |
|---|---|
| Published under | |
| Type | Embedding models |
| Task | Embeddings |
| Parameters (lead) | 400M |
| Context | 128k tokens |
| Runs with | transformers |
| Released | 2025-02-25 |
| Popularity | 4k downloads / month |
| Licence | Commercial licence needed |
About
DRAMA-large (0.3B) is a dense retrieval model built upon a pruned large language model backbone. It is derived by pruning a large language model and fine-tuned for efficient and generalizable multilingual text retrieval. By leveraging large language models for high-quality data augmentation, DRAMA-large achieves strong performance across both English and multilingual retrieval tasks, despite its compact size of 0.3B non-embedding parameters.
The default embedding size of drama-large is 1024, as we adopt Matryoshka Representation Learning, the dimionality can be flexiblely truncated to dimensionalities such as 512 or 256.
Please check our paper for the detials.
Below is an example using drama-base to encode query and document examples from the MIRACL dataset, using either Transformers or Sentence Transformers:
import torch
from transformers import AutoTokenizer, AutoModel
queries = [
'What percentage of the Earth\'s atmosphere is oxygen?',
'意大利首都是哪里?',
]
documents = [
"The amount of oxygen in the atmosphere has fluctuated over the last 600 million years, reaching a peak of 35% during the Carboniferous period, significantly higher than today's 21%.",
"羅馬是欧洲国家意大利首都和罗马首都广域市的首府及意大利全国的政治、经济、文化和交通中心,位于意大利半島中部的台伯河下游平原地,建城初期在七座小山丘上,故又名“七丘之城”。按城市范围内的人口计算,罗马是意大利人口最多的城市,也是欧盟人口第三多的城市。",
]
model_name = "facebook/drama-large"
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModel.from_pretrained(model_name, trust_remote_code=True).to(device)
query_embs = model.encode_queries(tokenizer, queries)
doc_embs = model.encode_documents(tokenizer, documents)
scores = query_embs @ doc_embs.T
print(scores.tolist())
# Expected output: [[0.5429, 0.1109], [0.1317, 0.6074]]
The
trust_remote_codewill use our customizeddrama_modeling.pywith two details:
- We use bi-directional attention instead of uni-directional attention
- We add
"Query: "as prefix for query text. (No prefix added to document)
DRAMA models are trained using Matryoshka Representation Learning (MRL) to support flexible dimensionality. Both queries and documents can be encoded into smaller dimensions, such as 256, using the following:
query_embs = model.encode_queries(tokenizer, queries, dim=256)
doc_embs = model.encode_documents(tokenizer, documents, dim=256)
scores = query_embs @ doc_embs.T
print(scores.tolist())
# Expected output: [[0.6239, 0.2294], [0.2604, 0.6942]]
from sentence_transformers import SentenceTransformer
queries = [
'What percentage of the Earth\'s atmosphere is oxygen?',
'意大利首都是哪里?',
]
documents = [
"The amount of oxygen in the atmosphere has fluctuated over the last 600 million years, reaching a peak of 35% during the Carboniferous period, significantly higher than today's 21%.",
"羅馬是欧洲国家意大利首都和罗马首都广域市的首府及意大利全国的政治、经济、文化和交通中心,位于意大利半島中部的台伯河下游平原地,建城初期在七座小山丘上,故又名“七丘之城”。按城市范围内的人口计算,罗马是意大利人口最多的城市,也是欧盟人口第三多的城市。",
]
model = SentenceTransformer("facebook/drama-large", trust_remote_code=True)
query_embs = model.encode(queries, prompt_name="query")
doc_embs = model.encode(documents)
scores = model.similarity(query_embs, doc_embs)
print(scores.tolist())
# Expected output: [[0.5429, 0.1109], [0.1317, 0.6074]]
- The
trust_remote_codewill use our customizeddrama_modeling.pywhich uses bi-directional attention instead of uni-directional attention.- For queries, you have to use
prompt_name="query"to select the prompt called "query", orprompt="Query: "to specify the prompt string manually.
DRAMA models are trained using Matryoshka Representation Learning (MRL) to support flexible dimensionality. Both queries and documents can be encoded into smaller dimensions, such as 256, using the following:
from sentence_transformers import SentenceTransformer
queries = [
'What percentage of the Earth\'s atmosphere is oxygen?',
'意大利首都是哪里?',
]
documents = [
"The amount of oxygen in the atmosphere has fluctuated over the last 600 million years, reaching a peak of 35% during the Carboniferous period, significantly higher than today's 21%.",
"羅馬是欧洲国家意大利首都和罗马首都广域市的首府及意大利全国的政治、经济、文化和交通中心,位于意大利半島中部的台伯河下游平原地,建城初期在七座小山丘上,故又名“七丘之城”。按城市范围内的人口计算,罗马是意大利人口最多的城市,也是欧盟人口第三多的城市。",
]
model = SentenceTransformer("facebook/drama-large", truncate_dim=256, trust_remote_code=True)
query_embs = model.encode(queries, prompt_name="query")
doc_embs = model.encode(documents)
scores = model.similarity(query_embs, doc_embs)
print(scores.tolist())
# Expected output: [[0.6239, 0.2294], [0.2604, 0.6942]]
The model has been evaluated on multiple retrieval benchmarks, including BEIR, MIRACL, MLDR, and several multilingual retrieval tasks in MTEB. It demonstrates strong performance in both English and multilingual retrieval tasks.
drama-large released in this page is corresponidng to the line DRAMA-0.3B with 265M non-embedding parrameters.
DRAMA-large was initialized from Llama3.2-1B (which was originally pruned from Llama3.1-8B). During pruning and retriever training, training data covered the following 20 languages (sorted alphabetically):
Arabic, Bengali, Chinese, English, Finnish, French, German, Hindi, Indonesian, Italian, Japanese, Korean, Persian, Portuguese, Russian, Spanish, Swahili, Telugu, Thai, Yoruba
Other languages may have downgraded peformance.
If you find our paper or models helpful, please consider cite as follows:
@articlFrom the published model card. Full card on the HuggingFace links in the sidebar.
Using it via the API
Once AxForge deploys drama-large for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (drama-large below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/embeddings \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"drama-large","input":"text to embed"}'
Create an account — your API key is available in the console. 3M free tokens every 30 days with every new account.