alt.freeweights.embed / sentence-bert-swedish-cased
From: KBLab <huggingface.co/KBLab>Newsgroups: alt.freeweights.embedSubject:

sentence-bert-swedish-cased

Date: 2026-11-15Commit: 6b5e83cSigned: 2DC28CC7B26A283B ✓

Sentence similarity model with 125M parameters. Gguf and safetensors weights, 1.25 GB in all. Published by KBLab under Apache-2.0.

125M params1.25GBsentence-bert-swedish-casedgguf safetensorspermissive
FactsParams125MSize1.25 GBFormatsgguf, safetensorsTasksentence similarityLicenseApache-2.0From sourcepermissive
$ fw get KBLab/sentence-bert-swedish-cased
# manifest sha256 1602941f3aa1… · 1.25 GB · 18 files
$ fw verify ./sentence-bert-swedish-cased KBLab/sentence-bert-swedish-cased
From sourceHosted (signed)KBLab/sentence-bert-swedish-casedLast check: 2026-11-15 02:35 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Works with

Evaluate with

Overview

Size
1.25 GB
Weights
250 MB (GGUF)
Parameters
125M
Formats
gguf, safetensors
Task
sentence similarity
License
Apache-2.0 (permissive)
Files
18, each with a sha256
Publisher
KBLab
Added
2026-11-15
Section
alt.freeweights.embed
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-15 02:35 UTCpassed

Model card

From the publisher at commit 6b5e83c. Shown as plain text with links; images open at the publisher.

KBLab/sentence-bert-swedish-cased#

This is a sentence-transformers model: It maps Swedish sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search. This model is a bilingual Swedish-English model trained according to instructions in the paper Making Monolingual Sentence Embeddings Multilingual using Knowledge Distillation and the documentation accompanying its companion python package. We have used the strongest available pretrained English Bi-Encoder (all-mpnet-base-v2) as a teacher model, and the pretrained Swedish KB-BERT as the student model.

A more detailed description of the model can be found in an article we published on the KBLab blog here and for the updated model here.

Update: We have released updated versions of the model since the initial release. The original model described in the blog post is v1.0. The current version is v2.0. The newer versions are trained on longer paragraphs, and have a longer max sequence length. v2.0 is trained with a stronger teacher model and is the current default.

Model versionTeacher ModelMax Sequence Length
v1.0paraphrase-mpnet-base-v2256
v1.1paraphrase-mpnet-base-v2384
v2.0all-mpnet-base-v2384

Usage (Sentence-Transformers)#

Using this model becomes easy when you have sentence-transformers installed:

pip install -U sentence-transformers

Then you can use the model like this:

from sentence_transformers import SentenceTransformer
sentences = ["Det här är en exempelmening", "Varje exempel blir konverterad"]

model = SentenceTransformer('KBLab/sentence-bert-swedish-cased')
embeddings = model.encode(sentences)
print(embeddings)
Loading an older model version (Sentence-Transformers)#

Currently, the easiest way to load an older model version is to clone the model repository and load it from disk. For example, to clone the v1.0 model:

git clone --depth 1 --branch v1.0 https://huggingface.co/KBLab/sentence-bert-swedish-cased

Then you can load the model by pointing to the local folder where you cloned the model:

from sentence_transformers import SentenceTransformer
model = SentenceTransformer("path_to_model_folder/sentence-bert-swedish-cased")

Usage (HuggingFace Transformers)#

Without sentence-transformers, you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.

from transformers import AutoTokenizer, AutoModel
import torch


#Mean Pooling - Take attention mask into account for correct averaging
def mean_pooling(model_output, attention_mask):
    token_embeddings = model_output[0] #First element of model_output contains all token embeddings
    input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
    return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)


# Sentences we want sentence embeddings for
sentences = ['Det här är en exempelmening', 'Varje exempel blir konverterad']

# Load model from HuggingFace Hub
# To load an older version, e.g. v1.0, add the argument revision="v1.0" 
tokenizer = AutoTokenizer.from_pretrained('KBLab/sentence-bert-swedish-cased')
model = AutoModel.from_pretrained('KBLab/sentence-bert-swedish-cased')

# Tokenize sentences
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')

