Skip to main content
GLiNER is PasteGuard’s default and currently only semantic backend. It detects PERSON and LOCATION; street addresses are also returned as LOCATION. The default model is urchade/gliner_multi_pii-v1.
DETECTOR_MODEL accepts a Hugging Face model ID or local directory. Hub models must contain gliner_config.json; private models require Hugging Face authentication.
Custom models have different accuracy and confidence calibration. Test them against your data before production.

Local Models

Local directories need:
pytorch_model.bin is also accepted. Missing or invalid files fail during startup.
Offline deployments must also cache any tokenizer or encoder referenced by gliner_config.json.

Fine-Tuning

GLiNER can be fine-tuned on your own labeled data, for example on names and places that the default model misses in your domain. See the GLiNER training guide. The resulting checkpoint is a normal local model: point DETECTOR_MODEL at its directory, no PasteGuard changes required.
Training happens outside PasteGuard, with whichever GLiNER release you prefer. The detector ships GLiNER 0.2.x, and the checkpoint has to load there. Confirm that before deploying, especially after training on a newer release. The training API differs by version: the 0.2.x line the detector ships trains through gliner.training.Trainer, while the train_model() helper shown in the current upstream README belongs to a newer release. Training also needs accelerate, which the detector environment does not carry.
Two things decide whether the result is useful. Keep the label names. PasteGuard asks the model for exactly three labels:
These names are requested verbatim at inference. Training under different label names does not break detection: GLiNER treats the label as a text query, so a checkpoint trained on customer still answers a person query from its base capability. What it does mean is that the tuning is never requested, while the training can still shift the model’s generic behaviour. Train under person, location, and address so the result applies to what PasteGuard asks for.
Recalibrate the floors. GLINER_FLOOR_PERSON, GLINER_FLOOR_LOCATION, and GLINER_FLOOR_ADDRESS are calibrated against the default checkpoint and are unlikely to fit a fine-tuned one. The benchmarks/pii-accuracy harness in the repository runs a labeled corpus against a running detector and is the quickest way to find the values that suit yours.

Docker

The image includes the default model and runs offline. For a custom Hub model, enable downloads on first start and persist the cache:
For a local model, mount the directory and use its container path:

Settings

Floors must be between 0 and 1. The request score_threshold can raise, but not lower, them. Legacy DETECTOR_MODEL_PATH, DETECTOR_FLOOR_*, and DETECTOR_MAX_TOKENS remain supported. DETECTOR_MODEL_PATH wins over DETECTOR_MODEL; GLINER_* wins over matching legacy variables.