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
+
license_link: https://huggingface.co/skt/A.X-3.1/blob/main/LICENSE
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
- ko
|
| 7 |
+
pipeline_tag: text-classification
|
| 8 |
+
library_name: transformers
|
| 9 |
+
model_id: skt/A.X-Encoder-base
|
| 10 |
+
developers: SKT AI Model Lab
|
| 11 |
+
model-index:
|
| 12 |
+
- name: A.X-Encoder-base
|
| 13 |
+
results:
|
| 14 |
+
- task:
|
| 15 |
+
type: text-classification
|
| 16 |
+
name: kobest
|
| 17 |
+
metrics:
|
| 18 |
+
- type: KoBEST
|
| 19 |
+
value: 85.50
|
| 20 |
+
- task:
|
| 21 |
+
type: text-classification
|
| 22 |
+
name: klue
|
| 23 |
+
metrics:
|
| 24 |
+
- type: KLUE
|
| 25 |
+
value: 86.10
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
# A.X Encoder
|
| 29 |
+
|
| 30 |
+
<div align="center">
|
| 31 |
+
<img src="./assets/A.X_from_scratch_logo_ko_4x3.png" alt="A.X Logo" width="300"/>
|
| 32 |
+
</div>
|
| 33 |
+
|
| 34 |
+
## A.X Encoder Highlights
|
| 35 |
+
|
| 36 |
+
**A.X Encoder** (pronounced "A dot X") is SKT's document understanding model optimized for Korean-language understanding and enterprise deployment.
|
| 37 |
+
This lightweight encoder was developed entirely in-house by SKT, encompassing model architecture, data curation, and training, all carried out on SKTβs proprietary supercomputing infrastructure, TITAN.
|
| 38 |
+
This model utilizes the ModernBERT architecture, which supports flash attention and long-context processing.
|
| 39 |
+
|
| 40 |
+
- **Longer Context**: A.X Encoder supports long-context processing of up to **16,384** tokens.
|
| 41 |
+
- **Faster Inference**: A.X Encoder achieves up to 3x faster inference speed than earlier models.
|
| 42 |
+
- **Superior Korean Language Understanding**: A.X Encoder achieves superior performance on diverse Korean NLU tasks.
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
## Core Technologies
|
| 46 |
+
|
| 47 |
+
A.X Encoder represents **an efficient long document understanding model** for processing a large-scale corpus, developed end-to-end by SKT.
|
| 48 |
+
|
| 49 |
+
This model plays a key role in **data curation for A.X LLM** by serving as a versatile document classifier, identifying features such as educational value, domain category, and difficulty level.
|
| 50 |
+
|
| 51 |
+
## Benchmark Results
|
| 52 |
+
|
| 53 |
+
### Model Inference Speed (Run on an A100 GPU)
|
| 54 |
+
<div align="center">
|
| 55 |
+
<img src="./assets/speed.png" alt="inference" width="500"/>
|
| 56 |
+
</div>
|
| 57 |
+
|
| 58 |
+
### Model Performance
|
| 59 |
+
<div align="center">
|
| 60 |
+
<img src="./assets/performance.png" alt="performance" width="500"/>
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
| Method | BoolQ (f1) | COPA (f1) | Sentineg (f1) | WiC (f1) | **Avg. (KoBEST)** |
|
| 64 |
+
| ----------------------------- | ---------- | --------- | ------------- | -------- | ----------------- |
|
| 65 |
+
| **klue/roberta-base** | 72.04 | 65.14 | 90.39 | 78.19 | 76.44 |
|
| 66 |
+
| **kakaobank/kf-deberta-base** | 81.30 | 76.50 | 94.70 | 80.50 | 83.25 |
|
| 67 |
+
| **skt/A.X-Encoder-base** | 84.50 | 78.70 | 96.00 | 80.80 | **85.50** |
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
| Method | NLI (acc) | STS (f1) | YNAT (acc) | **Avg. (KLUE)** |
|
| 71 |
+
| ----------------------------- | --------- | -------- | ---------- | --------------- |
|
| 72 |
+
| **klue/roberta-base** | 84.53 | 84.57 | 86.48 | 85.19 |
|
| 73 |
+
| **kakaobank/kf-deberta-base** | 86.10 | 84.30 | 87.00 | 85.80 |
|
| 74 |
+
| **skt/A.X-Encoder-base** | 87.00 | 84.80 | 86.50 | **86.10** |
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
## π Quickstart
|
| 78 |
+
|
| 79 |
+
### with HuggingFace Transformers
|
| 80 |
+
|
| 81 |
+
- `transformers>=4.51.0` or the latest version is required to use `skt/A.X-Encoder-base`
|
| 82 |
+
```bash
|
| 83 |
+
pip install transformers>=4.51.0
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
β οΈ If your GPU supports it, we recommend using A.X Encoder with Flash Attention 2 to reach the highest efficiency. To do so, install Flash Attention as follows, then use the model as normal:
|
| 87 |
+
|
| 88 |
+
```bash
|
| 89 |
+
pip install flash-attn --no-build-isolation
|
| 90 |
+
```
|
| 91 |
+
#### Example Usage
|
| 92 |
+
|
| 93 |
+
Using AutoModelForMaskedLM:
|
| 94 |
+
|
| 95 |
+
```python
|
| 96 |
+
import torch
|
| 97 |
+
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
| 98 |
+
|
| 99 |
+
model_id = "skt/A.X-Encoder-base"
|
| 100 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 101 |
+
model = AutoModelForMaskedLM.from_pretrained(model_id, attn_implementation="flash_attention_2", torch_dtype=torch.bfloat16)
|
| 102 |
+
|
| 103 |
+
text = "νκ΅μ μλλ <mask>."
|
| 104 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 105 |
+
outputs = model(**inputs)
|
| 106 |
+
|
| 107 |
+
# To get predictions for the mask:
|
| 108 |
+
masked_index = inputs["input_ids"][0].tolist().index(tokenizer.mask_token_id)
|
| 109 |
+
predicted_token_id = outputs.logits[0, masked_index].argmax(axis=-1)
|
| 110 |
+
predicted_token = tokenizer.decode(predicted_token_id)
|
| 111 |
+
print("Predicted token:", predicted_token)
|
| 112 |
+
# Predicted token: μμΈ
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
Using a pipeline:
|
| 116 |
+
|
| 117 |
+
```python
|
| 118 |
+
import torch
|
| 119 |
+
from transformers import pipeline
|
| 120 |
+
from pprint import pprint
|
| 121 |
+
|
| 122 |
+
pipe = pipeline(
|
| 123 |
+
"fill-mask",
|
| 124 |
+
model="skt/A.X-Encoder-base",
|
| 125 |
+
torch_dtype=torch.bfloat16,
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
input_text = "νκ΅μ μλλ <mask>."
|
| 129 |
+
results = pipe(input_text)
|
| 130 |
+
pprint(results)
|
| 131 |
+
# [{'score': 0.07568359375,
|
| 132 |
+
# 'sequence': 'νκ΅μ μλλ μμΈ.',
|
| 133 |
+
# 'token': 31430,
|
| 134 |
+
# 'token_str': 'μμΈ'}, ...
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
## License
|
| 138 |
+
|
| 139 |
+
The `A.X Encoder` model is licensed under `Apache License 2.0`.
|
| 140 |
+
|
| 141 |
+
## Citation
|
| 142 |
+
```
|
| 143 |
+
@article{SKTAdotXEncoder-base,
|
| 144 |
+
title={A.X Encoder-base},
|
| 145 |
+
author={SKT AI Model Lab},
|
| 146 |
+
year={2025},
|
| 147 |
+
url={https://huggingface.co/skt/A.X-Encoder-base}
|
| 148 |
+
}
|
| 149 |
+
```
|
| 150 |
+
|
| 151 |
+
## Contact
|
| 152 |
+
|
| 153 |
+
- Business & Partnership Contact: [a.x@sk.com](a.x@sk.com)
|