/ Модель

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

Лицензия
Apache 2.0
Архитектура
lexlattice-nca-consolidator · dense
Библиотека
pytorch
Опубликована
1 авг 2026

lexlattice-2d-nca

СуммаризацияТекст → текст

Компактная мультиязычная модель извлекает наиболее важные абзацы из длинных правовых актов ЕС и составляет экстрактивное резюме.

14скачиваний за 30 дней0лайковвеса обновлены1 авг 2026

Бенчмарки

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

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

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

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

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

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

LexLattice — компактная мультиязычная экстрактивная модель для суммирования длинных документов законодательства ЕС из набора EUR-Lex-Sum. Её разработал автор репозитория lalala512. Модель выбирает наиболее значимые абзацы исходного документа и формирует из них краткое содержание в пределах заданного лимита слов, не перефразируя и не создавая новый текст.

Архитектура состоит из замороженного энкодера на базе mT5-base с примерно 390 млн параметров и обученного консолидатора LexLattice с 1 797 377 параметрами. Представления абзацев размещаются на двумерной решётке «раздел × абзац», где 2D нейронный клеточный автомат обменивает информацию о структуре документа; затем модель оценивает значимость абзацев и выбирает их по алгоритму Plackett–Luce. В репозитории находится именно тот энкодер, на котором обучались контрольные точки: таблица входных эмбеддингов была переинициализирована, поэтому заменять его стандартным google/mt5-base нельзя. Энкодер обрабатывает до 256 токенов на абзац, решётка рассчитана на 48 разделов и 32 абзаца в разделе; переполнение объединяется в крайних ячейках.

Модель обучена на документах EUR-Lex-Sum на 24 официальных языках ЕС и подходит для извлечения ключевых положений из длинных правовых и нормативных актов с сохранением их исходных формулировок. Перенос на другие жанры не проверен, а для языков вне обучающего набора языковое представление не предусмотрено. Сводка может пропускать юридически значимые положения и не заменяет чтение полного акта или юридическую консультацию. Модель распространяется по лицензии Apache-2.0.

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

  • составление краткой сводки нормативного акта ЕС
  • извлечение ключевых абзацев из длинного юридического документа
  • подготовка выдержек из законодательства на официальных языках ЕС

Ограничения

Модель обучена на актах EUR-Lex, поэтому её перенос на другие типы документов не проверен; она только выбирает исходные абзацы и не перефразирует текст. Сводки могут опускать юридически значимые положения и не заменяют чтение полного документа; для работы используйте встроенный энкодер, а не стандартные веса google/mt5-base.

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

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

Открыть на Hugging Face

LexLattice: 2D-NCA semantic-lattice consolidator for EUR-Lex-Sum

LexLattice is a lightweight (1.8M-parameter) multilingual extractive summarizer for long EU legal acts, covering all 24 official EU languages of the EUR-Lex-Sum benchmark.

Instead of truncating long documents, LexLattice tiles the document's structure onto a 2D semantic lattice — rows are sections, columns are paragraphs — and runs a masked neural cellular automaton (NCA) over it, letting paragraph representations exchange information along both the reading order and the document hierarchy. A residual readout then scores every paragraph's salience, and a Plackett–Luce selection extracts the summary under a word budget.

frozen mT5-base encoder → paragraph states [N, 768]
    → tile onto (section × paragraph) lattice [768, 48, 32]  (masked; padding never updates)
    → + language-embedding channel
    → masked depthwise-conv 2D-NCA, 8 steps
    → un-tile → residual readout → salience score per paragraph
    → greedy Plackett–Luce selection up to the word budget

The frozen encoder is included in this repo (encoder/ subfolder) and is loaded automatically by the provided code. It is an mT5-base-architecture encoder whose transformer blocks carry the google/mt5-base pretrained weights, but whose input-embedding table was (deterministically) re-initialized in the training environment and therefore differs from stock mT5 — see Encoder provenance below. Only the consolidator (NCA + language embedding + readout) is trained; the encoder is frozen.

⚠️ Do not substitute google/mt5-base for the bundled encoder: the consolidator checkpoints were trained on the bundled weights and are not compatible with stock mT5 embeddings.

Checkpoints

FileTraining
consolidator_2d.safetensorsSupervised warm-start: Plackett–Luce NLL on greedy-oracle extraction orderings (+ BCE membership auxiliary), trained on all 24 languages
consolidator_2d_rl.safetensorsThe above, fine-tuned with RLOO (REINFORCE Leave-One-Out) against a blended ROUGE-1/2/Lsum reward, z-normalized per language

