aboutteamprojectsblogschat
aboutteamprojectsblogschat
© 2026 ottomind.ai
← Back to blogs

COREOCR: End-to-End Document Processing for Arabic Handwriting.

15 min read · Sep 24, 2025

OCR, in its simplest form, is the technology that transforms the text inside a document or image into a form that a machine can understand. But when the problem shifts to handwriting, low-quality scans, and degraded pages, the task is no longer just about reading characters; it becomes a deeper document processing problem that must understand context, preserve structure, and tolerate error. [2][3][4]

On the Arabic handwriting side, this difficulty becomes several times greater. The way letters flow into one another, the fact that characters change shape depending on position, diacritics, irregular line flow, and limited data resources all make this area directly more difficult. That is why many approaches that work well in the broader OCR world either remain superficial or lose consistency in real usage scenarios when applied to Arabic handwriting. [2]

That was exactly the starting point of COREOCR: to build a system that does not merely read Arabic handwriting, but can turn it into genuinely usable digital data. [2]

Where the OCR world stands today

The OCR world has not progressed for a long time around a single model family. CNN, LSTM, and CNN-LSTM-CTC structures established an important threshold in handwritten text recognition; but in connected, fluid, and context-sensitive scripts such as Arabic, reading characters sequentially is often not enough. [1][2][5]

For this reason, on the COREOCR side we made the core model choice in favor of transformers. The reason is simple: transformer-based structures can process the line more holistically, carry context more effectively, and capture the long dependencies in Arabic handwriting more stably. In a field where character relations and intra-line flow are critical, that difference directly reflects in quality. [6][14]

What COREOCR aims to do and why COREOCR

When developing COREOCR, our starting point was very clear: we needed a core technology for Arabic handwriting that truly works, scales, and can be adapted to real document workflows. Because the problem here is not only reading text; it is managing line flow, document structure, character relationships, and end-use quality together. [2]

For this reason, we did not reduce the problem to the recognition model alone. We designed COREOCR not around a single core model, but around layers that feed one another. We built a complete system that prepares the input image, separates the lines [7], orders them, reads the content in a transformer-based core [6], reconstructs the structure, and logically consolidates the final output. For us, then, COREOCR is not an OCR engine; it is a document intelligence pipeline developed for Arabic handwriting. [6][7]

How the COREOCR pipeline works

On the COREOCR side, the flow begins with a full-page document image and ends with a structured digital output. At the center here is not a standalone OCR model; there is an orchestration structure that passes the document through a controlled end-to-end flow. [6][7]

Input and orchestration layer

In the first layer of the flow, the document image is taken into the system and the processing sequence is managed by a central layer. This layer does not leave the document as a single visual block; it transforms it into a structure that downstream stages can operate on, activates the relevant services in sequence, and finally gathers all outputs back into a single structure. In this way, the system behaves not like an OCR service that merely returns text, but like a document intelligence flow that processes the entire document in a controlled way. This is especially important in Arabic handwriting, because even a small segmentation or ordering error can distort the meaning of the whole document. [6][7]

Image preparation and line logic

In the next stage, the document is processed in a way that improves readability, and the text flow is interpreted at the line level. The purpose here is not to make the visual “look nice”; it is to prepare an input on which the segmentation and recognition layers can work more consistently. Especially in handwritten documents, stains, glare, contrast issues, irregular line flow, and complex layout structures directly affect recognition quality. For this reason, COREOCR focuses not only on locating text, but also on reading it in the correct order and with the correct logic. In a right-to-left language such as Arabic, these layers become components that directly determine quality. [3][7]

Recognition and structural output

In the recognition layer, the content is processed line by line, and the transformer-based core model comes into play here [6]. The reason for this choice is that it can treat the line more holistically, carry context better, and produce more stable results in context-dependent scripts such as Arabic. But COREOCR does not stop here by returning raw text; it also structurally consolidates the recognized content, reconstructs word and sentence relations, and moves the output into a form that can be used by other systems later on. In other words, what is obtained at the end of this stage is not merely recognized lines, but already a meaningful digital data layer. [6]