# Compute token embeddings
with torch.no_grad():
    model_output = model(**encoded_input)

# Perform pooling. In this case, max pooling.
sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])

print("Sentence embeddings:")
print(sentence_embeddings)
Loading an older model (Hugginfface Transformers)#

To load an older model specify the version tag with the revision arg. For example, to load the v1.0 model, use the following code:

AutoTokenizer.from_pretrained('KBLab/sentence-bert-swedish-cased', revision="v1.0")
AutoModel.from_pretrained('KBLab/sentence-bert-swedish-cased', revision="v1.0")

Evaluation Results#

The model was evaluated on SweParaphrase v1.0 and SweParaphrase v2.0. This test set is part of SuperLim -- a Swedish evaluation suite for natural langage understanding tasks. We calculated Pearson and Spearman correlation between predicted model similarity scores and the human similarity score labels. Results from SweParaphrase v1.0 are displayed below.

Model versionPearsonSpearman
v1.00.91830.9114
v1.10.91830.9114
v2.00.92830.9130

The following code snippet can be used to reproduce the above results:

from sentence_transformers import SentenceTransformer
import pandas as pd

df = pd.read_csv(
    "sweparaphrase-dev-165.csv",
    sep="\t",
    header=None,
    names=[
        "original_id",
        "source",
        "type",
        "sentence_swe1",
        "sentence_swe2",
        "score",
        "sentence1",
        "sentence2",
    ],
)

model = SentenceTransformer("KBLab/sentence-bert-swedish-cased")

sentences1 = df["sentence_swe1"].tolist()
sentences2 = df["sentence_swe2"].tolist()

# Compute embedding for both lists
embeddings1 = model.encode(sentences1, convert_to_tensor=True)
embeddings2 = model.encode(sentences2, convert_to_tensor=True)

# Compute cosine similarity after normalizing
embeddings1 /= embeddings1.norm(dim=-1, keepdim=True)
embeddings2 /= embeddings2.norm(dim=-1, keepdim=True)

cosine_scores = embeddings1 @ embeddings2.t()
sentence_pair_scores = cosine_scores.diag()

df["model_score"] = sentence_pair_scores.cpu().tolist()
print(df[["score", "model_score"]].corr(method="spearman"))
print(df[["score", "model_score"]].corr(method="pearson"))
Sweparaphrase v2.0#

In general, v1.1 correlates the most with human assessment of text similarity on SweParaphrase v2.0. Below, we present zero-shot evaluation results on all data splits. They display the model's performance out of the box, without any fine-tuning.

Model versionData splitPearsonSpearman
v1.0train0.83550.8256
v1.1train0.83830.8302
v2.0train0.82090.8059
v1.0dev0.86820.8774
v1.1dev0.87390.8833
v2.0dev0.86380.8668
v1.0test0.83560.8476
v1.1test0.83930.8550
v2.0test0.82320.8213
SweFAQ v2.0#

When it comes to retrieval tasks, v2.0 performs the best by quite a substantial margin. It is better at matching the correct answer to a question compared to v1.1 and v1.0.

Model versionData splitAccuracy
v1.0train0.5262
v1.1train0.6236
v2.0train0.7106
v1.0dev0.4636
v1.1dev0.5818
v2.0dev0.6727
v1.0test0.4495
v1.1test0.5229
v2.0test0.5871

Examples how to evaluate the models on some of the test sets of the SuperLim suites can be found on the following links: evaluate_faq.py (Swedish FAQ), evaluate_swesat.py (SweSAT synonyms), evaluate_supersim.py (SuperSim).

Training#

An article with more details on data and v1.0 of the model can be found on the KBLab blog.

Around 14.6 million sentences from English-Swedish parallel corpuses were used to train the model. Data was sourced from the Open Parallel Corpus (OPUS) and downloaded via the python package opustools. Datasets used were: JW300, Europarl, DGT-TM, EMEA, ELITR-ECA, TED2020, Tatoeba and OpenSubtitles.

The model was trained with the parameters:

DataLoader:

torch.utils.data.dataloader.DataLoader of length 180513 with parameters:

{'batch_size': 64, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}

Loss:

