admesh/agentic-intent-classifier

Production-ready intent + IAB classifier bundle for conversational traffic.

Combines multitask intent modeling, supervised IAB content classification, and per-head confidence calibration to support safe monetization decisions in real time.

Links

What It Predicts

Field Description
intent.type commercial, informational, navigational, transactional, โ€ฆ
intent.subtype product_discovery, comparison, how_to, โ€ฆ
intent.decision_phase awareness, consideration, decision, โ€ฆ
iab_content IAB Content Taxonomy 3.0 tier1 / tier2 / tier3 labels
component_confidence Per-head calibrated confidence with threshold flags
system_decision Monetization eligibility, opportunity type, policy

Deployment Options

0. Colab / Kaggle Quickstart (copy/paste)

!pip -q install -U pip
!pip -q install -U "torch==2.10.0" "torchvision==0.25.0" "torchaudio==2.10.0"
!pip -q install -U "transformers>=4.36.0" "huggingface_hub>=0.20.0" "safetensors>=0.4.0"

Restart the runtime after installs (Runtime โ†’ Restart runtime) so the new Torch version is actually used.

from transformers import pipeline

clf = pipeline(
    "admesh-intent",
    model="admesh/agentic-intent-classifier",
    trust_remote_code=True,  # required (custom pipeline + multi-model bundle)
)

out = clf("Which laptop should I buy for college?")
print(out["meta"])
print(out["model_output"]["classification"]["intent"])

Latency / inference timing (quick check)

The first call includes model/code loading. Warm up once, then measure:

import time
q = "Which laptop should I buy for college?"

_ = clf("warm up")
t0 = time.perf_counter()
out = clf(q)
print(f"latency_ms={(time.perf_counter() - t0) * 1000:.1f}")

1. transformers.pipeline() โ€” anywhere (Python)

from transformers import pipeline

clf = pipeline(
    "admesh-intent",
    model="admesh/agentic-intent-classifier",
    trust_remote_code=True,
)

result = clf("Which laptop should I buy for college?")

Batch and custom thresholds:

# batch
results = clf([
    "Best running shoes under $100",
    "How does TCP work?",
    "Buy noise-cancelling headphones",
])

# custom confidence thresholds
result = clf(
    "Buy headphones",
    threshold_overrides={"intent_type": 0.6, "intent_subtype": 0.35},
)

2. HF Inference Endpoints (managed, deploy to AWS / Azure / GCP)

  1. Go to https://ui.endpoints.huggingface.co
  2. New Endpoint โ†’ select admesh/agentic-intent-classifier
  3. Framework: PyTorch โ€” Task: Text Classification
  4. Enable "Load with trust_remote_code"
  5. Deploy

The endpoint serves the same pipeline() interface above via REST:

curl https://<your-endpoint>.endpoints.huggingface.cloud \
  -H "Authorization: Bearer $HF_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"inputs": "Which laptop should I buy for college?"}'

3. HF Spaces (Gradio / Streamlit demo)

# app.py for a Gradio Space
import gradio as gr
from transformers import pipeline

clf = pipeline(
    "admesh-intent",
    model="admesh/agentic-intent-classifier",
    trust_remote_code=True,
)

def classify(text):
    return clf(text)

gr.Interface(fn=classify, inputs="text", outputs="json").launch()

4. Local / notebook via snapshot_download

import sys
from huggingface_hub import snapshot_download

local_dir = snapshot_download(
    repo_id="admesh/agentic-intent-classifier",
    repo_type="model",
)
sys.path.insert(0, local_dir)

from pipeline import AdmeshIntentPipeline
clf = AdmeshIntentPipeline()
result = clf("I need a CRM for a 5-person startup")

Or the one-liner factory:

from pipeline import AdmeshIntentPipeline
clf = AdmeshIntentPipeline.from_pretrained("admesh/agentic-intent-classifier")

Troubleshooting (avoid environment errors)

No module named 'combined_inference' (or similar)

This means the Hub repo root is missing required Python files. Ensure these exist at the root of the model repo (same level as pipeline.py):

  • pipeline.py, config.json, config.py
  • combined_inference.py, schemas.py
  • model_runtime.py, multitask_runtime.py, multitask_model.py
  • inference_intent_type.py, inference_subtype.py, inference_decision_phase.py, inference_iab_classifier.py
  • iab_classifier.py, iab_taxonomy.py

does not appear to have a file named model.safetensors

Transformers requires a standard checkpoint at the repo root for pipeline() to initialize. This repo includes a small dummy model.safetensors + tokenizer files at the root for compatibility; the real production weights live in:

  • multitask_intent_model_output/
  • iab_classifier_model_output/
  • artifacts/calibration/

Example Output

{
  "model_output": {
    "classification": {
      "iab_content": {
        "taxonomy": "IAB Content Taxonomy",
        "taxonomy_version": "3.0",
        "tier1": {"id": "552", "label": "Style & Fashion"},
        "tier2": {"id": "579", "label": "Men's Fashion"},
        "mapping_mode": "exact",
        "mapping_confidence": 0.73
      },
      "intent": {
        "type": "commercial",
        "subtype": "product_discovery",
        "decision_phase": "consideration",
        "confidence": 0.9549,
        "commercial_score": 0.656
      }
    }
  },
  "system_decision": {
    "policy": {
      "monetization_eligibility": "allowed_with_caution",
      "eligibility_reason": "commercial_discovery_signal_present"
    },
    "opportunity": {"type": "soft_recommendation", "strength": "medium"}
  },
  "meta": {
    "system_version": "0.6.0-phase4",
    "calibration_enabled": true,
    "iab_mapping_is_placeholder": false
  }
}

Reproducible Revision

from huggingface_hub import snapshot_download
local_dir = snapshot_download(
    repo_id="admesh/agentic-intent-classifier",
    repo_type="model",
    revision="0584798f8efee6beccd778b0afa06782ab5add60",
)

Included Artifacts

Path Contents
multitask_intent_model_output/ DistilBERT multitask weights + tokenizer
iab_classifier_model_output/ IAB content classifier weights + tokenizer
artifacts/calibration/ Per-head temperature + threshold JSONs
pipeline.py AdmeshIntentPipeline (transformers.Pipeline subclass)
combined_inference.py Core inference logic

Notes

  • trust_remote_code=True is required because this model uses a custom multi-head architecture that does not map to a single standard AutoModel checkpoint.
  • meta.iab_mapping_is_placeholder: true means IAB artifacts were missing or skipped; train and calibrate IAB for full production accuracy.
  • For long-running servers, instantiate once and reuse โ€” models are cached in memory after the first call.
Downloads last month
592
Safetensors
Model size
2.09M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for admesh/agentic-intent-classifier

Quantized
(46)
this model

Space using admesh/agentic-intent-classifier 1