Why LLM Fix exists

An OCR system can sometimes read characters with a largely correct output and still fail to produce text that is directly usable. Especially in Arabic handwritten documents, small character errors, spacing shifts, number-character confusions, and disruptions in paragraph flow reduce the real value of the output. That is why in COREOCR, LLM Fix is not a decorative addition added afterward; it is a meaningful part of the pipeline. The goal here is not to rewrite the model, but to make the resulting text more consistent, more coherent, and more usable. [6]

What we do on the LLM Fix side can be grouped, in the simplest form, around three aims:

  • correcting small but critical errors coming from OCR
  • strengthening the contextual and linguistic consistency of the text
  • making the output more usable while preserving paragraph and logical flow [6]

We are not talking here about a layer that only performs textual corrections. This layer also plays a role in transforming OCR output into a more coherent text structure. In the improvements we made, we observed that this final correction layer had a direct effect on overall quality; especially on contextual consolidation and end-use quality, it made a serious difference. In some scenarios, we even observed that this layer could reduce the error rate in a meaningful way. [6]

For this reason, in COREOCR the LLM is not a structure that replaces the core OCR model. It is the final layer that makes the output generated by the core cleaner, more portable, and more usable. For us, the real value lies exactly here: not merely reading the document, but making the document genuinely usable. [6]

Data sets and data preparation

One of the most difficult topics on the COREOCR side was not model selection, but the data side. Because even though it may appear that there is data for Arabic handwriting, not every dataset is directly suitable for training. Due to reasons such as quote quality, writing style, document type, resolution, label consistency, and domain differences, many data sources are not usable in their raw form. That is why we did not only collect datasets; we filtered them, cleaned them, reorganized them, and made them suitable for the training flow. Our goal was not just to gather a lot of data, but to build data that is truly useful. [8][9][10][11]

On this side, we made use of data sources with different characteristics. Public datasets gave us a strong foundation in terms of different writing styles, historical document structures, and variable text flows. In addition, we reserved documents that were closer to our own target domain not for direct training, but for evaluation and development tracking. This distinction mattered to us, because the issue was not only to look good on public datasets, but to produce reliable quality in our actual use domain. We also did not remain limited to a single type of data; across different document characteristics and different writing habits, we established a more balanced data structure that would support the model’s ability to generalize. [8][9][10][11]

Synthetic data generation also became an important part of this process. Variations that we could not learn from real data were carried in a controlled way into the synthetic generation pipeline. Thanks to this structure, the model could be exposed at the line level to different writing characteristics, different document conditions, and different types of noise. [12][13]

Our training approach

On the COREOCR side, we did not establish the training process according to classical OCR habits. In older approaches, it is quite common to train separate models on separate datasets. We saw, however, that in a field like Arabic handwriting—where diversity is high and context is strong—this was not sufficient. For this reason, instead of the single-dataset / single-model logic, we adopted a multilayered training approach capable of producing broader generalization. [6]

Two-stage learning design

We designed the training flow in two main phases:

  • first, broad synthetic pretraining
  • then, fine-tuning with multiple datasets carrying real-world diversity [6]

While the synthetic pretraining side established a strong foundation, the second stage carried out with multiple datasets clearly strengthened the model’s generalization capability. [6]

We optimized not only the data, but also the input structure

In this process, we did not rely only on the amount of data. Since the way the input structure is presented to the model is equally critical, we also made various optimizations on the input side in the training pipeline;

  • line-based decomposition,
  • input sizes that yield higher utility,
  • sensitivity to numbers and spaces

were addressed in particular. In addition, to make the final output more consistent, extra layers that support word positions and logical structural flow also became part of this training. In other words, what was done here was not merely “data + optimization”; the input structure, training strategy, multi-dataset balance, and end-use quality were handled together.

Why this approach?