sentence_transformers.losses.MSELoss.MSELoss

Parameters of the fit()-Method:

{
    "epochs": 2,
    "evaluation_steps": 1000,
    "evaluator": "sentence_transformers.evaluation.SequentialEvaluator.SequentialEvaluator",
    "max_grad_norm": 1,
    "optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
    "optimizer_params": {
        "eps": 1e-06,
        "lr": 8e-06
    },
    "scheduler": "WarmupLinear",
    "steps_per_epoch": null,
    "warmup_steps": 5000,
    "weight_decay": 0.01
}

Full Model Architecture#

SentenceTransformer(
  (0): Transformer({'max_seq_length': 384, 'do_lower_case': False}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False})
)

Citing & Authors#

This model was trained by KBLab, a data lab at the National Library of Sweden.

You can cite the article on our blog: https://kb-labb.github.io/posts/2021-08-23-a-swedish-sentence-transformer/ .

@misc{rekathati2021introducing,  
  author = {Rekathati, Faton},  
  title = {The KBLab Blog: Introducing a Swedish Sentence Transformer},  
  url = {https://kb-labb.github.io/posts/2021-08-23-a-swedish-sentence-transformer/},  
  year = {2021}  
}

Acknowledgements#

We gratefully acknowledge the HPC RIVR consortium (www.hpc-rivr.si) and EuroHPC JU (eurohpc-ju.europa.eu/) for funding this research by providing computing resources of the HPC system Vega at the Institute of Information Science (www.izum.si).

Files

18 files · 1.25 GBWeights 250 MB (GGUF). Sizes and sha256 from the signed manifest.
Hide all 18 files with their sha256
FileSizesha256
.gitattributes870 Bfa119ed53998330e9b1189095d3851f47bc3d6a113e36d2c04b681efcdfa22b3
1_Pooling/config.json190 Ba37f83ada23e7887be6b88f4998927dbeac0038af301553c7cd5461413bf1a56
README.md12.8 KBf310620bb55dd31ac375fc6ec1bee59dfad9d5afd4ecfaa08607e9c989285c6c
Sentence-Bert-Swedish-Cased-124M-BF16.gguf250 MB625a8db7ea38ed81fa1866a80ac4f16454578ffe8c8cc2521b9ed856fdeac095
config.json710 Bf52dc6d1445b08f2b02910b100592932cef5696c34784eb7bb6386dacb39b9e1
config_sentence_transformers.json118 Bde52a8b2f0ff4ea8ca73721ced9bf01306a0b8df47720554600f1123e1336e13
eval/mse_evaluation_TED2020-en-sv-dev.tsv.gz_results.csv3.32 KB600a9adf1476f72110ef231123362e7b7b849ad4a2a2405d9f9b249af10a8c63
eval/mse_evaluation_Tatoeba-eng-swe-dev.tsv.gz_results.csv3.36 KB5d7e2fca2353c16909227e1ceba479b7234243b628442565c6c797ddec525fcc
eval/translation_evaluation_TED2020-en-sv-dev.tsv.gz_results.csv2.38 KB3cc64b1d88901792c62bd5e3dbf15e56e8bafd3b32459c8067ac6c7e33f1da29
eval/translation_evaluation_Tatoeba-eng-swe-dev.tsv.gz_results.csv2.46 KB9eab4485cafdce3199945761fcf67e7c1f42abaa8106ac220562ed036e25f93c
model.safetensors499 MB1561e3731bd6e2bf8d6c9188ed26433f96ef53c6a51f169e4ddb8ad6dd81eba5
modules.json229 B8f4b264b80206c830bebbdcae377e137925650a433b689343a63bdc9b3145460
pytorch_model.bin499 MB6bea01d07d85dc7870dfd9907ca78bac21ee8b1ef81c838f25a88b6494c79b32
sentence_bert_config.json53 Bcabfacded9272091a06ff595a46ef027a76ddf4ac9e77d0fcf11c605748f1667
special_tokens_map.json125 Bb6d346be366a7d1d48332dbc9fdf3bf8960b5d879522b7799ddba59e76237ee3
tokenizer.json1.20 MB0001cd9fd9ef17918f38ad084d7abd372ff0fa587d8b12298bf659154ad6f045
tokenizer_config.json614 Bd20768bd91f926d6330ab7aebe3cc8e93f5569170e3bb690421e9d1a1452b69f
vocab.txt399 KBcf103a3207ce9ce64c4d9e306c2cb433e5987b6050a9d869914e1a8e2c781ad6
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
6b5e83cd29 pinned now2026-11-15 02:35 UTC18 files · 1.25 GB

Use it

$ fw get KBLab/sentence-bert-swedish-cased
# manifest sha256 1602941f3aa1… · 1.25 GB · 18 files
$ fw verify ./sentence-bert-swedish-cased KBLab/sentence-bert-swedish-cased
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/KBLab/sentence-bert-swedish-cased.json --dir ./sentence-bert-swedish-cased $ python3 fw.py verify ./sentence-bert-swedish-cased ./KBLab__sentence-bert-swedish-cased.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download KBLab/sentence-bert-swedish-cased --revision 6b5e83cd29c03729cfdc33d13b1423399b0efb5c --local-dir ./sentence-bert-swedish-cased
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModel, AutoTokenizer tok = AutoTokenizer.from_pretrained("KBLab/sentence-bert-swedish-cased", revision="6b5e83cd29c03729cfdc33d13b1423399b0efb5c") model = AutoModel.from_pretrained("KBLab/sentence-bert-swedish-cased", revision="6b5e83cd29c03729cfdc33d13b1423399b0efb5c", device_map="auto")
sentence-transformersEmbed text with sentence-transformers.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from sentence_transformers import SentenceTransformer model = SentenceTransformer("KBLab/sentence-bert-swedish-cased", revision="6b5e83cd29c03729cfdc33d13b1423399b0efb5c") vectors = model.encode(["Hello"])
llama.cppDownload one GGUF variant (Sentence-Bert-Swedish-Cased-124M-BF16, 250 MB), then serve it.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download KBLab/sentence-bert-swedish-cased --include "Sentence-Bert-Swedish-Cased-124M-BF16*" --local-dir ./sentence-bert-swedish-cased $ llama-server -m ./sentence-bert-swedish-cased/Sentence-Bert-Swedish-Cased-124M-BF16.gguf
OllamaMake an Ollama model from the downloaded file.
$ printf 'FROM ./sentence-bert-swedish-cased/Sentence-Bert-Swedish-Cased-124M-BF16.gguf\n' > Modelfile $ ollama create sentence-bert-swedish-cased -f Modelfile

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-15
Text in
README.md
Text sha256
f310620bb55dd31ac375fc6ec1bee59dfad9d5afd4ecfaa08607e9c989285c6c
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: KBLab <huggingface.co/KBLab>Newsgroups: alt.freeweights.embedSubject: sentence-bert-swedish-casedDate: 2026-11-15Commit: 6b5e83cSigned: 2DC28CC7B26A283B ✓
Upstream
KBLab/sentence-bert-swedish-cased
Pinned commit
6b5e83cd29c03729cfdc33d13b1423399b0efb5c
Manifest
sentence-bert-swedish-cased.json · .minisig
Manifest sha256
1602941f3aa18e6fa77569da621195b7c5bf42f768f208e15de1822f30d0f982
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 02:35 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/KBLab/sentence-bert-swedish-cased.json $ curl -O https://freeweights.allternit.com/manifests/KBLab/sentence-bert-swedish-cased.json.minisig $ minisign -Vm sentence-bert-swedish-cased.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

1 model in the catalog name this one as their parent.

Quantizations
1
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download KBLab/sentence-bert-swedish-cased
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. sentence-bert-swedish-cased.json. Provenance. Takedown history: none.

Variants

1 quantized or adapter build of sentence-bert-swedish-cased. Each has its own license check and page.

From: sentence-transformers <huggingface.co/sentence-transformers>Subject: all-MiniLM-L6-v1
From: unsloth <huggingface.co/unsloth>Subject: all-MiniLM-L6-v2
From: mlx-community <huggingface.co/mlx-community>Subject: all-MiniLM-L6-v2-4bit
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: all-mpnet-base-v1
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: allenai-specter
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: bert-base-nli-max-tokens