CoolFace
Modelpublic

Ashybalka/xlm-roberta-taxonomy-main-de

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
0likes19downloads
Model Card

XLM-RoBERTa Job Taxonomy — Main (German)

![License](https://opensource.org/licenses/Apache-2.0) ![Language](https://huggingface.co/models?language=de) ![Base](https://huggingface.co/FacebookAI/xlm-roberta-base) ![Categories](https://huggingface.co/Ashybalka/xlm-roberta-taxonomy-main-de)

Fine-tuned xlm-roberta-base for classifying German job listings into 21 top-level industry categories.

Part of the JobBlast taxonomy model family — a system for automated classification of German-language job postings. This model handles the broad top-level split across all industries; for detailed IT role classification see the related IT model below.


Test Metrics

MetricValue
Accuracy81.75%
F1 macro78.15%
F1 weighted81.88%

Evaluated on a held-out test set of 3,320 German job listings.

Per-class results

CategoryPrecisionRecallF1Support
Administration & Office0.7040.7370.720190
Construction & Building0.7020.7330.71790
Design & Creative0.7140.8000.75525
Education & Teaching0.6200.6890.65345
Engineering0.7880.7690.778363
Finance, Accounting & Controlling0.7780.7550.766200
General Management & Consulting0.6110.7670.680129
Healthcare & Medical0.8920.8920.892194
Hospitality, Gastronomy & Tourism0.8970.7760.83267
Human Resources0.6670.7830.72023
IT & Software0.9070.8800.893500
Insurance & Real Estate0.8190.9070.86175
Legal0.6880.7860.73314
Logistics, Transport & Warehouse0.8590.9050.88274
Marketing, Communications & PR0.7940.7110.75038
Production & Manufacturing0.7120.7670.739129
Public Sector, Security & Defense0.6950.7250.71091
Sales & Business Development0.9080.9080.908500
Science & Research0.7330.8150.77227
Skilled Trades & Crafts0.8730.7800.824431
Social Work & Care0.8260.8260.826115

Repository Structure

Ashybalka/xlm-roberta-taxonomy-main-de/
├── config.json                    # shared — label map, model config
├── tokenizer.json                 # shared — fast tokenizer
├── tokenizer_config.json          # shared
├── sentencepiece.bpe.model        # shared
├── special_tokens_map.json        # shared
├── test_metrics.json              # evaluation results
├── classification_report.txt      # full per-class report
│
├── pytorch/
│   ├── config.json                # needed for from_pretrained(subfolder=)
│   └── model.safetensors          # GPU inference / fine-tuning (~1.1 GB)
│
├── onnx/
│   └── model.onnx                 # CPU fp32 inference (~1.1 GB)
│
└── onnx-int8/
    └── model_quantized.onnx       # CPU INT8 quantized (~280 MB 3-4× smaller)

Usage

Input Format

[Job Title] [SEP] [Job Description]
python
text = "Pflegefachkraft [SEP] Wir suchen eine examinierte Pflegefachkraft " \
       "für die Betreuung von Bewohnern in unserer Senioreneinrichtung."

PyTorch (GPU / fine-tuning)

python
from transformers import pipeline

clf = pipeline(
    "text-classification",
    model="Ashybalka/xlm-roberta-taxonomy-main-de",
    subfolder="pytorch",
    device=0,  # GPU; -1 for CPU
)

result = clf("DevOps Engineer [SEP] Kubernetes, CI/CD, Monitoring mit Prometheus.")
print(result)
# [{'label': 'IT & Software', 'score': 0.9712}]

ONNX fp32 (CPU inference)

python
from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer, pipeline

model     = ORTModelForSequenceClassification.from_pretrained(
                "Ashybalka/xlm-roberta-taxonomy-main-de",
                subfolder="onnx"
            )
tokenizer = AutoTokenizer.from_pretrained("Ashybalka/xlm-roberta-taxonomy-main-de")
clf       = pipeline("text-classification", model=model, tokenizer=tokenizer)

result = clf("Maurer [SEP] Erfahrener Maurer für Hochbau und Sanierungsarbeiten gesucht.")
print(result)
# [{'label': 'Construction & Building', 'score': 0.9483}]

ONNX INT8 (CPU, lightweight)

python
from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer, pipeline

model     = ORTModelForSequenceClassification.from_pretrained(
                "Ashybalka/xlm-roberta-taxonomy-main-de",
                subfolder="onnx-int8"
            )
tokenizer = AutoTokenizer.from_pretrained("Ashybalka/xlm-roberta-taxonomy-main-de")
clf       = pipeline("text-classification", model=model, tokenizer=tokenizer)

Direct ONNX Runtime (no transformers)

For production FastAPI services or environments without transformers:

python
import json
import numpy as np
import onnxruntime as ort
from huggingface_hub import snapshot_download
from tokenizers import Tokenizer

# download model
path = snapshot_download(
    "Ashybalka/xlm-roberta-taxonomy-main-de",
    allow_patterns=["onnx/model.onnx", "tokenizer.json", "config.json"]
)

# load
session   = ort.InferenceSession(f"{path}/onnx/model.onnx",
                                  providers=["CPUExecutionProvider"])
tokenizer = Tokenizer.from_file(f"{path}/tokenizer.json")
tokenizer.enable_truncation(max_length=510)
tokenizer.no_padding()

with open(f"{path}/config.json") as f:
    labels = [v for _, v in sorted(json.load(f)["id2label"].items(), key=lambda x: int(x[0]))]

vocab    = tokenizer.get_vocab()
bos, eos = vocab["<s>"], vocab["</s>"]

def classify(title: str, description: str) -> dict:
    text     = f"{title} [SEP] {description}"
    encoding = tokenizer.encode(text, add_special_tokens=False)
    ids      = [bos] + encoding.ids + [eos]
    mask     = [1] * len(ids)

    logits = session.run(None, {
        "input_ids":      np.array([ids],  dtype=np.int64),
        "attention_mask": np.array([mask], dtype=np.int64),
    })[0][0]

    exp   = np.exp(logits - logits.max())
    probs = exp / exp.sum()
    idx   = int(np.argmax(probs))

    return {"category": labels[idx], "confidence": round(float(probs[idx]), 4)}

print(classify("Python Developer", "FastAPI, Docker, PostgreSQL, REST API Entwicklung."))
# {'category': 'IT & Software', 'confidence': 0.9534}

Training Details

ParameterValue
Base modelFacebookAI/xlm-roberta-base
LabelingLLM consensus (3-model voting)
Agreement filter2/3 or 3/3 required
Max length512 tokens
Learning rate2e-5
Class weightingBalanced + sample weights by agreement

Limitations

  • —Optimized for German job listings only
  • —Class imbalance in the test set — IT & Software and Sales & Business Development (500 samples each) vs. Legal (14 samples) and Design & Creative (25 samples); metrics for small classes remain higher-variance
  • —Weakest classes: Education & Teaching (F1 0.653), General Management & Consulting (F1 0.680), Construction & Building (F1 0.717) — broad or semantically overlapping categories
  • —Administration & Office and General Management & Consulting act as catch-all categories for ambiguous office roles and may absorb borderline listings
  • —Inputs longer than 512 tokens are truncated — use title + first paragraph for best results

Related Models

ModelCategoriesUse case
xlm-roberta-taxonomy-main-de (this model)21 top-levelGeneral job classification across all industries
xlm-roberta-taxonomy-**it**-de14 IT subcategoriesDetailed IT role classification

A typical pipeline: this main model assigns the top-level category, and listings classified as IT & Software are then passed to the it model for fine-grained IT role classification.