> For the complete documentation index, see [llms.txt](https://langtech-bsc.gitbook.io/applied-intelligence/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://langtech-bsc.gitbook.io/applied-intelligence/models/machine-translation/salamandrata-2b-instruct.md).

# salamandraTA-2b-instruct

A compact, Apache 2.0 translation model for 35 languages. It runs on a CPU in its GGUF build.

<a href="https://huggingface.co/BSC-LT/salamandraTA-2b-instruct" class="button primary" data-icon="arrow-up-right-from-square">View on Hugging Face</a> <a href="https://huggingface.co/BSC-LT/salamandraTA-2B-instruct-GGUF" class="button secondary" data-icon="file-zipper">GGUF version</a>

**salamandraTA-2b-instruct** is the compact member of the family. It's Salamandra-2b, further pre-trained on **424 billion tokens of parallel data** (6.5 billion sentence pairs), then instruction-tuned for translation and related tasks. Its strengths are a small footprint and a **permissive Apache 2.0 license**.

{% hint style="info" %}
The 2B model hasn't received the v3 update yet. For the best quality and the newest features (terminology, HTML/XML, register), use [salamandraTA-7b-instruct](https://langtech-bsc.gitbook.io/applied-intelligence/models/machine-translation/salamandrata-7b-instruct.md). Choose the 2B when size, speed or licensing matter most.
{% endhint %}

## Key facts

|                    |                                                                                                                  |
| ------------------ | ---------------------------------------------------------------------------------------------------------------- |
| **Parameters**     | 2.3B (decoder-only Transformer)                                                                                  |
| **Context length** | 8,192 tokens                                                                                                     |
| **Languages**      | 35 languages + 3 varieties: the European languages of the 7B, without Arabic, Chinese, Hindi, Japanese or Korean |
| **Tasks**          | Sentence and paragraph translation, post-editing, grammar checking, NER, context-aware translation               |
| **License**        | Apache 2.0                                                                                                       |

## Evaluation highlights

FLORES+ devtest BLEU, against models of similar or larger size:

| Direction     | salamandraTA-2b-instruct | MADLAD-400 3B | NLLB-200 3.3B |
| ------------- | ------------------------ | ------------- | ------------- |
| English → XX  | 33.52                    | **35.11**     | 31.17         |
| XX → Catalan  | **32.42**                | 32.31         | 29.28         |
| XX → Spanish  | **25.01**                | 24.38         | 22.68         |
| XX → Galician | **28.72**                | 27.54         | 26.22         |
| XX → Basque   | **13.06**                | 12.65         | 7.58          |

At 2.3B parameters, it matches or beats models up to 50% larger on translation **into** the languages of Spain.

## Quickstart

{% tabs %}
{% tab title="llama.cpp (GGUF)" %}
Two quantized builds are available:

| File                           | Quantization | Size    |
| ------------------------------ | ------------ | ------- |
| `salamandrata_2b_inst_q8.gguf` | Q8\_0        | 2.40 GB |
| `salamandrata_2b_inst_q4.gguf` | Q4\_1        | 1.52 GB |

```bash
llama-server \
  --hf-repo BSC-LT/salamandraTA-2B-instruct-GGUF \
  --hf-file salamandrata_2b_inst_q8.gguf \
  -c 8192 --temp 0
```

{% endtab %}

{% tab title="Transformers" %}

```python
import torch
from datetime import datetime
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "BSC-LT/salamandraTA-2b-instruct"

source, target = "Catalan", "Galician"
sentence = "La biblioteca municipal amplia l'horari durant el període d'exàmens."

text = f"Translate the following text from {source} into {target}.\n{source}: {sentence} \n{target}:"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id, device_map="auto", torch_dtype=torch.bfloat16
)

prompt = tokenizer.apply_chat_template(
    [{"role": "user", "content": text}], tokenize=False, add_generation_prompt=True,
    date_string=datetime.today().strftime("%Y-%m-%d"),
)
inputs = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
input_length = inputs.shape[1]
outputs = model.generate(
    input_ids=inputs.to(model.device),
    max_new_tokens=400, early_stopping=True, num_beams=5,
)
print(tokenizer.decode(outputs[0, input_length:], skip_special_tokens=True))
```

{% endtab %}
{% endtabs %}

## Prompt templates

The 2B model uses **its own prompts** for some tasks. Don't reuse the 7B v3 templates for these:

| Task             | Prompt                                                                                                                                                      |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Translation**  | `Translate the following text from {source} into {target}.\n{source}: {text}\n{target}:`                                                                    |
| **Paragraph**    | `Please translate this text from {source} into {target}.\n{source}: {paragraph}\n{target}:`                                                                 |
| **Post-editing** | `Please fix any mistakes in the following {source}-{target} machine translation or keep it unedited if it's correct.\nSource: {text}\nMT: {mt}\nCorrected:` |
| **Grammar**      | `Please fix any mistakes in the following {source} sentence or keep it unedited if it's correct.\nSentence: {text}\nCorrected:`                             |

<details>

<summary>Funding and citation</summary>

Promoted and financed by the Government of Catalonia through the Aina Project. Funded by the Ministerio para la Transformación Digital y de la Función Pública and by the EU (NextGenerationEU), within the framework of the project ILENIA (ref. 2022/TL22/00215337).

```bibtex
@misc{gilabert2025salamandrasalamandratabscsubmission,
  title={From SALAMANDRA to SALAMANDRATA: BSC Submission for WMT25 General Machine Translation Shared Task},
  author={Javier Garcia Gilabert and Xixian Liao and Severino Da Dalt and Ella Bohman and Audrey Mash and Francesca De Luca Fornaciari and Irene Baucells and Joan Llop and Miguel Claramunt Argote and Carlos Escolano and Maite Melero},
  year={2025},
  eprint={2508.12774},
  archivePrefix={arXiv},
  primaryClass={cs.CL},
  url={https://arxiv.org/abs/2508.12774}
}
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://langtech-bsc.gitbook.io/applied-intelligence/models/machine-translation/salamandrata-2b-instruct.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
