File size: 3,957 Bytes
ed3631f
 
14e6683
 
ed3631f
 
14e6683
 
 
 
 
 
 
 
 
ed3631f
 
 
14e6683
ed3631f
 
 
14e6683
ed3631f
14e6683
ed3631f
 
14e6683
 
 
 
ed3631f
 
 
14e6683
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ed3631f
14e6683
ed3631f
14e6683
 
 
 
ed3631f
14e6683
 
 
ed3631f
14e6683
 
 
 
 
 
 
ed3631f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14e6683
 
ed3631f
 
 
 
084afc3
 
 
 
 
 
 
 
 
 
ed3631f
14e6683
ed3631f
14e6683
ed3631f
14e6683
 
 
 
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
---
library_name: transformers
license: apache-2.0
base_model: google/pix2struct-docvqa-base
tags:
- generated_from_trainer
- invoice-processing
- information-extraction
- czech-language
- document-ai
- multimodal-model
- generative-model
- synthetic-data
- hybrid-data
- real-data
metrics:
- f1
model-index:
- name: Pix2StructCzechInvoice-V3
  results: []
---

# Pix2StructCzechInvoice (V3 – Full Pipeline with Real Data Fine-Tuning)

This model is a fine-tuned version of [google/pix2struct-docvqa-base](https://huggingface.co/google/pix2struct-docvqa-base) for structured information extraction from Czech invoices.

It achieves the following results on the evaluation set:
- Loss: 0.1542  
- F1: 0.8404  

---

## Model description

Pix2StructCzechInvoice (V3) is the final generative model in the experimental pipeline.

Unlike token classification approaches, this model:
- processes full document images  
- generates structured outputs as text sequences  

It extracts key invoice fields such as:
- supplier  
- customer  
- invoice number  
- bank details  
- totals  
- dates  

By combining synthetic, hybrid, and real data, this version significantly improves both performance and stability.

---

## Training data

The dataset used in this stage combines:

1. **Synthetic template-based invoices (V0)**  
2. **Synthetic invoices with randomized layouts (V1)**  
3. **Hybrid invoices with real layouts and synthetic content (V2)**  
4. **Real annotated invoices**  

### Real data fine-tuning

The final stage introduces:
- real invoice images  
- realistic visual noise and distortions  
- natural language variability  
- real formatting inconsistencies  

This allows the model to:
- better align generated outputs with real-world distributions  
- improve robustness of sequence generation  
- reduce hallucinations and formatting errors  

---

## Role in the pipeline

This model corresponds to:

**V3 – Full pipeline (synthetic + hybrid + real data fine-tuning)**

It represents:
- the final generative model  
- the best-performing Pix2Struct variant  
- an end-to-end extraction approach  

---

## Intended uses

- End-to-end invoice information extraction from images  
- Document VQA and generative document understanding  
- OCR-free document processing pipelines  
- Research in generative vs structured extraction approaches  

---

## Limitations

- Output format may still be inconsistent  
- Sensitive to decoding strategy and prompt structure  
- Less interpretable than token classification models  
- Requires post-processing for structured outputs  
- Computationally more expensive  

---

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 0.0001
- train_batch_size: 8
- eval_batch_size: 1
- seed: 42
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: cosine_with_restarts
- lr_scheduler_warmup_steps: 0.1
- num_epochs: 10
- mixed_precision_training: Native AMP

---

### Training results

| Training Loss | Epoch | Step | Validation Loss | F1     |
|:-------------:|:-----:|:----:|:---------------:|:------:|
| 0.3277        | 1.0   | 23   | 0.1958          | 0.7239 |
| 0.2366        | 2.0   | 46   | 0.1446          | 0.8037 |
| 0.1780        | 3.0   | 69   | 0.1247          | 0.8060 |
| 0.1153        | 4.0   | 92   | 0.1178          | 0.8316 |
| 0.0895        | 5.0   | 115  | 0.1279          | 0.8312 |
| 0.0774        | 6.0   | 138  | 0.1542          | 0.8404 |
| 0.0766        | 7.0   | 161  | 0.1530          | 0.7972 |
| 0.0697        | 8.0   | 184  | 0.1385          | 0.8372 |
| 0.0804        | 9.0   | 207  | 0.1433          | 0.7963 |
| 0.0664        | 10.0  | 230  | 0.1614          | 0.7991 |

---

## Framework versions

- Transformers 5.0.0  
- PyTorch 2.10.0+cu128  
- Datasets 4.0.0  
- Tokenizers 0.22.2