Update README.md
Browse files
README.md
CHANGED
|
@@ -58,6 +58,17 @@ learning rates. A full Phase 1→4 retrain with the corrected collator would be
|
|
| 58 |
The collator fix lives in [`train_phase1.py`](https://github.com/Praxisyn/newtype_cognition/blob/main/train_phase1.py)
|
| 59 |
on the `main` branch; this checkpoint was trained before that fix took effect end-to-end.
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
## Evaluation
|
| 62 |
|
| 63 |
Evaluated on a 50-sample slice of `HuggingFaceM4/DocumentVQA` validation:
|
|
@@ -72,6 +83,31 @@ Most of the 10% exact match comes from samples where the expected answer is the
|
|
| 72 |
visible text on the document (e.g., the company title is the answer to "What is the
|
| 73 |
company name?"). It is **not** evidence of question understanding.
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
## Use Cases
|
| 76 |
|
| 77 |
This model is best suited for tasks that do **not** require understanding a specific question about the document. Given its question-blind behavior, it works well as a document-aware OCR captioner in the following scenarios:
|
|
@@ -91,7 +127,6 @@ Using the model as a first stage to extract text regions, then passing those reg
|
|
| 91 |
**Fine-tuning checkpoint**
|
| 92 |
Starting a domain-specific fine-tune from this checkpoint rather than from `microsoft/Florence-2-large` vanilla, particularly for document-heavy domains.
|
| 93 |
|
| 94 |
-
|
| 95 |
## When Not to Use This Model
|
| 96 |
|
| 97 |
- **Document Question Answering (DocQA):** The model is question-blind and will ignore any natural language question you provide. Do not use it in any pipeline where the output must depend on what the user asks.
|
|
@@ -169,11 +204,9 @@ All datasets streamed; no full local copies retained.
|
|
| 169 |
- A late-stage low-lr "polish" phase **cannot** fix a behavioral bug introduced in
|
| 170 |
earlier phases. Sanity-check inference behavior at the end of Phase 1, not at Phase 4.
|
| 171 |
|
| 172 |
-
|
| 173 |
-
|
| 174 |
## Demo
|
| 175 |
-
Try it live: [Space](https://huggingface.co/spaces/d3p4rt/newtype-cognition-demo)
|
| 176 |
|
|
|
|
| 177 |
|
| 178 |
## License
|
| 179 |
|
|
@@ -188,4 +221,4 @@ MIT (inherited from base model).
|
|
| 188 |
year = {2026},
|
| 189 |
howpublished = {\url{https://huggingface.co/d3p4rt/newtype-cognition}},
|
| 190 |
}
|
| 191 |
-
```
|
|
|
|
| 58 |
The collator fix lives in [`train_phase1.py`](https://github.com/Praxisyn/newtype_cognition/blob/main/train_phase1.py)
|
| 59 |
on the `main` branch; this checkpoint was trained before that fix took effect end-to-end.
|
| 60 |
|
| 61 |
+
**`<OCR_WITH_REGION>` does not produce region coordinates.** Despite its name, the token
|
| 62 |
+
outputs plain text identical to `<OCR>` — bounding box coordinates are not generated.
|
| 63 |
+
The fine-tuning process appears to have collapsed the two tokens to the same behavior,
|
| 64 |
+
likely because the region format (`<loc_N>` tokens) was not well represented in the
|
| 65 |
+
training data or was discarded by the collator.
|
| 66 |
+
|
| 67 |
+
**OCR extracts dominant text only.** Both `<OCR>` and `<OCR_WITH_REGION>` return the
|
| 68 |
+
most visually prominent text in the document (e.g., the largest number or title), not
|
| 69 |
+
a full transcription of all text regions. On template documents with placeholder data,
|
| 70 |
+
this may produce a single value such as `$30` or `$0.00`.
|
| 71 |
+
|
| 72 |
## Evaluation
|
| 73 |
|
| 74 |
Evaluated on a 50-sample slice of `HuggingFaceM4/DocumentVQA` validation:
|
|
|
|
| 83 |
visible text on the document (e.g., the company title is the answer to "What is the
|
| 84 |
company name?"). It is **not** evidence of question understanding.
|
| 85 |
|
| 86 |
+
## Token behavior and recommendations
|
| 87 |
+
|
| 88 |
+
Based on empirical testing, the three most useful task tokens behave as follows:
|
| 89 |
+
|
| 90 |
+
| Token | Behavior | Recommended for |
|
| 91 |
+
|---|---|---|
|
| 92 |
+
| `<OCR>` | Extracts the single most visually dominant text | Quick salience extraction, document indexing |
|
| 93 |
+
| `<OCR_WITH_REGION>` | Identical output to `<OCR>` — region coordinates not generated | Avoid; use `<OCR>` directly |
|
| 94 |
+
| `<MORE_DETAILED_CAPTION>` | Produces a structured natural-language description of the document layout | Thumbnail descriptions, alt-text generation, layout understanding |
|
| 95 |
+
|
| 96 |
+
**`<MORE_DETAILED_CAPTION>` is the most informative token** for document understanding tasks.
|
| 97 |
+
On a standard service invoice it correctly identified the document type, described the
|
| 98 |
+
column structure, and extracted footer text — without being asked any question. Output is
|
| 99 |
+
capped by `max_new_tokens`; increase to 256 or higher to avoid truncation on dense documents.
|
| 100 |
+
|
| 101 |
+
Example output on a service invoice template (`<MORE_DETAILED_CAPTION>`):
|
| 102 |
+
```
|
| 103 |
+
The image is a service invoice template with hourly rate. It has a white background
|
| 104 |
+
and black text. The template is divided into two columns, with the left column containing
|
| 105 |
+
the company name, address, phone number, and email address. The right column contains
|
| 106 |
+
the total amount of the service invoice, which includes the total cost, subtotal,
|
| 107 |
+
discount, and other details. At the bottom of the template, there is a note that reads
|
| 108 |
+
"Thank you" and "Please make check payable to your company name."
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
## Use Cases
|
| 112 |
|
| 113 |
This model is best suited for tasks that do **not** require understanding a specific question about the document. Given its question-blind behavior, it works well as a document-aware OCR captioner in the following scenarios:
|
|
|
|
| 127 |
**Fine-tuning checkpoint**
|
| 128 |
Starting a domain-specific fine-tune from this checkpoint rather than from `microsoft/Florence-2-large` vanilla, particularly for document-heavy domains.
|
| 129 |
|
|
|
|
| 130 |
## When Not to Use This Model
|
| 131 |
|
| 132 |
- **Document Question Answering (DocQA):** The model is question-blind and will ignore any natural language question you provide. Do not use it in any pipeline where the output must depend on what the user asks.
|
|
|
|
| 204 |
- A late-stage low-lr "polish" phase **cannot** fix a behavioral bug introduced in
|
| 205 |
earlier phases. Sanity-check inference behavior at the end of Phase 1, not at Phase 4.
|
| 206 |
|
|
|
|
|
|
|
| 207 |
## Demo
|
|
|
|
| 208 |
|
| 209 |
+
Try it live: [Space](https://huggingface.co/spaces/d3p4rt/newtype-cognition-demo)
|
| 210 |
|
| 211 |
## License
|
| 212 |
|
|
|
|
| 221 |
year = {2026},
|
| 222 |
howpublished = {\url{https://huggingface.co/d3p4rt/newtype-cognition}},
|
| 223 |
}
|
| 224 |
+
```
|