File size: 2,975 Bytes
bfda15f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f4708fd
 
 
 
 
2adbcf5
f4708fd
 
 
 
 
 
 
 
 
 
6381f12
f4708fd
 
2adbcf5
f4708fd
 
 
 
 
 
 
6381f12
f4708fd
 
2adbcf5
f4708fd
 
 
 
 
 
6381f12
f4708fd
6381f12
f4708fd
 
 
 
 
 
 
 
e241053
6381f12
 
f4708fd
e241053
 
 
 
 
 
 
f4708fd
 
 
 
 
 
 
 
 
 
 
6381f12
f4708fd
 
 
 
 
 
 
 
 
 
 
e241053
f4708fd
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
license: apache-2.0
language:
- en
- vi
tags:
- vision-language
- document-ai
- vlm
- ocr
pipeline_tag: image-to-text
---

# Doc2Bit-VL-7B

Doc2Bit-VL-7B is a vision-language model fine-tuned for document understanding.

# 📄 Document Information Extraction VLM

A Vision-Language Model (VLM) specialized in **document understanding and information extraction**, supporting both **unstructured information** and **structured data (tables)** from document images.

This model is optimized for production usage via **vLLM serving** with an **OpenAI-compatible API**.

---
## 🚀 Features
- Vision-Language Model for document images
- Extracts **unstructured key–value information**
- Extracts **structured table data**, including **column-wise extraction**
- Handles complex layouts (forms, invoices, reports, product tables)
- Strict output formatting (no hallucination)
- Compatible with **vLLM OpenAI-style API**
- Prompting optimized for **Vietnamese instructions**
---

## 📌 Supported Data Types
### 1. Unstructured Information

Extract specific fields defined by the user, such as:
- Invoice number
- Date
- Company name
- Address
- Total amount
- Custom document attributes

---
### 2. Structured Table Data

Designed for extracting **individual columns** from tables, especially product tables.
Capabilities:
- Column-level extraction
- Ignore non-product rows
- Markdown-formatted output
- Clean and deterministic structure

---

## 🔧 Deployment (vLLM)
This model is intended to be deployed using **vLLM** with an OpenAI-compatible interface.
Example:
```bash
vllm serve <model-path-or-name> \
  --served-model-name document-vlm \
  --port 8000
```
## Prompt Usage
Unstructured Data Extraction Prompt Example

```bash
prompt = f"""QUERY Trích xuất thông tin: {field_names}.
            INSTRUCTION:
            - Bắt buộc dữ liệu trả về theo format <index>. <key>:<value>, trong đó <index> là số thứ tự (1, 2, 3, 4, ...)
            - key lấy chính xác từ trong QUERY của tôi
            - không tự bịa dữ liệu và coi đó là điều hiển nhiên
            - nếu không thể trích xuất thì hãy trả lời: tôi không thể tìm thấy dữ liệu này
            """
```
Expected Output
```bash
1. Số hóa đơn: INV-001
2. Ngày phát hành: 12/03/2024
3. Tổng tiền: 1.250.000 VND
```
If data cannot be extracted:
```bash
tôi không thể tìm thấy dữ liệu này
```
Structured Table (Column-wise) Extraction Prompt Example

```bash
prompt = (
    f"trích xuất thông tin tương ứng với sản phẩm của cột {col_name} trong bảng sản phẩm.\n"
    "INSTRUCTION:\n"
    "Xuất kết quả dưới dạng markdown một cột.\n"
    "Bỏ qua những hàng không phải sản phẩm.\n"
    f"Yêu cầu tiêu đề cột là |{col_name}|.\n"
)
```
Expected Output
```bash
|Tên sản phẩm|
|------------|
|Sản phẩm A|
|Sản phẩm B|
|Sản phẩm C|
```