arXiv:2610.11460cs.CVOct 2026

Manuscript Offprint

arXiv:2610.11460

ProtoSemImage: Image-Valued Prototypes with Deformable Row Alignment for Interpretable Document Classification

Mohammad Zare, Pirooz Shamsinejadbabaki

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Mohammad Zare

Artificial Intelligence Lab at

AriooBarzan Engineering Team

Shiraz, Iran

md.zare@sutech.ac.ir

Pirooz Shamsinejadbabaki

Department of Computer Engineering

and Information Technology

Shiraz University of Technology,

Shiraz, Iran

p.shamsinejad@sutech.ac.ir

Abstract— Prototypes in classification models are almost always vectors, and a vector has no readable form. This paper asks what happens when a prototype is an image. Documents give the question a natural form, because a document can be rendered as a multi-channel image in which every token becomes a pixel, so a class representative can take the same shape and the same channel semantics as the inputs it stands for. ProtoSemImage represents each class by one or more visual archetypes: prototype images in a four-channel HSV space whose channels carry named linguistic factors. A Skip-Gram objective learns that color space end to end through a four-dimensional bottleneck, discourse boundary rows become differentiable typed difference rows, and classification reduces to 2D visual template matching: a deformable row alignment between a document image and the archetype bank, in the spirit of dynamic time warping. Because the match is a spatial pattern comparison rather than a linear readout, the model reports where an input departs from its archetype and along which channel, and a generative head decodes each archetype back into text. The image representation works: it beats an otherwise identical model with vector prototypes in all three paired seeds, by between 4.3 and 11.8 points on a ten-class task. The distance-based matching does not. A diagnostic that keeps the representation fixed and swaps only the classifier recovers the sequence baselines, which locates a 20.6-point shortfall in the matching rather than in the color compression, and a benchmark built so that a pair of documents shares a bag of words and differs only in arrangement confirms the layout-preservation it was designed for. We report both directions, because for a representation whose whole purpose is inspect ability, the failure modes are as informative as the gains.

Keywords— Visual Template Matching, Spatial Pattern Recognition, Prototype Learning, Disentangled Representations, Text-as-Image, Interpretability, Convolutional Neural Networks, Document Classification.

I. INTRODUCTION

Prototype-based classifiers occupy a settled place in computer vision. A prototypical network represents each class by a point in embedding space, usually the mean of its members, and classifies by nearest distance [10]. Interpretable variants replace that abstract point with concrete image patches, so a prediction can be justified by showing which training evidence it resembles [11]. Both families rest on an assumption that has gone largely unexamined. The prototype is a vector, or at most a small patch, and neither can be looked at as a whole. A mean vector is also a bag: it discards the arrangement of its members entirely, so two inputs holding the same content in a different order produce the same prototype.

This paper asks what happens when the prototype is a full image. Documents give the question a natural form, because a document can be rendered as a multi-channel image in which every token becomes a pixel. A class representative can then be an image of the same shape and the same channel semantics as the documents it stands for. Classification becomes 2D visual template matching against a small set of such templates, and the templates can be displayed.

Documents have been rendered as images before. SemImage [9] draws each sentence as a row of pixels, inserts boundary rows whose brightness tracks semantic dissimilarity, and assigns meaning to color: hue for topic, saturation for sentiment, value for emphasis. The design buys transparency at the input, and an ablation shows the channel assignment does real work. Three limits remain. The classifier on top is an ordinary softmax, so the decision stays opaque. Channel separation rests on auxiliary losses, a soft constraint that degrades once they are removed. And the boundary rows come from a frozen sentence encoder, fixing the structure the network sees before training begins.

ProtoSemImage answers that question in the affirmative, with a caveat the experiments make plain. Every class is represented by a small set of visual archetypes, each one a prototype image in the same four-channel HSV space used to render documents. Nothing about the arrangement is decorative. An archetype occupies the same grid as a document, so unlike a point it is at least capable of encoding discourse order: in principle an archetype could record that documents of its class open on a neutral note and turn negative partway through. Whether a trained model actually exploits that capacity is a separate question from whether the representation permits it, and Section VI reports what we found when we tested it. Being an image, the archetype can also be displayed. Sharing the channel semantics of the document space, it yields a typed and localized account of disagreement rather than a single scalar. The color space is trained under a Skip-Gram objective, so four channels form a bottleneck that must predict context words, which grounds the space in distributional statistics and lets boundary rows be learned instead of inherited from a frozen encoder. A generative head maps archetypes back to token distributions, so an archetype can be read as well as viewed.

• We introduce image-valued prototypes: a class is represented by one or more learned prototype images in a disentangled color space, which preserves document layout and makes the prototype an inspectable object.

• We learn that color space end to end under a Skip-Gram objective over a four-dimensional HSV bottleneck, which grounds channel semantics in corpus statistics and makes discourse boundary rows differentiable rather than inherited from a frozen encoder.

• We adapt soft dynamic time warping to row-axis alignment between document images and archetypes, handling variable length and returning the correspondence path used for explanation.

• We isolate what the image representation contributes with an otherwise identical vector-prototype model, and locate the remaining accuracy shortfall with a diagnostic that swaps only the classifier.

Section II reviews related work, Section III develops the framework, Sections IV and V report results and ablations, and Sections VI and VII set out what the evidence supports and where the approach falls short..

References (25)