privacy-filter.cpp  by localai-org

Minimal C++/GGML runtime for PII/NER entity detection

Created 4 weeks ago

New!

276 stars

Top 93.6% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

Summary

Addresses efficient PII/NER entity span detection using a minimal C++/GGML runtime. Targets developers needing high-performance, low-memory footprint solutions for sensitive data identification. Offers significant speedups and memory savings over standard Transformer models.

How It Works

Implements OpenAI's privacy filter NER architecture within a custom C++ GGML runtime. Employs a banded/near-linear attention mechanism, contrasting with the quadratic complexity of standard Transformers. This design enables sustained throughput on long documents and drastically reduces memory requirements. Supports multiple model variants (openai-privacy-filter, privacy-filter-multilingual, privacy-filter-nemotron) and offers pre-converted GGUF files.

Quick Start & Requirements

  • Primary install/run command: Clone recursively (git clone --recursive <repo>), then build using CMake presets: cmake --preset release && cmake --build --preset release -j. Runtime execution via ./build/release/pf-cli.
  • Non-default prerequisites: CMake, C++ compiler. Optional GPU acceleration requires Vulkan (headers/loader, glslc) or CUDA (toolkit). Model conversion scripts require Python 3.x and pip install -r scripts/requirements.txt (torch, safetensors, gguf).
  • Pre-converted GGUF models are available for direct use.

Highlighted Details

  • Achieves 7.7x faster CPU and superior GPU performance (handling 131k tokens vs. HF's ~16k OOM) for PII/NER tasks.
  • Demonstrates real-time, on-device PII classification on a Raspberry Pi 5 (360 tok/s).
  • Banded attention ensures near-linear scaling and flat throughput with increasing sequence length, unlike O(n²) Transformer attention.
  • Minimal VRAM usage (~2.8 GiB on a 16 GiB GPU).
  • Optimized CPU runtime dispatches optimal ISA (e.g., AVX-512).

Maintenance & Community

Continuous integration (CI) is present for model conversion parity checks. No explicit community channels (Discord/Slack) or core contributor information is detailed in the provided text.

Licensing & Compatibility

The specific open-source license is not mentioned in the provided README excerpt. Compatibility for commercial use or closed-source linking is therefore undetermined.

Limitations & Caveats

The project focuses exclusively on PII/NER classification, not generative tasks. GPU backend setup requires specific system configurations (Vulkan or CUDA). The license status requires clarification for adoption decisions.

Health Check
Last Commit

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
6
Issues (30d)
1
Star History
280 stars in the last 28 days

Explore Similar Projects

Starred by Yineng Zhang Yineng Zhang(Inference Lead at SGLang; Research Scientist at Together AI).

dots.llm1 by rednote-hilab

0%
489
MoE model for research
Created 1 year ago
Updated 10 months ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Maxime Labonne Maxime Labonne(Head of Post-Training at Liquid AI), and
1 more.

GPTFast by MDK8888

0%
684
HF Transformers accelerator for faster inference
Created 2 years ago
Updated 1 year ago
Starred by Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera), Jason Knight Jason Knight(Director AI Compilers at NVIDIA; Cofounder of OctoML), and
1 more.

blt by facebookresearch

0.1%
2k
Code for Byte Latent Transformer research paper
Created 1 year ago
Updated 8 months ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Philipp Schmid Philipp Schmid(DevRel at Google DeepMind), and
2 more.

SageAttention by thu-ml

0.6%
3k
Attention kernel for plug-and-play inference acceleration
Created 1 year ago
Updated 5 months ago
Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Jiayi Pan Jiayi Pan(Author of SWE-Gym; MTS at xAI), and
34 more.

flash-attention by Dao-AILab

0.3%
24k
Fast, memory-efficient attention implementation
Created 4 years ago
Updated 3 days ago
Feedback? Help us improve.