How a 0.9B Vision-Language Model Solves Irregular Polygon Text Line Detection for Document Parsing

    This article explains why irregular polygon detection, rather than tighter bounding boxes, is the real bottleneck in document parsing, and how a 0.9B-parameter vision-language model unifies text recognition, table reconstruction, formula transcription, chart-to-table conversion, seal recognition, and text line localization in a single model. It covers polygon-level localization and layout rebuilding, robustness to five types of physical distortion, long-document and specialized scenarios, a five-dimension comparison with general-purpose OCR, and practical guidance on data, inference, engineering, deployment, and quality control. Readers will find concrete evaluation and deployment advice, plus a sample initialization snippet, for building reliable document parsing under a limited compute budget.

    1. Where the Problem Starts: Why Irregular Boxes Are the Real Bottleneck

    Real documents are rarely ideal. Paper feed offset in scanners, perspective distortion from phone cameras, curved warping in bound books, glass glare, and uneven lighting all mean text lines are no longer neat horizontal rectangles. A conventional pipeline first runs a detection model to produce axis-aligned or four-point boxes, then hands the crops to a recognition model. Once a document is skewed or curved, the detection box no longer matches the geometric center of the text line, the crop pulls in pixels from neighboring lines, and the recognition layer starts merging characters, dropping characters, and scrambling line order. Table and layout reconstruction then fails completely.

    The core of irregular box localization is therefore not “tighter boxes” but keeping detection output isomorphic to the true geometry of each text line. Polygon-level localization models a text line as a controllable point set, giving perspective correction, reading-order rebuilding, and cross-page merging a stable geometric foundation. This is the dividing line for whether end-to-end document parsing can actually ship.

    2. Breaking Down the Technical Approach: Accuracy and Efficiency at a Small Parameter Count

    2.1 One Vision-Language Model for Multiple Tasks

    Text recognition, table structure reconstruction, formula transcription, chart-to-table conversion, seal recognition, and text line localization are unified into a single vision-language model, avoiding the error accumulation and stacked GPU memory usage that come from chaining multiple models. Keeping the parameter count around 0.9B matters because a single GPU, or even a consumer-grade card, can host it, batch throughput stays high, and the model fits both large offline document batches and synchronous online calls.

    2.2 Polygon Localization and Layout Reconstruction

    The model outputs irregular closed point sets directly, and reading order is recovered with a line-order prediction step. In practice, keep the original precision of the point sets and do not flatten them during preprocessing, or the warping information is lost early. For tables, locating cell outlines before recognizing content noticeably reduces misalignment in merged cells and cross-page tables.

    2.3 Robustness to Physical Distortion

    For five degradation types (scanning artifacts, skew, warping, screen capture, and lighting changes), training and evaluation should include matching augmentation benchmarks. The practical point is that augmentation must stay close to the real capture path, for example simulating lens distortion and moire patterns rather than only geometric rotation. Put sharpness assessment first as well: send low-quality input through super-resolution or denoising, so the model does not waste inference on low signal-to-noise images.

    2.4 Long Documents and Specialized Scenarios

    Merging cross-page tables, recognizing headings of paragraphs that span pages, handling rare characters and ancient texts, multilingual tables, and judging underline and checkbox states determine whether document parsing can enter serious settings such as archives, finance, and government services. When language coverage extends to low-resource languages, verify accuracy on visually similar characters and mixed-layout tables in particular.

    3. Comparison Dimensions Against General-Purpose OCR

    It is not useful to declare a simple winner. Evaluate across dimensions instead. First, geometric adaptability: line-level recall on skewed and warped samples. Second, structural fidelity: completeness of table cells and reading order. Third, robustness: performance decay under the five real degradation types. Fourth, resource cost: GPU memory usage, single-inference latency, and concurrency. Fifth, task coverage: whether extra models are needed for seals, formulas, and charts. The 0.9B-class model is strongest on the third and fourth dimensions, delivering robustness and multi-task coverage at the same time under a controlled compute budget.

    4. Practical Deployment Recommendations

    1. Data: build an evaluation set that includes real capture devices and lighting conditions, and report metrics stratified by degradation type so overall numbers do not hide weak spots.
    2. Inference: load the model file and the vision projection file together, and use absolute paths so a change of working directory does not break initialization; when GPU memory is tight, lower concurrency and input resolution.
    3. Engineering: normalize parsing output into a structured intermediate layer that keeps coordinates, confidence scores, and page-level attribution for secondary validation and human review.
    4. Deployment: decouple model inference from business services, and build an observable pipeline with a container platform, object storage, logging, and monitoring alerts; route batch jobs through a message queue to smooth peaks.
    5. Quality: gate results with both a confidence threshold and rule-based checks, automatically route low-confidence regions back to human review, and close the data loop for continuous iteration.

    Sample initialization logic:

    1. var engine = new VlOcrEngine();
    2. engine.LoadModel(modelPath, projectionPath);
    3. var result = engine.Analyze(imagePath);
    4. foreach (var line in result.Lines)
    5. {
    6. Console.WriteLine($"{line.Text} | {line.Polygon} | {line.Score}");
    7. }

    5. Conclusion

    Irregular box localization is essentially layered geometry modeling plus robustness engineering. With a 0.9B-class vision-language model as the base, combined with polygon localization, evaluation on real degradations, and structured post-processing, stable complex document parsing is achievable within a low compute budget. For model selection, use the degradation distribution of the actual business as the yardstick and replace single-point benchmark runs with stratified evaluation. That is the sustainable engineering decision.