/ Модель

Характеристики

Контекст
512 токенов
Параметры
137 млн
Лицензия
MIT
Архитектура
bert · dense
Базовая модель
bert-base-uncased
Библиотека
neuralops
Опубликована
9 ноя 2026

bert-compressed-attention-sst2

Классификация текстаТекст → label5 профессий

Дистиллированная версия BERT с compressed attention для классификации тональности английских предложений в задаче SST-2.

125скачиваний за 30 дней0лайковвеса обновлены11 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Hooshaai/bert-compressed-attention-sst2 — это дообученная и дистиллированная версия BERT-base-uncased с механизмом compressed_attention вместо стандартного внимания во всех 12 слоях. Модель предназначена для бинарной классификации тональности предложений SST-2: определения, выражает ли текст положительное или отрицательное мнение. Она принимает текст на английском языке, имеет контекст до 512 токенов и содержит 136,7 млн параметров; в репозитории хранятся только специализированные веса внимания и классификационная голова в FP16, около 55 МБ, а базовые веса BERT загружаются отдельно.

В README сообщается о точности 89,91% на валидационной выборке SST-2 после дистилляции, близкой к указанным 91,63% у исходной модели. Compressed attention заявлен как механизм с линейной или почти линейной вычислительной сложностью по длине последовательности, что может снизить вычислительные затраты. Для загрузки требуются совместимая библиотека NeuralOps и базовые веса bert-base-uncased. Лицензия — MIT.

Сценарии применения

  • определение положительной или отрицательной тональности отзыва
  • классификация эмоциональной окраски короткого английского текста
  • оценка тональности пользовательских комментариев
  • разметка предложений для анализа отзывов

Ограничения

Модель ориентирована на английскую бинарную классификацию SST-2; перенос качества на другие языки, жанры и задачи не подтверждён приведённой оценкой. Для восстановления модели нужны отдельные базовые веса bert-base-uncased и совместимая библиотека NeuralOps.

Для каких профессий подходит5

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

🧠 BERT-Base (compressed_attention) — Subquadratic Attention Zoo

Accuracy Weights Size Base Architecture License

This repository provides an authoritative pretrained and distilled checkpoint of bert-base-uncased where standard quadratic softmax attention blocks across all 12 transformer layers have been replaced with the compressed_attention mechanism from the NeuralOps Library.

The model was trained and evaluated on the General Language Understanding Evaluation (GLUE) benchmark suite (SST-2 task) using the NeuralOps Cached Representation Distillation Protocol (Zero Teacher VRAM allocation, offline representation alignment) physically executed on an NVIDIA GeForce RTX 3090 (24GB).


🔬 Architectural & Complexity Profile

  • Attention Mechanism: compressed_attention
  • Subquadratic Scaling: $O(N)$ or $O(N \log N)$ effective operational complexity versus standard quadratic $O(N^2)$ Multi-Head Attention (MHA).
  • Weights Serialization: attention_only_fp16 (attention_weights.safetensors).
  • Memory Footprint: ~55 MB download footprint (strictly the trained attention weights and task classification head, zero redundant base model bloat).

📊 Empirical Evaluation & Distillation Benchmark

Evaluated on the GLUE Benchmark SST-2 validation split (872 binary sequence classification samples):

MetricTeacher Baseline (bert-base-uncased)Pre-KD Student (compressed_attention)Post-KD Distilled ModelAccuracy Delta ($\Delta$)Distillation Status
GLUE SST-2 Accuracy91.63%67.32%89.91%+22.59%Strong (>=80%)
Validation Cross-Entropy0.2428Uncalibrated0.2658ConvergedOptimal

Hardware & Distillation Telemetry (Sharif HPC Cluster)

  • Physical Compute: NVIDIA GeForce RTX 3090 24GB (Ampere Architecture, Tensor Cores active)
  • Training Duration: 49.9s
  • Total Optimization Steps: 160 steps (Stage 1 Subspace Hidden Alignment $\rightarrow$ Stage 2 Logit KL + Task CE)
  • Effective Throughput: 26275.0 tokens/sec
  • Peak GPU VRAM: 8487 MB (Zero teacher VRAM overhead via offline representation caching)

🚀 Quick Start & One-Liner Inference

1. Standard Hugging Face Transformers (AutoModelForSequenceClassification)

import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer

# Instant download and execution directly from Hugging Face Hub (trust_remote_code=True)
model = AutoModelForSequenceClassification.from_pretrained("tahamajs/bert-compressed-attention-sst2", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("tahamajs/bert-compressed-attention-sst2")

inputs = tokenizer("NeuralOps accelerates transformer architectures with subquadratic efficiency.", return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)
    prediction = outputs.logits.argmax(dim=-1).item()

print("Predicted Sentiment (0 = Negative, 1 = Positive):", prediction)

2. High-Level Modular Loading via NeuralOps Zoo API

from neuralops.hub.bert_zoo import load_pretrained_bert

# Reconstruct and load strictly the attention weights onto base BERT
model, tokenizer = load_pretrained_bert(
    attention_type="compressed_attention",
    task="sequence-classification",
    hf_org="tahamajs",
)

📦 Modular Attention-Only Weights

Following the NeuralOps parameter-efficient serialization specification, this repository stores only the specialized attention and task adapter parameters (attention_weights.safetensors in FP16, ~55 MB) rather than re-uploading the entire 450 MB frozen base BERT weights. The remote code shim (modeling_neuralops_bert.py) automatically initializes the frozen base weights from bert-base-uncased and applies the distilled attention parameters on the fly.


📜 Citation

If you use this model or the NeuralOps attention zoo in your research, please cite:

@software{neuralops2026bertzoo,
  title   = {NeuralOps: Pretrained BERT Subquadratic Attention Zoo on GLUE Benchmark},
  author  = {Majlesi, Taha},
  year    = {2026},
  url     = {https://github.com/tahamajs/NeuralOps}
}

Quick Start (Universal NeuralOps Hub API)

import torch
from neuralops.hub import load_surgeried_model

# Load model and tokenizer/processor in one line directly from Hugging Face Hub
model, tokenizer = load_surgeried_model("tahamajs/bert-compressed-attention-sst2")
model.eval()
print(f"Successfully loaded tahamajs/bert-compressed-attention-sst2 with NeuralOps modular surgical weights!")

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · neuralops · text-classification

Нельзя запустить

Модели нужен код из репозитория; запуск откроется после проверки совместимости.

Класс архитектуры
BertForSequenceClassification
Ревизия весов
85e5638

0 моделей