The main reason we chose this method was this:

  • Arabic handwriting is highly variable
  • a single data source does not represent the real world
  • the model must not only read correctly, but also remain stable under different document conditions [6]

For this reason, our goal on the training side was not narrow success, but broader reliability. In the end, the resulting structure stopped being an experiment that looked good on a certain sample set and became a core that could be carried into wider usage scenarios. [6]

The results we obtained

At the end of this work, what we saw was this: when the right data design, the right pipeline, and the right model selection come together, it becomes possible to build a genuinely strong core for Arabic handwriting. With COREOCR, we did not only build an experiment that looked good on certain test sets; we established an end-to-end system that can approach strong accuracy on documents coming from different domains, operate offline, and transform full-page input into structural output. We also demonstrated that the system can run fully offline end-to-end and can be used in a production-like flow on the same machine together with all sub-services. [6]

The level we reached on the accuracy side

On the results side, we did not remain merely at the level of “it works”; on some critical datasets, we also surpassed benchmarked results. In particular, the error rates we obtained on Muharaf and KHATT pointed to a new performance line within our own comparisons. We reached 5.6% CER on Muharaf and 3.1% CER on KHATT. These values indicate a new level in our comparative tables, surpassing previous strong results. [14]

What was actually important?

From our perspective, the most critical point was not only these numbers. What really mattered was that this performance was not confined to a single dataset or a narrow document type. When training with multiple datasets, more careful input processing, and the LLM-based correction in the final layer worked together, we saw that we could carry the success into broader scenarios [6]. That is what turned COREOCR from being merely an interesting research-level model into a technology usable in real document workflows. We also observed that the final correction layer could reduce the error rate by around 20%; this created a difference that was directly felt in end-use quality. [6]

Operational result

Another important result is this: we confirmed that this structure works not only in the laboratory, but also in practical workflows. The end-to-end structure running as an offline service was tested in different hardware environments, and page-level processing times became clear enough to shape production decisions. This gave us a strong foundation not only in accuracy, but also in usability and deployability. In short, what emerged on the COREOCR side was not merely a model that reads better; it became a document intelligence core that can work in the real world. [6]

Conclusion and future

For us, COREOCR is not a finished research output; it is a core technology that continues to grow. What the structure we have built so far clearly showed us is this: in a difficult field such as Arabic handwriting, quality is not determined by a single model. What actually creates the difference is:

  • the right data diversity,
  • the right preprocessing,
  • the right segmentation flow,
  • strong recognition,
  • and the logical correction performed in the final layer.

That is exactly why we see COREOCR not as a single model, but as an infrastructure open to expansion. Because for us, the issue is not reading a document; it is transforming that document into a digital layer that all downstream systems can use with confidence.

Its place inside CORETECHX

COREOCR is the first and most critical step of all the other layers inside CORETECHX. Because unless the document is read correctly;

  • the editing side cannot work properly,
  • structural data extraction cannot be reliable,
  • vectorization cannot rest on the right ground,
  • CORECHAT cannot reach the quality we want in semantic access.

In other words, COREOCR is not only a model that can read documents. It is the foundational technology that truly digitizes Arabic handwriting, turns it into structure, and makes it usable for all the other layers inside CORETECHX. The rest of CORETECHX’s intelligence is built, to a large extent, on the quality of the output produced here. In fact, our document intelligence approach aims exactly at this: taking the page image and transforming it into an output that is cleaned, ordered, corrected, and structurally usable.

What we aim for next

At the next stage, our goal is to make COREOCR stronger, more general, and more production-ready. For this, the directions we focus on are:

  • collecting labeled data that is closer to the target domain, of higher quality and greater variety,
  • increasing synthetic data diversity in numbers, dates, punctuation, and complex page structures,
  • strengthening generalization capability with samples from more distant domains,
  • making the system more efficient with quantization and similar optimizations,
  • advancing the LLM Fix side with more specialized and stronger correction layers,
  • and in the long term, growing the synthetic generation side more aggressively through GAN-based handwritten data generation. [12][13]

