Model reference · open weights
Longformer-es-mental-large is an open-weight embedding model from ELiRF. 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 | ELiRF |
|---|---|
| Type | Embedding models |
| Task | Embeddings |
| Parameters (lead) | 435M |
| Context | 4098 tokens |
| Runs with | transformers |
| Based on | ELiRF/RoBERTa-es-mental-large |
| Released | 2025-02-10 |
| Popularity | 506 downloads / month |
| Licence | Unknown |
About
Longformer-es-mental-large is a Spanish domain-adapted language model designed for the analysis of mental health–related content in long user-generated texts.
It is based on the Longformer architecture, which extends the standard Transformer attention mechanism to efficiently process long sequences. The model supports input sequences of up to 4096 tokens, enabling it to capture long-range dependencies and temporal patterns that are particularly relevant in mental health monitoring and early risk detection settings.
This model was obtained through domain-adaptive pre-training (DAP) on a large corpus of mental health–related texts translated into Spanish from Reddit communities focused on psychological support and mental health discussions. The adaptation process allows the model to better capture emotional expressions, self-disclosure patterns, and discourse structures characteristic of mental health narratives in Spanish.
Longformer-es-mental-large is released as a foundational model and does not include task-specific fine-tuning.
This is the model card of a 🤗 transformers model that has been pushed on the Hub.
This model is intended for research purposes in the mental health NLP domain.
The model can be used directly as a feature extractor or encoder for Spanish mental health–related texts, particularly when long input sequences are required.
The model is primarily intended to be fine-tuned for downstream tasks such as:
It has been evaluated in early detection benchmarks when fine-tuned using task-specific datasets and methodologies.
Use the code below to get started with the model.
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("ELiRF/Longformer-es-mental-large")
model = AutoModel.from_pretrained("ELiRF/Longformer-es-mental-large")
inputs = tokenizer(
"Ejemplo de texto relacionado con salud mental.",
return_tensors="pt",
truncation=True,
max_length=4096
)
outputs = model(**inputs)
The model was domain-adapted using a merged corpus composed of:
All texts were automatically translated into Spanish using neural machine translation. The final dataset contains approximately 1.9 million posts from multiple mental health–related communities.
The model was trained using domain-adaptive pre-training (DAP) with a masked language modeling objective. Pre-training was performed for 20 epochs using multiple GPUs, following the same procedure applied to the other foundational models described in the paper “Improving Mental Health Screening and Early Risk Detection in Spanish”.
No task-specific fine-tuning is included in this checkpoint.
The model was evaluated after fine-tuning on Spanish mental health benchmarks (e.g., MentalRisk shared tasks).
When fine-tuned on Spanish mental health benchmarks, Longformer-es-mental shows competitive performance and improves upon the state of the art in both full-context (user-level) and early detection mental health tasks.
Longformer-es-mental is a Spanish domain-adapted long-context language model for mental health text analysis. It is based on the Longformer architecture and supports input sequences of up to 4096 tokens, enabling the modeling of long user message histories. The model shows strong performance on Spanish mental health detection and early risk detection tasks when fine-tuned on domain-specific datasets.
This model is part of ongoing research currently under review. The final version of the paper will be linked once it is published.
ELiRF research group (VRAIN, Universitat Politècnica de València)
From the published model card. Full card on the HuggingFace links in the sidebar.
Using it via the API
Once AxForge deploys longformer-es-mental-large for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (longformer-es-mental-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":"longformer-es-mental-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.