Original PyTorch .pt state dicts are included for exact reproducibility of the paper pipeline.

Usage

# pip install torch transformers safetensors huggingface_hub sentencepiece
from huggingface_hub import hf_hub_download
import importlib.util

path = hf_hub_download("lalala512/lexlattice-2d-nca", "modeling_lexlattice.py")
spec = importlib.util.spec_from_file_location("modeling_lexlattice", path)
mod = importlib.util.module_from_spec(spec); spec.loader.exec_module(mod)

model = mod.LexLattice.from_pretrained(
    "lalala512/lexlattice-2d-nca",
    checkpoint="consolidator_2d_rl.safetensors",   # or consolidator_2d.safetensors
)

# A document is a list of sections; each section is a list of paragraph strings.
sections = [
    ["Paragraph 1 of the preamble...", "Paragraph 2 of the preamble..."],
    ["Article 1 text...", "Article 2 text..."],
]
summary = model.summarize(sections, lang="english", budget_words=600)

# Or get raw per-paragraph salience scores:
texts, scores = model.score_document(sections, lang="english")

Splitting a raw document into sections/paragraphs is up to you; the paper uses a rule-based multilingual parser for EUR-Lex acts (see the project notebooks). Any reasonable hierarchical segmentation works — the lattice clamps overflow beyond 48 sections × 32 paragraphs into the boundary cells (clamp_merge).

Results

ROUGE F1 (×100), macro-averaged over the 24 EUR-Lex-Sum test languages, extractive selection at the reference word budget:

ModelR-1R-2R-Lsum
Random45.2216.3439.39
Lead49.8521.1043.60
BM25-centroid41.4615.9334.44
1D-NCA (reading order only, ablation)48.9821.8742.86
2D-NCA (this repo, supervised)50.6023.2744.31
2D-NCA + RLOO (this repo)50.6722.9244.33

The 2D lattice beats the otherwise-identical 1D-NCA ablation on every metric, i.e. the section axis carries signal beyond reading order. Per-language tables and further ablations (language embedding, cross-lingual zero-shot transfer, parse-noise sensitivity, LLM-judge) are in the accompanying paper.

Model details

Parameters1,797,377 (consolidator) + frozen ~390M encoder (bundled in encoder/)
EncodermT5-base architecture (bundled; see Encoder provenance), masked mean pooling, ≤256 tokens per paragraph
Lattice48 × 32 (section × paragraph), overflow clamp_merge
NCAdepthwise 3×3 perception + 1×1 MLP (hidden 256), 8 steps, deterministic
ReadoutLinear(1536→768) → GELU → Linear(768→1) on [original ⊕ consolidated] states
Languages24 official EU languages, learned language embedding (24 × 768)
Training dataEUR-Lex-Sum train splits, all 24 languages

Encoder provenance

The training environment loaded google/mt5-base through a code path that left the encoder's input-embedding table re-initialized (fixed seed) instead of inheriting mT5's pretrained embeddings, while all transformer blocks loaded correctly. Because the initialization was deterministic, the exact encoder used throughout training and evaluation has been recovered and is shipped in encoder/ — the checkpoints in this repo are bit-exact with the reported results when used with it. Practical consequences:

  • All reported numbers were obtained with this encoder; they are internally consistent and reproducible from this repo alone.
  • The paragraph representation is a contextual transform of a shared random projection of the mT5 SentencePiece vocabulary, not of mT5's pretrained embedding semantics. Results with a correctly-loaded mT5 embedding table may differ (plausibly improve) and will be explored in a future revision.

Intended use & limitations

  • Extractive summarization of hierarchically structured legal/regulatory documents; scores and selects existing paragraphs, never generates text — so it cannot paraphrase or compress within a paragraph.
  • Trained on EUR-Lex acts; transfer to other document genres is untested.
  • The language embedding requires one of the 24 training languages. For unseen languages, see the cross-lingual transfer checkpoints in the paper (trained with the language embedding off).
  • Not legal advice; summaries may omit legally material provisions. Always consult the full act.

Citation

Anonymous submission under review at ACL — citation information withheld during the review period.

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

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

GPU в ailist

Универсальный рантайм · pytorch

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

Репозиторий недоступен на Hugging Face.

Ревизия весов
8b74c02

0 моделей