FamilyOS UltraBERT v4 - Multi-task NLP with GlobalPointer NER
Project description
FamilyOS UltraBERT v2
High-performance multi-task NLP model for family communication analysis.
Built on ModernBERT architecture, UltraBERT delivers 12 NLP capabilities in a single unified model - extract sentiment, emotions, safety signals, entities, and more from text with state-of-the-art accuracy.
Features
- 12 NLP Capabilities in one unified model
- PyTorch & ONNX backends for flexible deployment
- < 15ms latency for 6 capabilities on GPU
- Single encoder pass for multi-capability inference
- 768-dim sentence embeddings for semantic search
- 155M parameters - Optimized ModernBERT architecture
Installation
From GitHub (recommended)
# Clone the full repository
git clone https://github.com/Pkansagra-hub/Family_osModernBERT.git
cd Family_osModernBERT
# Install the package with PyTorch backend
pip install ./familyos_ultrabert[pytorch]
# Or with ONNX backend
pip install ./familyos_ultrabert[onnx]
# Or both
pip install ./familyos_ultrabert[all]
From PyPI (coming soon)
# Basic installation
pip install familyos-ultrabert
# With PyTorch backend (recommended for GPU)
pip install familyos-ultrabert[pytorch]
# With ONNX backend (recommended for CPU)
pip install familyos-ultrabert[onnx]
# Full installation (both backends)
pip install familyos-ultrabert[all]
Note: The PyTorch backend requires the full repository for model architecture code. The ONNX backend is fully standalone.
Quick Start
from familyos_ultrabert import UltraBERT
# Load model (auto-selects best backend)
model = UltraBERT.load()
# Analyze text with multiple capabilities
result = model.analyze(
"Mom picked up Panda from school today!",
capabilities=["sentiment", "ner_family", "safety_familyos", "emotions"]
)
# Access results
print(result["sentiment"])
# {'prediction': 'positive', 'confidence': 0.89, 'scores': {...}}
print(result["ner_family"]["entities"])
# [{'text': 'Mom', 'label': 'KINSHIP'}, {'text': 'Panda', 'label': 'NICKNAME'}]
print(result["safety_familyos"])
# {'band': 'GREEN', 'confidence': 0.98, 'probabilities': {...}}
print(result["emotions"]["predictions"])
# ['joy', 'caring', 'togetherness']
Capabilities
| Capability | Type | Description |
|---|---|---|
sentiment |
Classification | 5-class sentiment (very_negative to very_positive) |
emotions |
Multi-label | 44 emotions including family-specific feelings |
safety_familyos |
Classification | Safety bands: GREEN, AMBER, RED, CRISIS |
safety_generic |
Multi-label | 8 toxicity types (Jigsaw-style) |
intent |
Classification | 8 user intents (log_memory, query_memory, etc.) |
ingress |
Classification | 12 domain categories (DIARY, TASK, HEALTH, etc.) |
ner_family |
Token | Family entities (KINSHIP, NICKNAME, PET, etc.) |
ner_general |
Token | General NER (PER, ORG, LOC, DATE, etc.) |
temporal |
Token | Temporal expressions (DATE_ABS, DATE_REL, DURATION) |
relation |
Multi-label | 15 relationship types (parent_of, spouse_of, etc.) |
nli |
Classification | Natural language inference |
embedding |
Vector | 768-dim sentence embeddings |
Convenience Methods
# Sentiment
sentiment = model.get_sentiment("I love this!")
print(sentiment["prediction"]) # "very_positive"
# Emotions
emotions = model.get_emotions("So excited for the trip!")
print(emotions) # ["excitement", "joy", "anticipation"]
# Safety check
band = model.get_safety_band("Having a great day!")
print(band) # "GREEN"
# Entity extraction
entities = model.get_entities("Mom and Dad took the kids to grandma's house")
print(entities)
# [{'text': 'Mom', 'label': 'KINSHIP'}, {'text': 'Dad', 'label': 'KINSHIP'}, ...]
# Embeddings
embedding = model.get_embedding("Sample text for embedding")
print(len(embedding)) # 768
Backend Selection
# Auto-detect (uses GPU if available)
model = UltraBERT.load()
# Force PyTorch on GPU (best for multi-capability)
model = UltraBERT.load(backend="pytorch", device="cuda")
# Force ONNX on CPU (best for single-capability, deployment)
model = UltraBERT.load(backend="onnx", device="cpu")
# Custom model path
model = UltraBERT.load(model_path="/path/to/weights")
Model Architecture
| Component | Details |
|---|---|
| Base Model | ModernBERT-base (22 layers, 768 hidden) |
| Parameters | 155M total |
| Encoder | Shared transformer backbone |
| Heads | 12 specialized task heads |
| Optimization | 15% magnitude pruning |
| Quantization | Dynamic INT8 (ONNX) |
Benchmarks (RTX 4090)
Running the built-in benchmark suites
Benchmarks ship with the package and can be run either as a module:
python -m familyos_ultrabert.benchmarks --suite api,regression
or via the console script (when installed):
ultrabert-benchmark --suite api,regression
Reporting formats:
python -m familyos_ultrabert.benchmarks --suite api,regression --format text
python -m familyos_ultrabert.benchmarks --suite api,regression --format json --output benchmark_report.json
python -m familyos_ultrabert.benchmarks --suite api,regression --format markdown --output benchmark_report.md
For a faster smoke run:
python -m familyos_ultrabert.benchmarks --quick
Standard profiles (recommended for CI):
python -m familyos_ultrabert.benchmarks --profile smoke
python -m familyos_ultrabert.benchmarks --profile full
Baseline drift tracking (compare against last-known-good per environment key and update baseline):
python -m familyos_ultrabert.benchmarks --profile smoke --baseline --format json --output benchmark_report.json
Task Performance
| Task | Metric | Score |
|---|---|---|
| safety_familyos | Accuracy | 96.20% |
| intent | Actionable Rate | 96.58% |
| emotions | Hit Rate | 88.30% |
| sentiment | Direction Accuracy | 88.10% |
| ner_family | F1 | 87.71% |
| temporal | F1 | 87.17% |
| Weighted Average | 89.60% |
Latency
| Scenario | Latency | Throughput |
|---|---|---|
| 1 capability | 8 ms | - |
| 6 capabilities | 14 ms | - |
| 12 capabilities | 14 ms | 71 samples/sec |
| Embedding query | 13 ms | 1,921 emb/sec |
License
Proprietary - All Rights Reserved. See LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file familyos_ultrabert-4.0.9.tar.gz.
File metadata
- Download URL: familyos_ultrabert-4.0.9.tar.gz
- Upload date:
- Size: 213.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9ebb6967833a822219e7a559cdcbdc5056ca23307a0d0a5b25752c14f5ad922
|
|
| MD5 |
ff69cbf729ef46e93b96731ddf3994c5
|
|
| BLAKE2b-256 |
2322698cee436a478ba4d6c6d8ac4fc431bd9cb5acfef444e927d6895d3603fc
|
Provenance
The following attestation bundles were made for familyos_ultrabert-4.0.9.tar.gz:
Publisher:
release.yml on Pkansagra-hub/Family_osModernBERT
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
familyos_ultrabert-4.0.9.tar.gz -
Subject digest:
d9ebb6967833a822219e7a559cdcbdc5056ca23307a0d0a5b25752c14f5ad922 - Sigstore transparency entry: 1119084538
- Sigstore integration time:
-
Permalink:
Pkansagra-hub/Family_osModernBERT@2b8f1085eb05e6635ed339e1427fd4d24cc5d8db -
Branch / Tag:
refs/tags/v4.0.9 - Owner: https://github.com/Pkansagra-hub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b8f1085eb05e6635ed339e1427fd4d24cc5d8db -
Trigger Event:
release
-
Statement type:
File details
Details for the file familyos_ultrabert-4.0.9-py3-none-any.whl.
File metadata
- Download URL: familyos_ultrabert-4.0.9-py3-none-any.whl
- Upload date:
- Size: 240.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f28ca2f1f4f471df920805edda6604a76537693ff77790c1ecc53bc022a44286
|
|
| MD5 |
399ec625c1600be76e7d596b7fd5bea8
|
|
| BLAKE2b-256 |
fc191a213b9218ae0f723943f0f5529836c8534adcc9e8e92561b06fa47bb9db
|
Provenance
The following attestation bundles were made for familyos_ultrabert-4.0.9-py3-none-any.whl:
Publisher:
release.yml on Pkansagra-hub/Family_osModernBERT
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
familyos_ultrabert-4.0.9-py3-none-any.whl -
Subject digest:
f28ca2f1f4f471df920805edda6604a76537693ff77790c1ecc53bc022a44286 - Sigstore transparency entry: 1119084741
- Sigstore integration time:
-
Permalink:
Pkansagra-hub/Family_osModernBERT@2b8f1085eb05e6635ed339e1427fd4d24cc5d8db -
Branch / Tag:
refs/tags/v4.0.9 - Owner: https://github.com/Pkansagra-hub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b8f1085eb05e6635ed339e1427fd4d24cc5d8db -
Trigger Event:
release
-
Statement type: