CoolFace
Modelpublic

gothitech/GT-REX

sourceHugging Facemitupdated 7mo agoView on Hugging Face
0likes9downloads
Model Card

GT-REX: Production OCR Model

<p align="center"> <strong>GothiTech Recognition and Extraction eXpert</strong> </p>

<p align="center"> <a href="https://huggingface.co/gothitech/GT-REX"><img src="https://img.shields.io/badge/Model-GT--REX-blue" alt="Model"></a> <a href="#"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License: MIT"></a> <a href="#"><img src="https://img.shields.io/badge/vLLM-Supported-orange" alt="vLLM"></a> <a href="#"><img src="https://img.shields.io/badge/Params-~3B-red" alt="Parameters"></a> </p>


GT-REX is a state-of-the-art production-grade OCR model developed by GothiTech for enterprise document understanding, text extraction, and intelligent document processing. Built on a Vision-Language Model (VLM) architecture, it delivers high-accuracy text extraction from complex documents including invoices, contracts, forms, handwritten notes, and dense tables.


Table of Contents


GT-REX Variants

GT-REX ships with three optimized configurations tailored to different performance and accuracy requirements. All variants share the same underlying model weights — they differ only in inference settings.

VariantSpeedAccuracyResolutionGPU MemoryThroughputBest For
NanoUltra FastGood640px4-6 GB100-150 docs/minHigh-volume batch processing
Pro (Default)FastHigh1024px6-10 GB50-80 docs/minStandard enterprise workflows
UltraModerateMaximum1536px10-15 GB20-30 docs/minHigh-accuracy and fine-detail needs

How to Choose a Variant

  • —Nano: You need maximum throughput and documents are simple (receipts, IDs, labels).
  • —Pro: General-purpose. Best balance for invoices, contracts, forms, and reports.
  • —Ultra: Documents have fine print, dense tables, medical records, or legal footnotes.

GT-Rex-Nano

Speed-optimized for high-volume batch processing

SettingValue
Resolution640 x 640 px
Speed~1-2s per image
Max Tokens2048
GPU Memory4-6 GB
Recommended Batch Size256 sequences

Best for: Thumbnails, previews, high-throughput pipelines (100+ docs/min), mobile uploads, receipt scanning.

python
from vllm import LLM

llm = LLM(
    model="gothitech/GT-REX",
    trust_remote_code=True,
    max_model_len=2048,
    gpu_memory_utilization=0.6,
    max_num_seqs=256,
    limit_mm_per_prompt={"image": 1},
)

GT-Rex-Pro (Default)

Balanced quality and speed for standard enterprise documents

SettingValue
Resolution1024 x 1024 px
Speed~2-5s per image
Max Tokens4096
GPU Memory6-10 GB
Recommended Batch Size128 sequences

Best for: Contracts, forms, invoices, reports, government documents, insurance claims.

python
from vllm import LLM

llm = LLM(
    model="gothitech/GT-REX",
    trust_remote_code=True,
    max_model_len=4096,
    gpu_memory_utilization=0.75,
    max_num_seqs=128,
    limit_mm_per_prompt={"image": 1},
)

GT-Rex-Ultra

Maximum quality with adaptive processing for complex documents

SettingValue
Resolution1536 x 1536 px
Speed~5-10s per image
Max Tokens8192
GPU Memory10-15 GB
Recommended Batch Size64 sequences

Best for: Legal documents, fine print, dense tables, medical records, engineering drawings, academic papers, multi-column layouts.

python
from vllm import LLM

llm = LLM(
    model="gothitech/GT-REX",
    trust_remote_code=True,
    max_model_len=8192,
    gpu_memory_utilization=0.85,
    max_num_seqs=64,
    limit_mm_per_prompt={"image": 1},
)

Key Features

FeatureDescription
High AccuracyAdvanced vision-language architecture for precise text extraction
Multi-LanguageHandles documents in English and multiple other languages
Production ReadyOptimized for deployment with the vLLM inference engine
Batch ProcessingProcess hundreds of documents per minute (Nano variant)
Flexible PromptsSupports structured extraction: JSON, tables, key-value pairs, forms
Handwriting SupportTranscribes handwritten text with high fidelity
Three VariantsNano (speed), Pro (balanced), Ultra (accuracy)
Structured OutputExtract data directly into JSON, Markdown tables, or custom schemas