Our current estimates indicate that with sufficiently large and well-curated real data, it is possible to approach much lower CER levels. In short, COREOCR is not, for us, a completed task; it is a foundational technology that works today, and tomorrow aims to operate with the same confidence across a much wider universe of documents.

References

[1] H. Scheidl, “Handwritten text recognition in historical documents,” 2018.

[2] S. Faizullah, M. S. Ayub, S. Hussain, and M. A. Khan, “A survey of OCR in Arabic language: Applications, techniques, and challenges,” Applied Sciences, 2023.
DOI: 10.3390/app13074584.

[3] G. Vamvakas, B. Gatos, N. Stamatopoulos, and S. Perantonis, “A complete optical character recognition methodology for historical documents,” 2008 The Eighth IAPR International Workshop on Document Analysis Systems, pp. 525–532, 2008.
DOI: 10.1109/DAS.2008.73.

[4] M. Jenckel, S. S. Bukhari, and A. Dengel, “AnyOCR: A sequence learning based OCR system for unlabeled historical documents,” 2016 23rd International Conference on Pattern Recognition (ICPR), pp. 4035–4040, 2016.
DOI: 10.1109/ICPR.2016.7900265.

[5] P. Verma and G. Foomani, “Improvement in OCR technologies in postal industry using CNN-RNN architecture: Literature review,” International Journal of Machine Learning and Computing, vol. 12, no. 5, pp. 154–163, 2022.

[6] M. Li et al., TrOCR: Transformer-based optical character recognition with pre-trained models, 2022. arXiv:2109.10282 [cs.CL]. [Online]. Available:
https://arxiv.org/abs/2109.10282

[7] C. Neche, A. Belaid, and A. Kacem-Echi, “Arabic handwritten documents segmentation into text-lines and words using deep learning,” in 2019 International Conference on Document Analysis and Recognition Workshops (ICDARW), vol. 6, 2019, pp. 19–24.
DOI: 10.1109/ICDARW.2019.50110.

[8] S. A. Mahmoud et al., “KHATT: Arabic offline handwritten text database,” in 2012 International Conference on Frontiers in Handwriting Recognition, 2012, pp. 449–454.
DOI: 10.1109/ICFHR.2012.224.

[9] M. Saeed et al., Muharaf: Manuscripts of handwritten Arabic dataset for cursive text recognition, 2025. arXiv:2406.09630 [cs.CV]. [Online]. Available:
https://arxiv.org/abs/2406.09630

[10] L. Nigst, M. Romanov, S. B. Savant, M. Seydi, P. Verkinderen, and H. Hakimi, OpenITI: A machine-readable corpus of Islamicate texts, version 2023.1.8, Zenodo, Oct. 2023.
DOI: 10.5281/zenodo.10007820. [Online]. Available:
https://doi.org/10.5281/zenodo.10007820

[11] M. Kassis, A. Abdalhaleem, A. Droby, R. Alaasam, and J. El-Sana, “VML-HD: The historical Arabic documents dataset for recognition systems,” in 2017 1st International Workshop on Arabic Script Analysis and Recognition (ASAR), 2017, pp. 11–14.
DOI: 10.1109/ASAR.2017.8067751.

[12] M. Eltay, A. Zidouri, I. Ahmad, and Y. Elarian, “Generative adversarial network based adaptive data augmentation for handwritten Arabic text recognition,” PeerJ Computer Science, vol. 8, 2022.
DOI: 10.7717/peerj-cs.861.

[13] DeepSeek-AI et al., DeepSeek-V3 technical report, 2024. arXiv:2412.19437 [cs.CL]. [Online]. Available:
https://arxiv.org/abs/2412.19437

[14] A. Chan, A. Mijar, M. Saeed, C.-W. Wong, and A. Khater, HATFormer: Historic handwritten Arabic text recognition with transformers, 2024. arXiv:2410.02179 [cs.CV]. [Online]. Available:
https://arxiv.org/abs/2410.02179