Text Classification
Transformers
Safetensors
longformer
reward-model
reranking
literary-style
faithfulness
Instructions to use 3rd-Degree-Burn/LongformerRM-Unison with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 3rd-Degree-Burn/LongformerRM-Unison with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="3rd-Degree-Burn/LongformerRM-Unison")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("3rd-Degree-Burn/LongformerRM-Unison") model = AutoModelForSequenceClassification.from_pretrained("3rd-Degree-Burn/LongformerRM-Unison") - Notebooks
- Google Colab
- Kaggle
| license: mit | |
| library_name: transformers | |
| tags: | |
| - reward-model | |
| - reranking | |
| - literary-style | |
| - faithfulness | |
| - longformer | |
| pipeline_tag: text-classification | |
| # LongformerRM-Unison | |
| Absolute multi-head reward model for literary writing. | |
| ## Heads | |
| This model outputs 3 logits in this order: | |
| 1. `style` | |
| 2. `faith` | |
| 3. `identifier` | |
| Apply sigmoid to each logit to obtain scores in `[0, 1]`. | |
| ## Intended use | |
| This model can be used in two ways: | |
| ### 1. Rewrite scoring (primary use) | |
| Score a `(source passage, rewrite)` pair for: | |
| - stylistic quality | |
| - semantic/content faithfulness | |
| - identifier preservation (names, dates, numbers, protected spans) | |
| ### 2. Standalone chunk scoring (experimental workaround) | |
| Score a single passage chunk by pairing it with a **synthetically corrupted but grammatical pseudo-source** derived from that same chunk. | |
| In this mode: | |
| - `style_score` is still meaningful | |
| - `faith_score` and `identifier_score` become **proxy scores relative to the synthetic pseudo-source** | |
| - the resulting overall score is a **proxy chunk-ranking score**, not a true rewrite-faithfulness score | |
| ## Important | |
| This is **not** a comparative Bradley-Terry reward model. | |
| It is an **absolute scorer**. Score each candidate independently, then sort externally. | |
| ## Input format | |
| Use exactly: | |
| ```text | |
| ### Original Draft: | |
| {prompt} | |
| ### Rewritten Version: | |
| {response} | |
| ```` | |
| For Longformer inference, set `global_attention_mask[:, 0] = 1`. | |
| ## Rewrite scoring | |
| For normal rewrite evaluation, use the real source passage as `prompt` and the candidate rewrite as `response`. | |
| ## Standalone chunk scoring | |
| If you only have a passage chunk and no source passage, the recommended workaround is: | |
| * generate a **synthetically corrupted, flatter, still grammatical** version of the chunk | |
| * place that synthetic corruption in `Original Draft` | |
| * place the real chunk in `Rewritten Version` | |
| This better matches the model’s training format than an empty prompt. | |
| ### Caveat | |
| In standalone chunk mode, `faith` and `identifier` are **not true faithfulness metrics**. They only measure agreement with the synthetic corrupted prompt. | |
| ## Recommended composite score for rewrite scoring | |
| ```python | |
| overall_score = style_score * (0.5 * faith_score + 0.5 * identifier_score) * (identifier_score ** 1.5) | |
| ``` | |
| ## Recommended score for standalone chunk scoring | |
| You can rank by: | |
| * `proxy_overall_score` if using a synthetic corrupted prompt | |
| * or just `style_score` if you want the simplest signal | |
| The synthetic-prompt method usually produces more separation between chunks than an empty-prompt style-only setup. | |
| ## Output head order | |
| ```python | |
| [style_logit, faith_logit, identifier_logit] | |
| ``` | |
| ## Base model | |
| `allenai/longformer-base-4096` | |