Model Details

AttributeValue
DeveloperGothiTech (Jenis Hathaliya)
ArchitectureVision-Language Model (VLM)
Model Size~6.5 GB
Parameters~7B
LicenseMIT
Release DateFebruary 2026
PrecisionBF16 / FP16
Input Resolution640px - 1536px (variant dependent)
Max Sequence Length2048 - 8192 tokens (variant dependent)
Inference EnginevLLM (recommended)
FrameworkPyTorch / Transformers

Quick Start

Get running in under 5 minutes:

python
from vllm import LLM, SamplingParams
from PIL import Image

# 1. Load model (Pro variant - default)
llm = LLM(
    model="gothitech/GT-REX",
    trust_remote_code=True,
    max_model_len=4096,
    gpu_memory_utilization=0.75,
    max_num_seqs=128,
    limit_mm_per_prompt={"image": 1},
)

# 2. Prepare input
image = Image.open("document.png")
prompt = "Extract all text from this document."

# 3. Run inference
sampling_params = SamplingParams(
    temperature=0.0,
    max_tokens=4096,
)

outputs = llm.generate(
    [{
        "prompt": prompt,
        "multi_modal_data": {"image": image},
    }],
    sampling_params=sampling_params,
)

# 4. Get results
result = outputs[0].outputs[0].text
print(result)

Installation

Prerequisites

  • —Python 3.9+
  • —CUDA 11.8+ (GPU required)
  • —8 GB+ VRAM (Pro variant), 4 GB+ (Nano), 12 GB+ (Ultra)

Install Dependencies

bash
pip install vllm pillow torch transformers

Verify Installation

python
from vllm import LLM
print("vLLM installed successfully!")

Usage Examples

Basic Text Extraction

python
prompt = "Extract all text from this document image."

Structured JSON Extraction

python
prompt = '''Extract the following fields from this invoice as JSON:
{
    "invoice_number": "",
    "date": "",
    "vendor_name": "",
    "total_amount": "",
    "line_items": [
        {"description": "", "quantity": "", "unit_price": "", "amount": ""}
    ]
}'''

Table Extraction (Markdown Format)

python
prompt = "Extract all tables from this document in Markdown table format."

Key-Value Pair Extraction

python
prompt = '''Extract all key-value pairs from this form.
Return as:
Key: Value
Key: Value'''

Handwritten Text Transcription

python
prompt = "Transcribe all handwritten text from this image accurately."

Multi-Document Batch Processing

python
from PIL import Image
from vllm import LLM, SamplingParams

llm = LLM(
    model="gothitech/GT-REX",
    trust_remote_code=True,
    max_model_len=4096,
    gpu_memory_utilization=0.75,
    max_num_seqs=128,
    limit_mm_per_prompt={"image": 1},
)

# Prepare batch
image_paths = ["doc1.png", "doc2.png", "doc3.png"]
prompts = []
for path in image_paths:
    img = Image.open(path)
    prompts.append({
        "prompt": "Extract all text from this document.",
        "multi_modal_data": {"image": img},
    })

# Run batch inference
sampling_params = SamplingParams(temperature=0.0, max_tokens=4096)
outputs = llm.generate(prompts, sampling_params=sampling_params)

# Collect results
for i, output in enumerate(outputs):
    print(f"--- Document {i + 1} ---")
    print(output.outputs[0].text)
    print()

Use Cases

DomainApplicationRecommended Variant
FinanceInvoice processing, receipt scanning, bank statementsPro / Nano
LegalContract analysis, clause extraction, legal filingsUltra
HealthcareMedical records, prescriptions, lab reportsUltra
GovernmentForm processing, ID verification, tax documentsPro
InsuranceClaims processing, policy documentsPro
EducationExam paper digitization, handwritten notesPro / Ultra
LogisticsShipping labels, waybills, packing listsNano
Real EstateProperty documents, deeds, mortgage papersPro
RetailProduct catalogs, price tags, inventory listsNano

Performance Benchmarks

Throughput by Variant (NVIDIA A100 80GB)

VariantSingle ImageBatch (32)Batch (128)
Nano~1.2s~15s~55s
Pro~3.5s~45s~170s
Ultra~7.0s~110s~380s

Accuracy by Document Type (Pro Variant)

Document TypeCharacter AccuracyField Accuracy
Printed invoices98.5%+96%+
Typed contracts98%+95%+
Handwritten notes92%+88%+
Dense tables96%+93%+
Low-quality scans94%+90%+
Note: Benchmark numbers are approximate and may vary based on document quality, content complexity, and hardware configuration.

Prompt Engineering Guide

Get the best results from GT-REX with these prompt strategies:

Tips for Best Results

Do:

  • —Be specific about what to extract ("Extract the invoice number and total amount")
  • —Specify output format ("Return as JSON", "Return as Markdown table")
  • —Provide schema for structured extraction (show the expected JSON keys)
  • —Use clear instructions ("Transcribe exactly as written, preserving spelling errors")

Don't:

  • —Use vague prompts ("What is this?")
  • —Ask for analysis or summarization (GT-REX is optimized for extraction)
  • —Include unrelated context in the prompt

Example Prompts

text
# Simple extraction
"Extract all text from this document."

# Targeted extraction
"Extract only the table on this page as a Markdown table."

# Schema-driven extraction
"Extract data matching this schema: {name: str, date: str, amount: float}"

# Preservation mode
"Transcribe this document exactly as written, preserving original formatting."

API Integration

FastAPI Server Example

python
from fastapi import FastAPI, UploadFile
from PIL import Image
from vllm import LLM, SamplingParams
import io

app = FastAPI()

llm = LLM(
    model="gothitech/GT-REX",
    trust_remote_code=True,
    max_model_len=4096,
    gpu_memory_utilization=0.75,
    max_num_seqs=128,
    limit_mm_per_prompt={"image": 1},
)

sampling_params = SamplingParams(temperature=0.0, max_tokens=4096)


@app.post("/extract")
async def extract_text(file: UploadFile, prompt: str = "Extract all text."):
    image_bytes = await file.read()
    image = Image.open(io.BytesIO(image_bytes)).convert("RGB")

    outputs = llm.generate(
        [{
            "prompt": prompt,
            "multi_modal_data": {"image": image},
        }],
        sampling_params=sampling_params,
    )

    return {"text": outputs[0].outputs[0].text}

cURL Example

bash
curl -X POST "http://localhost:8000/extract" \
  -F "file=@invoice.png" \
  -F "prompt=Extract all text from this invoice as JSON."

Troubleshooting

IssueSolution
CUDA Out of MemoryReduce gpu_memory_utilization or switch to Nano variant
Slow inferenceIncrease max_num_seqs for better batching; use Nano for speed
Truncated outputIncrease max_tokens in SamplingParams
Low accuracy on small textSwitch to Ultra variant for higher resolution
Garbled multilingual textEnsure image resolution is sufficient; try Ultra variant
Empty outputCheck that the image is loaded correctly and is not blank
Model loading errorsEnsure trust_remote_code=True is set

Hardware Recommendations

VariantMinimum GPURecommended GPU
NanoNVIDIA T4 (16 GB)NVIDIA A10 (24 GB)
ProNVIDIA A10 (24 GB)NVIDIA A100 (40 GB)
UltraNVIDIA A100 (40 GB)NVIDIA A100 (80 GB)

License

This model is released under the MIT License. You are free to use, modify, and distribute it for both commercial and non-commercial purposes.


Citation

If you use GT-REX in your work, please cite:

bibtex
@misc{gtrex-2026,
  title   = {GT-REX: Production-Grade OCR with Vision-Language Models},
  author  = {Hathaliya, Jenis},
  year    = {2026},
  month   = {February},
  url     = {https://huggingface.co/gothitech/GT-REX},
  note    = {GothiTech Recognition and Extraction eXpert}
}

Contact and Support

  • —Developer: Jenis Hathaliya
  • —Organization: GothiTech
  • —HuggingFace: gothitech

<p align="center"> Built by <strong>GothiTech</strong> </p>

<p align="center"> <em>Last updated: February 2026</em><br> <em>GT-REX | Variants: Nano | Pro | Ultra</em> </p>