1. Introduction
A compilation-based text editor, such as Overleaf for
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
is a document-preparation system designed for high-quality typesetting. In such systems, users write their documents as free text interleaved with formatting commands. After compilation (e.g., using PdfTeX), the text is transformed into a formatted document (e.g., a PDF). This approach is particularly popular for typesetting academic articles and technical reports.
In these editors, there is a clear separation between the text editor and the formatted document output. Any edits require recompilation in order to visualize their impact on the final document. A common challenge users face is adhering to space constraints, such as AAAI’s 7-page limit. Exceeding these constraints often requires content reduction, which may involve text edits or visual adjustments such as image resizing. Although substantial modifications can effectively save space, they also risk degrading content visibility. For example, reducing an image’s size may render it illegible. We refer to the negative effects of such changes as the of modification, where cost is used as a proxy for the severity of the geometric change induced in the layout rather than as a direct measure of readability loss.
Every edit requires recompilation to assess its impact on the formatted document. If the space constraints remain unsatisfied, further modifications are required. This iterative and time-consuming process involves substantial trial and error. Recognizing this challenge, this paper introduces the Document Space Optimization (DSOpt) problem: searching for the lowest-cost sequence of operators (modifications) that will adjust the document to satisfy the space limitations, while favoring smaller layout changes that are less likely to harm readability and visual coherence.
This paper’s first contribution is the formal definition of the space-constraint problem. Previous research has explored Natural Language Processing (NLP) approaches such as text summarization [
1] and rephrasing for brevity [
2]. These methods have notable drawbacks. Summarization may omit crucial details, and while rephrasing may be helpful, it may also distort the original meaning of the text and alter the authors’ writing style. In addition, many conferences still do not allow the use of LLM tools for rephrasing. Finally, NLP-based techniques are complementary to the challenge addressed in our work and can be integrated into our model. For example, our framework can identify candidate paragraphs for condensation and estimate the desired amount of reduction, after which an external NLP tool could be applied if content rewriting is permitted. To the best of our knowledge, prior work has paid limited attention to document space reduction under fixed-content constraints and without relying on NLP-based rewriting techniques. This challenge is pervasive in academia. Researchers often find that their drafts slightly exceed space limits, and manual adjustments that preserve both clarity and content are laborious.
It is important to note that our work does not address text simplification, paragraph compression, or summarization, as these areas have already been extensively studied. Our focus is specifically on situations in which the author wishes to retain exactly the same content without modifying the text itself. The primary goal is to manipulate the document’s layout and elements in order to reduce the space they occupy. In this context, our proposed approach offers a layout-oriented solution for space optimization without resorting to content-level alterations, thereby preserving the original intent and clarity of the document’s content. This distinction sets our work apart from existing research and highlights the unique value of our proposed system for managing document space constraints while maintaining content integrity. More specifically, the system aims to minimize the extent of local layout changes, under the assumption that smaller geometric edits are generally less likely to damage readability. The final output is then validated separately for readability and layout quality.
Beyond traditional NLP, large language models (LLMs) can paraphrase or compress text. However, such edits inherently change the author’s language and typically trigger additional verification cycles to ensure that meaning, tone, and authorship remain intact. They may also conflict with venue policies that restrict LLM-assisted rewriting. Our approach does not modify the text at all and operates only at the layout level (e.g., float placement, spacing, and micro-typography), keeping the original wording unchanged. This avoids reapproval loops and the cognitive load associated with rephrasing, while delivering controlled and reproducible space savings without content-level changes.
Figure 1 illustrates an example of an article before and after applying manipulations that reduce the number of pages without changing the text itself. The left side of the image shows the original article layout (the last two pages) before reduction. Notably, there is an additional page that includes three overflow lines. In this example, the size of the image in the upper-left column was reduced. As a result, the additional formula in the right column moved up to the first row, allowing the three overflow lines from the second page to move into the right column of the first page. The right side of the image presents the same article after activating this operator, demonstrating how the reduction process successfully condensed the content onto a single page while keeping the original text unchanged and producing an output that remained acceptable under our manual readability and layout quality review.
It is important to note that
Figure 1 is drawn directly from the published dataset and reflects one concrete operator application scenario. In practical deployments, visual consistency constraints (e.g., enforcing uniform scaling across related figures or restricting global typography changes) can be incorporated through the operator profile. The operator pool is configurable, and global layout policies can be enforced by restricting or disabling specific operators when needed.
This paper’s second contribution introduces a search-based approach to address the DSOpt problem. We posit that DSOpt is naturally framed as a combinatorial search problem, compatible with established frameworks such as Best-First Search. Despite this, the problem is challenging due to the expansive operator and state spaces and the time-intensive nature of state generation, which requires document compilation. To address these issues, we propose a greedy algorithm that systematically evaluates candidate operators under a cost-ordered search procedure. In addition, we introduce a machine learning-based prediction model that estimates the space gained by each operator. This prediction model allows the algorithm to focus only on the operations that are likely to be most beneficial, thereby supporting a more efficient document reduction process.
A robust dataset is essential for assessing the efficacy of our prediction model and the
DSOpt algorithms. Public resources tailored to this task have been limited. The third contribution of this paper addresses this gap by curating and making available a vast collection of 329,000 distinct
![Applsci 16 04846 i002 Applsci 16 04846 i002]()
files together with their corresponding PDFs, each undergoing an average of 48 operator interventions, resulting in roughly 15.8 million document variations. This extensive dataset supported the training of the prediction model.
To ensure the applicability of our model to real-world scenarios, we further created a smaller dataset as our fourth contribution. We position this dataset as a case study focused on AAAI-formatted articles and constraints. This dataset consists of 140 articles that vary in content and design, manually selected to represent a wide range of article types. All of these articles, accepted by AAAI, were obtained from the arXiv website. This dataset includes both the articles and their
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
source files, allowing us to perform feature extraction on each. Our goal here is to evaluate the algorithmic approach under a fixed and widely used style. The benchmark is intentionally controlled: it focuses on AAAI formatting, a three-line overflow scenario, and reductions applied near the end of the paper. This design enables a focused comparison of the proposed algorithms under a realistic and practically relevant page limit setting. Generalizing to other venues is possible via operator/profile reconfiguration, but is outside the scope of this case study.
Our experiments on these datasets demonstrate the robustness and effectiveness of our approach. In the large dataset, the gain prediction model improves over basic heuristics. When integrated into the greedy algorithm, this model accelerates the process and can reduce the number of operator applications compared with its counterpart lacking the model. Similarly, on the smaller real-world dataset, our prediction model achieves the best observed results among the compared approaches, with moderate improvements over basic methods and non-learning-based heuristics in this controlled benchmark setting, supporting its practical value for real articles.
2. Related Work
Document layout optimization and compression are important for producing concise and readable documents, particularly in environments such as
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
based editors (e.g., Overleaf). Document length reduction has been studied from several adjacent perspectives. The most common line of work focuses on content-level reduction, such as text summarization and sentence rewriting, whereas a smaller body of work considers layout optimization and presentation-level decisions. Our work belongs to the latter category: rather than modifying the semantic content of the document, we preserve the original text and seek to reduce space through layout-level operators under formatting constraints. We therefore review both neighboring content reduction approaches and the more limited literature on layout optimization. Over the years, various techniques have been explored to reduce document size while preserving content integrity. One such technique is text summarization, which condenses the source text to maintain core ideas while reducing overall length [
1]. However, summarizing longer documents poses challenges due to the complexity of the input text, as highlighted by [
3,
4]. These challenges have driven advances in deep learning, particularly neural networks, which have shown promise in automating text summarization [
5].
Despite these advancements, automatic text summarization has notable drawbacks. The elimination of text or graphical content can lead to the omission of essential information, which can compromise the clarity and essence of the document’s message. Moreover, most summarization models are trained on datasets in a specific language, limiting their effectiveness in different languages without retraining or adaptation [
6]. For example, the authors in [
6] developed a summarization model for German texts using transformers but faced challenges due to resource scarcity for non-English texts.
In addition to addressing these limitations, Liu et al. [
7] proposed an approach that combines an improved version of the TextRank algorithm with K-Means clustering. This method improves the accuracy of key sentence extraction by calculating sentence importance with TextRank and ensuring diversity through K-Means clustering. However, this method occasionally overlooks the importance of sentence positioning, which can affect the logical flow and readability of the summary. Additionally, while the algorithm shows promise in English, it has not been tested in non-English languages, indicating a need for adaptation to cater to varied linguistic structures.
In addition, Kouris et al. [
8] introduced a novel summarization technique based on semantic graphs, specifically using Abstract Meaning Representation (AMR) graphs in conjunction with a graph-to-text deep learning model. Although this framework shows satisfactory performance compared to other semantic graph-based approaches, the authors acknowledge that further improvements are needed. They suggest that the semantic representation of the input text requires more in-depth study, as the quality of the generated summaries is closely tied to the effectiveness of this semantic formulation.
The challenges of maintaining coherence and context in generated summaries are also highlighted by Shakil et al. [
9], who reviewed the state of the art in abstractive text summarization. They pointed out that while current models can generate summaries, they often struggle to ensure that the summary accurately reflects the original context and maintains logical consistency, especially in longer texts. The paper suggests improvements through more advanced neural architectures and better integration of pre-trained language models, which could potentially address some of these ongoing issues.
Laban et al. [
10] introduced SUMMEDITS, a benchmark designed to evaluate the factual reasoning capabilities of large language models (LLMs) within the context of text summarization. The authors emphasize the importance of factual accuracy in generated summaries and highlight challenges related to maintaining consistency with the source material. This benchmark provides valuable insight into the performance of LLMs in this critical area and suggests directions for future research to enhance the factual reliability of summarization models.
Moreover, the use of Natural Language Processing (NLP) techniques for text summarization introduces further complications, particularly when dealing with texts that have specific structures and rules. These limitations motivate considering alternative approaches for document length reduction when the goal is to keep the original text unchanged. As a result, our research focuses on a layout-based model for documents that must preserve their original text, rather than relying on traditional NLP methodologies.
In addition to summarizing, document size can also be reduced through content rephrasing. This involves modifying sentences by employing alternative wording to create more concise expressions without altering the original meaning. For example, in [
11,
12], a data-driven approach to abstractive sentence summarization is proposed, utilizing approximately four million title–article pairs from the Gigaword corpus for training. The approach employs a convolutional neural network model to encode the source and generate a single representation for the entire input sentence.
Additionally, the authors in [
13,
14] employ tree-to-tree grammar extraction methods for sentence rewriting, while hierarchical attentional Seq2Seq Recurrent Neural Networks have been used to achieve state-of-the-art performance in abstractive summarization tasks [
15,
16].
Building on these approaches, Shichel et al. [
2] developed a black-box algorithm that receives a given compression model and identifies the optimal sentences to rephrase. Their optimization is based on formulating the problem as a Knapsack Problem, solved using dynamic programming. This technique could complement our algorithms, which focus on selecting suitable operators to apply to each document element to achieve the most effective size reduction. The sentences identified by [
2] for rephrasing could be incorporated into the list of candidate operators used by our system.
Taken together, these summarization and rewriting approaches are relevant mainly at the application level, since they also aim to reduce document length. However, they differ fundamentally from our setting: they modify the document’s semantic content, while our approach keeps the text unchanged and instead applies local layout and formatting modifications. For this reason, they serve as useful neighboring references, but not as direct methodological counterparts to our framework.
In addition to content-level reduction methods, the
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
ecosystem also provides several traditional rule-based tools for reducing document length or tightening document layout. For example,
savetrees applies predefined document-level space-saving modifications, including tighter spacing, reduced indentation, compressed lists, smaller title and section formatting, and reduced margins [
17]. Its stated goal is to pack as much text as possible onto each page, explicitly acknowledging the trade-off this may create with document attractiveness and typographic elegance [
17]. Likewise,
microtype provides micro-typographic refinements such as character protrusion, font expansion, interword spacing adjustment, and tracking [
18], while packages such as
titlesec allow fine-grained manual control over section–title formatting and spacing [
19]. These tools are highly useful in practice, but they serve a different role from our framework. In particular, they rely on predefined typographic rules, package-level presets, or manual formatting control rather than learning-assisted, document-specific selection of candidate layout operators. They do not attempt to predict which edits are most likely to yield useful space reduction for a particular document, nor do they rank candidate edits under an explicit cost-aware optimization objective. Moreover, in practical use they still often require iterative trial and error by the author, who must enable or tune options, recompile, and inspect the outcome manually. By contrast, our approach aims to screen and rank candidate edits using predictive models and a cost-aware search procedure, while preserving the original text and validating the acceptability of the final output separately.
Beyond the specific focus on text summarization and document compression, other research has explored layout optimization in different contexts. For instance, the authors in [
20] explored dynamic content layout optimization for the front pages of news sites. Although this work focuses on optimizing the layout of web content, it shares the broader goal of improving presentation quality and content arrangement across media. The principles identified in their work, particularly the importance of optimizing content placement to improve user experience, can be relevant to other types of content, including digital documents and printed materials.
Further extending these efforts in layout optimization, the authors in [
21] introduced CGB-DM, a Transformer-based Diffusion Model that focuses on generating balanced layouts by effectively integrating content and graphical elements. This approach is particularly useful in scenarios where both textual content and graphics need to be optimally arranged to create aesthetically pleasing and functional layouts. By balancing these elements, the model ensures that the final document is not only visually appealing but also well organized and space-efficient.
These works are relevant because they address layout decisions rather than content rewriting. However, they target different application domains and objectives than ours, such as web-page design or fully generated visual layouts, rather than operator selection for reducing the length of an existing scholarly document under explicit page constraints.
Looking ahead, integrating these advanced layout optimization techniques with user-centered design principles could open new avenues for creating document layouts that not only compress content effectively, but also enhance reader engagement and comprehension. Future research could explore the development of systems that recommend adaptive layouts, tailored to the reader’s preferences and the document’s content, thereby improving both the aesthetic appeal and the effectiveness of the communication.
Overall, the literature most closely aligned with our exact problem setting remains limited. Our work is therefore positioned at the intersection of document layout optimization and learning-assisted operator selection: instead of shortening content through NLP, we optimize the application of formatting operators to reduce document length under explicit space constraints.
3. Problem Definition
In this section, we formalize the DSOpt problem. Our formalization distinguishes between five components: (i) the document and its entities, (ii) the set of admissible operator–entity applications, (iii) a local cost function that quantifies the geometric magnitude of an edit, (iv) a gain function that quantifies the amount of content moved backward in the document, and (v) the optimization objective of selecting a subset of legal operator–entity pairs that minimizes total cost while achieving sufficient gain. The learning models introduced later do not change this formulation. Rather, they are used to estimate the effect of candidate operator applications in order to guide the optimization process.
A document (e.g., a PDF file) is an ordered set of q pages . Each page has an identification number and a grid of positions that identify the location of the objects on the page.
Definition 1 (
page)
. A page is defined by an -grid of points, where the upper-left point of the page indicates the origin of the grid , and the lower-right point of the page is , where m and n represent the maximum number of points on the x-axis and the y-axis, respectively.
Each page contains an ordered list of entities, denoted by . An entity may be a figure, a table, a line of text, a formula, etc. Each entity is associated with a specific position on the page.
Definition 2 (
entity)
. An entity e is a page object defined by its upper-left and lower-right coordinates on the page grid. and denote the of e’s upper-left coordinate, and and denote the lower-right coordinate. The function returns the space an entity takes with respect to the y-axis: .
We can affect an entity’s position through operators. For instance, we can decrease the size of a figure, and as a result, its lower-right coordinate may also decrease, thereby changing the local layout geometry and potentially allowing subsequent entities to move upward.
Definition 3 (
operator)
. Applying an operator to a certain entity e, denoted as , aims to modify its position. will represent the set of all operators.
Not all operators are legal. A legal operator with respect to a certain entity must satisfy two conditions:
- 1.
It must be applicable to the given entity. The applicability of each operator to each entity type is predefined. For instance, the size-decreasing operator could be applied to figures and tables but not to a text line.
- 2.
It must verify that the entity’s new position, after applying the operator, does not overlap with the positions of its preceding and following entities. In particular, let
denote the entity
after applying operator
:
where
is a predefined parameter that guarantees a minimal space between two entities.
We emphasize that legality is defined here in geometric terms only. That is, a legal operator application preserves non-overlap and minimum spacing constraints in the resulting layout, but legality alone does not imply that the edited document is optimal in terms of readability or visual quality. Those aspects are addressed indirectly through the preference for lower-cost edits and are validated separately in the experimental evaluation.
Applying an operator may affect the visual quality of an entity and, in some cases, may also harm its readability. In this work, however, we do not attempt to directly model subjective readability loss. Instead, we use a local geometric proxy that measures the magnitude of the vertical change induced by the operator. Our guiding assumption is that smaller geometric changes are less likely to harm readability and visual consistency than larger ones.
Definition 4 (
cost)
. The cost of an operator for a given entity, denoted by , estimates the difference between the position of the entity before and after applying the operator. Let denote entity e after applying operator , then .
Note that this notion of cost is a local geometric measure, defined as the vertical displacement induced by the operator on a given entity. It is used as a proxy for edit severity, under the assumption that smaller geometric modifications are less likely to harm readability or visual quality than larger ones. It does not directly quantify subjective readability degradation or aesthetic quality, which may depend on the operator type and context. Such higher-level considerations can be incorporated separately through operator restrictions, bounds, or weighted cost formulations as discussed in
Section 6.
Importantly, this proxy is used only to rank and prefer less aggressive edits during optimization. Whether the resulting document remains acceptable in terms of readability and overall layout quality is assessed separately, rather than being encoded directly in the objective function.
It is crucial to understand that the outcome of applying an operator to a specific entity or an entire page can be estimated but is not guaranteed. The final positioning of an entity is influenced by the placement of other entities on that page, subsequent pages, and various external design factors. For example, a minor reduction of 5% in the size of a figure might not change a page predominantly filled with figures and tables. However, the same reduction on a text-heavy page can result in a significant reflow of content, potentially pulling entities from the following page.
A common challenge is fitting all required entities within a document under strict space constraints. Often, users seek to modify specific entities to reduce their size and make room for more content. To clarify and address the fundamental issue, this work examines the case of condensing two-page documents into a single page. This scenario mirrors situations in longer documents, where the goal is to ensure that all content fits within the set boundaries by targeting the final page and managing any overflow effectively.
Informally, the goal of DSOpt is to decrease the space occupied by some entities in the document by applying operator(s) so that entities from the last page will have sufficient room on the previous page to shift backwards. In this formulation, gain captures only the amount of content that is pulled backward in the document. It is not intended to measure readability or visual quality. To formally define the problem DSOpt, we should first formally define the gain by applying an operator:
Definition 5 (
)
. Given a document , a set of operators and , the function returns the set of entities moved from to by applying .
The size of the entities (defined in Definition 2) that have been moved from the last page to page by applying these operators is defined as the gain of the operators.
Definition 6 (
gain)
. Given a document , a set of operators and , the function returns the gain in size as a result of applying : The central challenge is determining which operators to apply to which entities so that all content fits within the document’s space constraints. Although operators associated with larger geometric changes may provide greater space-saving benefits, they are also more likely to introduce noticeable visual distortion or reduce readability. Therefore, our optimization objective is to satisfy the required gain while favoring smaller local modifications.
The optimization decision variable in our formulation is a subset of legal operator–entity pairs. The objective is to minimize the total cost of the selected edits, where cost captures the local geometric magnitude of each modification. The constraint requires that the accumulated gain of the selected edits be sufficient to eliminate the overflow from the last page.
We can now define the DSOpt problem more precisely. Let the optimization decision variable be a subset of legal operator–entity pairs, . Our objective is to find a set of edits with minimum total cost, while ensuring sufficient gain to eliminate the overflow from the last page.
Let represent the total size of the entities on the last page, , and let be the set of all pairs of legal operators and their corresponding entities in the document, , where , , and applying to entity is legal. Then, the formal definition of our problem is as follows:
Definition 7 (
Document Space Optimization)
. Given a document and a set of operators , assume that the target layout allows only pages, while the current document still contains the non-empty overflow page . The Document Space Optimization
(DSOpt) problem is: Thus, the optimization seeks a minimum-cost set of legal edits that achieves sufficient space reduction according to the geometric proxy defined above. Readability is addressed only indirectly: the framework prefers smaller local modifications because they are assumed to be less likely to disrupt readability, and the final document is then checked through a separate quality assessment process.
4. Methodology
Figure 2 provides an overview of the five-stage methodology: (i) generating or collecting documents and extracting document, entity, and operator features; (ii) constructing supervised learning instances for candidate operator–entity pairs; (iii) training prediction models to estimate operator usefulness; (iv) embedding these predictions within a greedy reduction algorithm to reduce expensive recompilations; and (v) evaluating both predictive quality and end-to-end document reduction performance.
The proposed methodology focuses on layout-level space optimization while keeping the original text unchanged. We do not perform text simplification, paragraph compression, or summarization, nor do we apply NLP- or LLM-based rewriting. Instead, we adjust document structure and layout (e.g., float placement, spacing, and micro-typography) to reduce occupied space while preserving content integrity and favoring smaller geometric modifications that are less likely to disrupt readability or visual consistency. Readability is therefore addressed indirectly through conservative edit selection and assessed separately in the evaluation. This section details the algorithms used to achieve these goals.
DSOpt induces an exponential search space in , making exhaustive search infeasible in practice. Let denote the set of legal operator–entity pairs in the document. Searching for a subset of pairs from this set, as defined in Definition 7, requires exploring the power set of , resulting in an exponential search space of .
To address this problem, we model DSOpt as a combinatorial search problem, allowing us to use standard search frameworks such as Best-First Search. The output of the search is a sequence of operator–entity pairs.
In general, a combinatorial search is defined by:
A set of states .
An initial state I.
A goal state G.
A set of actions that are available from state s, for each state .
A reward function . This is the immediate reward received after performing action a in state s.
A solution to the search problem is a sequence of actions that transforms the initial state into a goal state. An optimal solution is one that maximizes the reward, or equivalently, minimizes the corresponding accumulated cost when reward is defined as the negative cost.
To model DSOpt as a combinatorial search problem, we represent its standard components as follows:
States. A state is a document D, which includes the pages and the positions of their entities.
Initial state. The initial state is the initial configuration of D.
Goal state. A goal state is a document D that satisfies the space limitations.
Actions. The actions are all legal operator–entity pairs in the document (i.e., the set ).
Reward function. The reward function is the negative of the cost of applying an operator to an entity, where cost is the local geometric proxy defined in Definition 4.
A solution to this combinatorial search problem is a sequence of pairs applied in order to reach a goal state. An optimal policy is one that minimizes the total cost of the selected operators while achieving the required space reduction.
However, the state space is at least exponential in the number of legal operator–entity pairs . For , there are approximately possible subsets, making even the best search algorithms impractically slow.
To address this challenge, we present a greedy algorithm, outlined in Algorithm 1. This algorithm evaluates the feasible operator–entity pairs in , prioritizing them by increasing cost (Definition 4)—that is, from less aggressive local geometric edits to more aggressive ones. Each operator is applied to its corresponding entity in turn. This iterative procedure continues until the desired page-space reduction is achieved or all operators have been applied.
Notably, if an operator frees up space, the algorithm restarts from the beginning of the operator list. This is because a successful operator application may alter the document in a way that allows previously ineffective operators to become useful. Although this greedy algorithm does not guarantee a minimum-cost sequence of edits, it runs in polynomial time with respect to the size of
, with total complexity
. Its design reflects the optimization objective defined earlier: it seeks to satisfy the required gain while preferring edits with smaller geometric cost, which are assumed to be less likely to disrupt readability or visual consistency. Readability itself, however, is not evaluated by the greedy criterion and is assessed separately in the experimental validation.
| Algorithm 1: A basic greedy algorithm for DSOpt. |
![Applsci 16 04846 i003 Applsci 16 04846 i003]() |
While the greedy algorithm is polynomial in complexity, it can still be time-consuming when applied to large documents. This overhead arises because each operator–entity application requires recompiling the document, for example, from its
![Applsci 16 04846 i002 Applsci 16 04846 i002]()
source.
To reduce the runtime overhead caused by repeated recompilation, we estimate the
expected gain of applying a candidate operator–entity pair before executing it. Instead of recompiling the document for every feasible pair, the prediction model is queried first, and only pairs with positive predicted gain are actually executed. Algorithm 2 presents this prediction-guided greedy strategy. The procedure preserves the same optimization objective as the basic greedy algorithm, but uses the learned predictor as a screening mechanism. More specifically, the candidate pairs are still processed in increasing order of cost. However, before applying a pair
, the algorithm evaluates
. Only if the predicted gain is positive does the algorithm execute the operator and verify the actual gain by recompilation. If the executed pair yields positive gain, it is removed from the candidate set and the scan restarts from the beginning, since the document layout has changed and previously ineffective pairs may now become useful. Thus, the interaction between learning and optimization is modular: the formal optimization problem remains unchanged, while the prediction model reduces the number of costly operator executions and recompilations in practice. Importantly, this predictor estimates gain only. It does not predict readability or aesthetic quality directly. Its role is to prioritize candidate edits that are more likely to contribute useful space reduction, while the cost ordering still biases the search toward smaller geometric modifications. In the next subsection, we describe the machine learning models used to estimate this gain.
| Algorithm 2: A gain prediction-based greedy algorithm for DSOpt. |
![Applsci 16 04846 i004 Applsci 16 04846 i004]() |
Learning a Gain Prediction Model
Gain prediction can be formulated as a regression problem. Given a pair, the task is to predict the expected gain (Definition 6) from applying the operator to the entity. Supervised machine learning algorithms are commonly used to solve regression problems. These algorithms function as follows: the input is a training set consisting of feature vectors extracted from instances, together with their corresponding target values. In our domain, an instance consists of a document together with a pair. We describe the feature extraction process later. The gain from applying the operator to the entity is the instance’s target value. Using the training set, a learning algorithm creates a regression model that predicts the value for new instances.
Feature extraction is a crucial component of the effectiveness of a regression model. We explain in detail the creation of the dataset in
Section 5.1.1. Given this dataset, there are many known algorithms that can be used to generate a regression model (e.g., Linear Regression or Random Forest Regression), although in our setting, the regression target is always the expected gain and not a direct measure of readability or visual quality.
To improve our prediction model, we leverage the Mixture of Experts (MoE) strategy of [
22]. MoE is an ensemble method that segments a problem into distinct parts, each addressed by a specialized learner (expert). This approach is particularly effective when these segments have minimal overlap. In our context, we categorize the training set by operators and develop a unique model for each category. The relevant model is selected for any new instance based on its specific operator. Additionally, we can refine our partitioning by considering the combination of an operator, its parameters, and the targeted entity, since each new instance explicitly specifies these elements. By doing so, we can train a multitude of regression models, each tailored to a specific combination of operator, parameter, and entity. This granularity allows prediction models to be highly specialized, which may improve their accuracy and effectiveness. Each new instance is then directed to its relevant model based on its specific attributes, ensuring that the most appropriate model is used for each prediction. The success of the Mixture of Experts (MoE) strategy depends significantly on the variation and volume of the training data. A diverse and extensive dataset allows the individual models to learn effectively from a wide range of scenarios, enhancing their predictive capabilities. The dataset construction process is described in the following section.
The problem can also be framed as a classification task. We generate a classification version of these learning methods by replacing the label of an instance with true/false as follows: Given a candidate pair , if , then it is labeled as true; otherwise, it is labeled as false. This approach can sometimes be more effective than regression because it simplifies the problem to a binary decision, potentially making it easier for the model to learn and generalize. By converting the gain prediction into a classification task, we focus on whether an operator will provide a positive space gain rather than predicting the exact amount of gain. This binary perspective can reduce the complexity of the prediction task and may improve the model’s performance in some scenarios.
We experimented with both regression and classification approaches in order to identify the most useful predictor for screening candidate operator–entity pairs within the greedy reduction framework.
Algorithm 2 should therefore be interpreted as a prediction-guided screening procedure: the learned model is used to avoid recompiling pairs that are unlikely to yield positive gain, while the final decision to keep an edit still depends on the observed gain after actual execution and recompilation. As in the basic greedy algorithm, the search remains ordered by increasing geometric cost, so the framework continues to prefer smaller local modifications whenever they are sufficient to achieve progress.
5. Evaluation
This section provides a comprehensive evaluation of our approach, divided into two main parts. In the first part (
Section 5.1), we examine the quality of the gain prediction model. This section describes the creation of the dataset used to train and validate our classification and regression models. We also describe the methods used for dataset generation, including feature extraction and preprocessing steps. In addition, we present the learning algorithms considered and explain how they are applied in our setting, leveraging the large volume of data available for these supervised problems.
In the second part (
Section 5.2), we evaluate the application of the learning models within the greedy algorithm (Algorithm 2). This section includes an explanation of the test set created to validate this algorithm. In addition, we present a controlled case study on various articles from the test set to illustrate the practical behavior of our approachunder a fixed AAAI-specific benchmark setting.
By dividing the evaluation into these two parts, we aim to provide a thorough and structured analysis of our methods, ensuring a clear understanding of both predictive model development and its practical application, while separating predictive performance from end-to-end document reduction performance.
The entire framework, including the experiments, the dataset, the test set, and all other resources used to perform the experiments and obtain the results, can be found in our GitHub repository (main branch, commit 6017c25,
https://github.com/latex4/documentSizeTex, accessed on 4 May 2026).
5.1. Gain Prediction and Classification Models Performance Evaluation
In this section, we evaluate the performance of the gain prediction and classification models. We begin with the experimental setup, where we provide detailed information about the dataset we created, the features and operators we used, and the different learning methods applied. We then outline the course of the experiments, describing the steps and procedures followed. Next, we discuss the evaluation metrics used to measure the models’ effectiveness. Finally, we present the results and evaluation, offering a comprehensive analysis of the models’ performance and the insights gained from our experiments.
5.1.1. Experimental Setup
There is no recognized dataset tailored to this study. Consequently, we created and published an extensive collection of 329,000
![Applsci 16 04846 i002 Applsci 16 04846 i002]()
files and corresponding PDF files, which can be accessed on GitHub (link to database:
https://github.com/latex4/documentSizeTex/tree/main/latex_pdf_files, accessed on 4 May 2026). Beyond this repository, we performed feature engineering to construct a comprehensive machine learning dataset. The construction was carried out in two stages. First, for each document, we extracted a fixed-width document representation from the
![Applsci 16 04846 i002 Applsci 16 04846 i002]()
source and the compiled PDF. Second, this document-level representation was expanded into learning instances by pairing the document context with candidate operator–entity applications and their labels. Thus, the base representation is document-level, whereas the final learning dataset used for training contains one row per candidate operator application within a document context. These features include various document attributes such as text density, image count, section distribution, and formatting details, all of which are crucial for understanding and optimizing document layout, for a total of 451 features. By providing this rich dataset, we aim to facilitate further research in document space management and encourage the development of more advanced models and techniques in this domain.
Creating the Repository. Our primary goal in constructing this repository was to capture the structure and diversity inherent in real academic articles. Starting with a foundational set of genuine articles, we meticulously mapped and modeled potential document structures, thereby enriching our collection with a variety of representative samples. The modeling process involved categorizing layout entities. For each layout entity, we set per-page bounds on how many instances may appear on a single page. Concretely, for every entity, we define a pair indicating that, when composing a page, the sampler may place between and instances (inclusive) of that entity on that page. These categories included paragraphs (0–8 per page), figure captions (0–4 per page), figures (0–4 per page), section headers (0–2 per page), subsection headers (0–3 per page), tables (0–2 per page), table captions (0–2 per page), algorithms (0–2 per page), formulas (0–5 per page), and enumerations (0–1 per page, 3–5 items each). The identical upper bounds (0–2) for section headers, tables, and algorithms reflect common constraints of the two-column layout and float placement. In practice, more than two of these elements rarely fit on a single page without overflow or layout quality issues. These per-page ranges guided repository generation and reflect layout realism. They are distinct from the per-document slot counts used later in the fixed-width training matrix.
From this refined framework, we devised an array of documents by exploring all possible combinations of these categories (329,000 documents in total). An example of such a paper might feature a section header, a pair of distinct paragraphs, two images, and three formulas. To introduce variety, each combination was rearranged into three distinct sequences, while strictly adhering to the AAAI
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
format. This ensures that our dataset not only reflects the structure and complexity of genuine academic articles, but also encompasses a wide range of formatting scenarios. The finalized repository consists of both the original
![Applsci 16 04846 i002 Applsci 16 04846 i002]()
documents and their corresponding PDFs produced by compiling the
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
source with pdf
![Applsci 16 04846 i002 Applsci 16 04846 i002]()
. This methodical approach preserves the authenticity of the articles while ensuring a varied representation in the dataset. The complete repository (sources and compiled PDFs) is publicly available on GitHub (see the link provided earlier in this section) for further scrutiny and research.
Application of the Operators to the Documents. Once the documents were generated, we applied a series of layout modification operators. At the conceptual level, these operators are organized into seven operator families. When instantiated with their concrete parameter settings, they correspond to 17 distinct operator types. The seven operator families are as follows:
- 1.
Adjust figure size: scale figures using five levels from 0.5 to 0.9, increasing by 0.1.
- 2.
Modify algorithm font: Shrink the algorithm font using the “small” command.
- 3.
Transform enumerations: Convert enumeration entities into standard paragraph format, thereby eliminating the specialized enumeration spacing.
- 4.
Merge paragraphs: Combine two successive paragraphs into a single unit.
- 5.
Alter table dimensions: Reduce table width using four scale levels from 0.6 to 0.9, in increments of 0.1.
- 6.
Reformat the “” command: Transform paragraphs beginning with the command into regular text, retaining only bold formatting for the heading.
- 7.
Employ the “” command: Reduce default inter-element spacing. We apply it only between block-level entities (paragraphs, section/subsection headings, floats/images/tables, display equations, and algorithms) when the measured vertical gap exceeds 10 pt. All lengths are normalized to points (pt). We do not use relative dimensions (e.g., \textheight) or alternative spacing commands. The maximum admissible reduction is computed from the current gap, quantized into four levels, and applied as a negative “” at the chosen site. This operator, by design, remains local and reproducible, yet can result in many distinct configurations within an article.
To summarize, the 17 distinct operator types used in the experiments are: size of Figure 0.5, size of Figure 0.6, size of Figure 0.7, size of Figure 0.8, size of Figure 0.9, size of algo, enum to par, combine 2 pars, size Table 0.6, size Table 0.7, size Table 0.8, size Table 0.9, par to text, vspace −0.25, vspace −0.5, vspace −0.75, and vspace −1.
Each application of an operator results in a modified version of the document. We meticulously tracked the operator used and its corresponding original document for each of these versions. By comparing the original and modified document sizes, we evaluated the operator’s effectiveness. This assessment determined not only whether a size reduction occurred, but also its magnitude, which served as the labeling criterion for the dataset.
Feature Extraction: Upon establishing the repository, we constructed a deterministic feature extraction pipeline to produce a dataset tailored for machine learning applications. The initial representation is document-based: it stores document-level summary features together with fixed slots for entity-level features extracted from the
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
file, the PDF, and the document layout. This representation is then expanded into learning instances, where each row corresponds to a specific candidate operator–entity application together with the relevant document, entity, and operator descriptors. All geometric quantities are measured in points (pt). Indices (page, column) are zero-based. When referring to pages in prose, we use human-friendly numbering (page 1, page 2, etc.). Position parameters for floats are stored as numeric encodings (0 = empty, 1 = b, 2 = t, 3 = h, 4 = other).
Entity-specific features extracted include the following:
- 1.
Entity positioning attributes: Page, column, y-axis position (start_y/end_y), and size (height).
- 2.
Entity type: Paragraphs, figure captions, figures, section/subsection headings, tables, table captions, enumerations, algorithms, and formulas.
- 3.
Space measurement: Inter-entity gaps before and after the entity (e.g., space between this object and last object, space between this object and the next object).
- 4.
Type-specialized features: For paragraphs—character and word counts, and last-line length (in characters/words). For floats—caption presence/length and placement parameters. For formulas—detection flags.
- 5.
Aggregated metrics: Document-level summary features (min/max counts, per-column totals, and space-usage sums).
In total, we retained
451 features:
408 entity-level columns and
43 document-level summary features. Additional operator descriptors are recorded separately for the candidate operator application associated with each row. A concise schema is provided in
Table 1, and the summary features are listed in
Table 2.
For operators, we recorded features for each of the 17 distinct operator types derived from the seven operator families described above. The recorded operator-related features are as follows:
- 1.
Operator category: For example, size reduction or spacing adjustment.
- 2.
Operator-specific parameters: Such as a 0.1 decrease.
- 3.
Target entity: Entity type and slot/index (e.g., figure slot 2, paragraph slot 5).
Labeling: Additionally, we extracted two alternative labels for each row: one indicating whether the operator was able to reduce document size, and another indicating the degree of reduction achieved if the operator was successful. This dual-label approach allows us to train both classification and regression models effectively.
By incorporating these diverse features and labels, our dataset provides a comprehensive foundation for training machine learning models aimed at predicting the effect of applying an operator to a given document.
To evaluate the gain prediction model, we compare two variations of the learning method:
- 1.
Using the Mixture of Experts (MoE) strategy to generate multiple models, one for each operator family.
- 2.
Using the MoE strategy to generate multiple models, one for each combination of operator, parameter, and entity.
Hist Gradient Boosting () is a gradient-boosted decision-tree algorithm optimized for speed and accuracy on large datasets by utilizing histograms of features. It combines many weak learners into a more expressive predictive model. In contrast, CatBoost () is designed for effective processing of categorical variables and is known for its precision and efficiency. Both algorithms were selected for our evaluation because of their advantages in handling different types of data and their overall performance. Model families were first screened in a preliminary comparison, after which the strongest-performing regression and classification models were retained for the main experiments.
Furthermore, we compared these methods to a baseline method that does not use machine learning, but instead estimates the expected gain using the operator’s cost.
To further assess our models, as discussed in the previous paragraph, we also transformed the regression problem into a classification problem by labeling instances as true or false. Given a candidate pair , if , it is labeled as true; otherwise, it is labeled as false. We then evaluated each variation of the learning method using multiple off-the-shelf classification algorithms: Random Forest Classifier (), AdaBoost Classifier (), ExtraTrees Classifier (), and Gradient Boosting Classifier ().
For the classification problem, we also included a version that compares the cost of the operator with its potential to gain enough space to move back the first entity on the overflow page. Formally, given a candidate pair , if , then it is classified as true; otherwise, it is false.
To validate our gain prediction model, we used k-fold cross-validation with . To ensure a fair experimental setup, the records were shuffled and split into five uniform folds. During this process, we ensured that records derived from the same source document were not split between the training and test sets. Consistent divisions were maintained throughout the experiments. The reported results are average metrics across all folds, providing a robust evaluation of the model’s performance.
For our regression model, we use the following metrics:
- 1.
Mean Squared Error (MSE): The average squared difference between predicted and actual values.
- 2.
(Coefficient of Determination): The proportion of variance in the dependent variable that can be explained by the independent variable(s) in the model.
In our evaluation of the method, we compute metrics for each model i, where each model corresponds to one of the seven operator families described earlier. We then derive the average for each metric over the results of these seven models. Note that, in this method, each operator family contributes equally to the average metrics.
For the method, metrics are calculated for each model i, corresponding to a specific combination of operator, parameter value, and entity index within the document, for a total of 160 such combinations. When averaging these metrics, we employ a weighted-average approach to account for the varying number of sub-models associated with each operator due to different parameter values and entity indices.
It is worth noting that the heuristic method serves as a replacement for either the seven models in the method or the 160 models in the method. Because each operator has a different number and type of sub-models, the average metrics naturally differ between the and methods when the heuristic is applied.
For our classification model, we evaluate performance using the following metrics:
- 1.
Accuracy: The fraction of correctly classified samples.
- 2.
Precision: The ratio of true positive predictions to all positive predictions made.
- 3.
Recall (Sensitivity): The ratio of true positive predictions to all actual positive instances.
- 4.
F1-score: The harmonic mean of precision and recall.
- 5.
AUC (Area Under the ROC Curve): The model’s ability to distinguish between positive and negative classes.
Both the classification and regression evaluations use two sets of labels for comparison. This allows us to assess the accuracy of the model predictions. In addition to comparing the model outputs to the actual labels, we also compare the results of a heuristic approach to the same labels. This enables us to gauge the gap between the simple heuristic and the learned models, and thereby evaluate the effectiveness of the learning process.
5.1.2. Results
Table 3 presents the average gain prediction metrics across all documents for the two learning approaches,
and
. The results show a moderate but consistent advantage for
over
for both regression models,
and
. In particular,
achieves better MSE and
values for both models, with the best overall results obtained by combining
with
. Compared to the Heuristic baseline (
), both regression models yield better predictive performance under both learning settings, suggesting that the proposed learning framework captures meaningful structure beyond the hand-crafted heuristic. Overall, these findings support the effectiveness of the learning-based approach, while indicating that the resulting predictive signal is useful for downstream decision-making rather than as a perfect standalone predictor.
Figure 3 shows the results of evaluating various classification models, focusing on the
method because of its better observed performance in the gain prediction setting. In
Figure 3, the x-axis lists the different metrics, and the bars show the performance of each algorithm. A closer examination of the chart yields some useful insights. The heuristic method almost always predicts a possible reduction. As a result, it exhibits very high recall, but much lower precision. This is because the heuristic method tends to overpredict positive reductions, leading to more false positives. Among the other models,
stands out with the highest accuracy, AUC, and F1-score. Consequently, we selected the
model for our greedy algorithm because it showed the best observed balance among the reported classification metrics in this experiment.
5.2. Greedy Algorithms Analysis
In this section, we evaluate the effectiveness of our learning models when applied within a greedy algorithm framework (Algorithms 1 and 2). These algorithms iteratively consider candidate operator applications under the greedy ordering described earlier, continuing until the document is sufficiently shortened or no further useful edits are found.
To ensure the applicability of our models to real documents, we frame our evaluation as an AAAI case study and construct a new test set using real articles. In this subsection, we provide a detailed explanation of the real articles used in our test set. We also discuss the various algorithms employed in the greedy approach, as well as the course of the experiments and the evaluation metrics used. Finally, we present and analyze the results obtained by applying these algorithms, highlighting the effectiveness of the approach and the insights gained from the analysis.
5.2.1. Greedy Experimental Setup
As part of our AAAI case study, evaluating the algorithms on real articles is crucial for assessing the robustness and practical applicability of the proposed approach. Real-world documents exhibit a wide variety of writing styles, designs, and formatting options.
To create our test set, we used the arXiv website (
https://arxiv.org/). arXiv is a free distribution service and open-access archive that hosts nearly 2.4 million scholarly articles in fields such as physics, mathematics, and computer science.
We developed a Python 3 script using the arXiv library to download articles from the site that had been accepted to AAAI, thereby ensuring that the style matched the format on which our learning model was trained. The downloaded articles were exactly seven pages long, in accordance with AAAI requirements. This AAAI-specific setup is intentional: it isolates the algorithmic behavior under a fixed venue style and page limit. To simulate a scenario in which the authors had just completed their articles but still needed to reduce the length to fit within the page limit, we made several modifications to the articles:
- 1.
Line adjustments: We ensured that the articles had three lines on the last page by either adding or removing lines, depending on the original structure, in order to mimic a situation in which the document exceeds the page limit by three lines. We selected this setting as a controlled but non-trivial overflow scenario: in preliminary trials, smaller overflows were often too easy to resolve, whereas larger ones could become unrealistically severe for the targeted AAAI use case. Thus, the three-line overflow was chosen as a representative benchmark case for this study, rather than as a claim to cover all possible overflow severities.
- 2.
Focus on the last two pages: To align with the generated articles used in the earlier experiments, we restricted the modifications to the last two pages of each article, where space reduction edits are most directly relevant to eliminating the final overflow.
- 3.
Element mapping: We mapped
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
entities to PDF layout objects using a two-stage parsing pipeline. First, we parsed the
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
source and extracted candidate entities such as paragraphs, section headers, figures, tables, algorithms, and display equations. Second, we parsed the compiled PDF and extracted layout objects together with their page assignments and bounding boxes. The correspondence between
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
entities and PDF objects was then established using entity type, local textual anchors/captions, and positional consistency within the page layout. This step is challenging because floating objects, especially figures and tables, may appear in the PDF in a different placement order than in the source.
By making these adjustments, we created a test repository containing 140 real papers and ensured that our learning model was evaluated on genuine data, thereby supporting the practical relevance of the study. Accordingly, this test set serves as an AAAI-focused evaluation of the algorithm under a fixed and practically relevant benchmark setting. Portability to other venues follows by changing the operator/profile configuration. The dataset is available on GitHub (
https://github.com/latex4/documentSizeTex/tree/main/arXiv%20Articles/arXiv%20Articles, accessed on 4 May 2026)). For more details about the data and its organization, please refer to the GitHub repository. The implementation of the parsing, matching, and validation pipeline is provided in the public project repository, together with scripts and documentation that support reproducibility.
We chose to use 140 articles in order to strike a balance between having a sufficiently large dataset to support a meaningful analysis of the algorithms’ performance across diverse articles, and maintaining a manageable number of articles that could still be manually verified and, if necessary, adjusted individually. Consistent with our stated scope, this is an AAAI-focused case study intended to evaluate the algorithmic method under a fixed style, rather than to establish cross-venue generalization. The diversity of
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
writing styles necessitated this careful approach in order to ensure that our methods could handle a wide range of variations. When targeting other venues, the same pipeline can be reused by specifying a venue-specific operator profile (including whitelists and parameter bounds). Furthermore, we manually reviewed the results to ensure that the articles remained acceptable in terms of readability, clarity, and overall layout quality after applying the operators. This manual review was used as an external validation step rather than as part of the optimization objective itself. We discuss the criteria used for these judgments and the transition to the algorithmic outputs in later sections.
The distribution of features across the 140 papers is illustrated in
Figure 4. This figure presents a violin plot comparing the distributions of various features. The violin plot displays the rotated probability density of the feature counts across all papers. The central black dot within each violin represents the median count of that feature, while the thick black bar shows the interquartile range, indicating where the middle 50% of the data points lie. The thinner lines extending from the bar (whiskers) represent the range of the data, excluding outliers.
The violin plot effectively highlights the diversity of feature occurrences, emphasizing the differences in document structure and content across the dataset. The width of each violin at different points indicates the density of the data at those values, providing a clear visual representation of where feature counts are more concentrated. For example, a wider section of a violin indicates a higher density of papers with that specific feature count.
This detailed visualization shows that paragraphs are among the most common and most variable elements across the papers, while figures and tables appear less frequently and with lower variability. Sections and subsections exhibit moderate variability, suggesting a relatively structured organization in many of the articles.
This distribution demonstrates that our dataset comprises a broad range of document types, each with a unique combination of features. This variety is crucial for evaluating the performance and robustness of our document reduction algorithms, ensuring that they can handle different types of content and formatting styles effectively.
The
creation of the test set involves the same feature extraction process described in
Section 5.1. The primary difference lies in the source of the files. Instead of using generated files (as in
Section 5.1), we use downloaded articles. The feature extraction methods, including the collection and processing of relevant attributes from the
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
and PDF files, remain identical in order to ensure consistency and comparability across our evaluations.
To evaluate the success of the greedy algorithm, we tested several different configurations. The key difference between these configurations lies in the method used to select candidate operators for execution. The general flow of the algorithm remains the same, as illustrated in
Figure 5.
Step 1: The
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
file downloaded from arXiv is taken, and a PDF file is generated from it.
Step 2: As mentioned at the beginning of this section, the final two pages of the document are selected, and three additional lines are inserted. This adjustment simulates the challenge of reducing the total number of pages by fitting these three lines onto the preceding page.
Step 3: Feature extraction is performed from both the
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
file and the generated PDF.
Step 4: Given the page layout and all existing features, a set of operators that can be physically executed is constructed. For instance, it is not possible to apply an operator that reduces an image if there are no images, or to merge paragraphs if all paragraphs are already unified. If no operators are available, the page cannot be shortened automatically.
Step 5: If feasible operators exist, one iteration of the greedy algorithm is performed:
- 1.
The operators are sorted according to their cost.
- 2.
The sorted operators are evaluated sequentially. Depending on the competing configuration, an operator may be executed immediately, filtered by a heuristic rule, or screened by a learned classifier/regressor before execution. The first operator that the configuration predicts will result in a reduction is selected and applied to the article.
Step 6: A new
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
file is generated, incorporating the modifications introduced by the selected operator.
Step 7: Finally, a new PDF file is generated from the modified
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
file.
Once the new PDF has been generated, it is checked to determine whether the document meets the page limit requirements. If the page has been successfully shortened, the process is complete and the results are recorded. If not, the process continues iteratively by returning to
Step 3. At that point, feature extraction is performed again on the newly created
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
and PDF files produced in the previous steps.
In evaluating the greedy algorithm, we tested three learning-based methods and two baseline methods for operator selection. The learning-based methods employ machine learning models to predict the effectiveness of each operator, whereas the baseline methods rely on simpler heuristic approaches. This comparison aims to identify the most effective strategy for optimizing document length.
The primary difference between the competing algorithms lies in the operator selection process in Step 5, as illustrated in
Figure 5 and explained above. The learning-based methods correspond to the gain prediction algorithms that demonstrated the strongest observed performance in the previous evaluation of the regression and classification models. These methods were specifically chosen because they performed best among the compared predictive models in that stage of the study. By comparing these approaches, the objective is to identify which method most effectively balances space optimization with acceptable document quality and readability, as assessed separately by manual review.
The following are the five competing algorithms that were tested. The first two are baselines, and the last three are learning-based methods:
- 1.
Simple—This method is based on Algorithm 1. In each iteration, it activates the first operator in the list sorted by cost. The cost of each operator, as defined earlier, , estimates the difference between the position of the entity before and after applying the operator.
- 2.
Heuristic—This algorithm also sorts the operators by their cost, but activates only those whose cost is greater than 10 points (equivalent to one line, or 3.52 mm, in the PDF).
- 3.
Classification Model—This method is based on Algorithm 2. It activates only operators that the prediction model predicts will reduce the paper. This version uses the best-performing classification model reported in
Section 5.1 (the
method with
).
- 4.
Regression Model—This version uses the best-performing regression model for gain prediction, specifically the method with . The process involves:
Finding the 5 closest operators by cost to the current operator;
Using a regression model to predict their effectiveness;
Sorting operators based on predicted effectiveness in descending order;
Skipping to the next operator if no suitable operators are found;
Applying a suitable operator to the
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
file when one is identified.
- 5.
Classification and Regression Model—This method combines the strengths of the previous two models. It starts with the classification model. If all operators are exhausted, it re-evaluates previously failed operators using the regression model. The process terminates if all operators are exhausted in both phases.
The baselines were chosen to separate the contribution of learning from the underlying greedy framework: the Simple baseline reflects pure cost-ordered execution, the Heuristic baseline adds a hand-crafted rule for operator usefulness, and the learning-based variants replace this rule with data-driven predictions.
To evaluate the greedy algorithm, we used the trained models and the full test set. The five algorithmic variations were run on each of the 140 articles. The results presented are averaged across all 140 articles in order to provide a comprehensive evaluation of each method’s performance.
All randomized procedures used fixed seeds for reproducibility.
After running the experiments, each reduced paper was manually reviewed to ensure acceptable readability, coherence, and overall layout quality. This manual inspection was crucial for confirming that the automated reductions maintained an acceptable presentation quality of the original articles. This review served as an external validation step: it was used to verify the acceptability of the output, rather than being directly optimized by the objective function. The combination of automated evaluation and manual review provides a robust assessment of the algorithm’s effectiveness, highlighting both the quantitative performance metrics and the qualitative outcomes.
To evaluate the greedy algorithm for space reduction, we used several metrics to assess the performance of each algorithmic variation:
- 1.
Percentage Reduced: The percentage of articles successfully shortened out of the 140 articles. Since not every algorithm was able to shorten all articles, this metric indicates how many articles were effectively shortened by each method.
- 2.
Compilations: The average number of compilations, i.e., the number of executed operator applications (since each operator activation required recompilation), computed over the successfully shortened articles only.
- 3.
Time: The average time taken from the start of processing an article to its successful shortening, also computed over the successfully shortened articles only.
- 4.
Cost: The average total cost of all operators used to shorten the articles, computed over the successfully shortened articles only. Lower cost indicates smaller cumulative geometric changes in the applied edits. It should therefore be interpreted as a proxy for edit severity rather than as a direct measure of readability loss. The cost calculations were defined in the previous sections.
Compilations, time, and cost are reported separately from the reduction success rate because they are averaged only over articles that were successfully reduced. Thus, they reflect efficiency conditional on success, rather than performance over the full test set.
Together, these metrics capture complementary aspects of practical performance: success rate measures reduction effectiveness, compilations and time measure computational efficiency, and total cost reflects the magnitude of the applied layout changes.
5.2.2. Greedy Algorithm Results
The bar chart in
Figure 6 compares the effectiveness of five different variations of the greedy algorithm in reducing document length. The vertical axis represents the percentage of articles successfully reduced, while the horizontal axis lists the algorithmic variants. It is important to note that none of the algorithms achieved a 100% reduction rate across the 140 papers. This is consistent with the difficulty of the benchmark: the test set consists of AAAI articles that had already been compressed by their authors to satisfy a strict seven-page limit, and the evaluation further imposed a controlled three-line overflow scenario on the final page. Therefore, successfully reducing the length of these articles while still passing the manual quality audit is a challenging task.
Overall, the combined Classification and Regression Model achieved the highest reduction success rate among the evaluated methods. Although its margin over the strongest simple baseline is moderate (76.4% vs. 70.0%), the result suggests that combining classification and regression signals can improve operator selection in this setting. The Simple and Heuristic methods perform comparably well, indicating that even straightforward or heuristic-based approaches can be quite effective. The Regression Model also performs strongly, only slightly behind the Simple and Heuristic methods. In contrast, the Classification Model yields the lowest reduction rate, suggesting that relying solely on classification predictions may not fully capture the complexity required for effective document reduction.
These results suggest that the hybrid approach provides a consistent, though moderate, improvement in reduction success over the strongest baselines in the full AAAI benchmark.
The bar chart in
Figure 7 compares the performance of the five different variations of the greedy algorithm using three metrics: compilations (blue), time (orange), and cost (green). These three metrics are conditional on successful reduction only. For all metrics, lower values indicate better performance. The vertical axis represents the values of each metric, while the horizontal axis lists the algorithmic variants.
The Heuristic algorithm has the highest cost. This suggests that it shortens articles mainly by directly applying more aggressive operators with high costs. Since cost is a proxy for the magnitude of geometric change, this suggests that the Heuristic baseline often relies on larger layout modifications than the other methods. These operators may therefore have a greater impact on the visibility and readability of the article, potentially reducing its overall legibility.
The Classification Model shows the best results for the three metrics, with low compilations, short time, and low cost. However, as noted in the previous analysis, this model successfully shortened the fewest articles overall. Thus, its favorable metric values should be interpreted as efficiency conditional on success, rather than as superior overall performance across the full benchmark.
The combined Classification and Regression Model strikes a balance, with a moderate number of compilations, relatively low cost, and shorter execution time. This approach leverages the strengths of both the classification and regression models, managing to shorten most articles while still producing strong results across the evaluated metrics. This model provides the most balanced overall trade-off among the evaluated methods: it achieves the highest reduction success rate while maintaining relatively low cost and short execution time.
5.3. Detailed Analysis of Reduction Outcomes
In addition to the automated experiments and evaluations, a thorough manual analysis was performed to validate the effectiveness and quality of the article reductions. This section provides an in-depth review of several key aspects.
In the GitHub repository, the directory “Article Reduction Outcomes” contains the organized reduction outcomes for the papers under the different algorithms. For more details about these results and the various outputs, please refer to the GitHub repository.
5.3.1. Manual Review of Reduced Articles
After running the reduction pipeline, we performed a document-by-document pass/fail audit, and an output was counted as successful only if it both satisfied the page limit target and remained readable. A candidate was rejected if we observed any of the following: (i) overlapping or cropped content, (ii) a caption separated from its float or placed on a different page, (iii) harmful paragraph merging (loss of local coherence or section hierarchy), single-word last lines, or severely ragged paragraphs, (iv) excessive negative vertical spacing or visibly uneven inter-entity gaps, (v) figures/tables shrunk below a legible width, or (vi) broken cross-references or labels. Only papers that satisfied all of these criteria entered the greedy algorithm evaluation.
Figure 8 provides an example of such a failure case, where the text overlaps and the article becomes unreadable. This manual validation step was essential to ensure that the reported results reflect both compression success and document usability.
5.3.2. Operator Usage Analysis
Figure 9 presents a heatmap illustrating the frequency of operator usage across the different algorithms. The operators, as described in
Section 5.1.1, include various actions for reducing document length. The data are presented on a logarithmic scale to address the skewed distribution of operator usage, where most values are relatively low but a few are substantially higher. This scaling makes it easier to visualize the differences in operator usage across the algorithms.
All algorithms make substantial use of vspace reductions, indicating that adjusting vertical space is a primary strategy for reducing document length. The most frequently used reductions are at the −0.25 and −0.5 levels. Combining two paragraphs into one is another common strategy. Reducing the size of figures is also a common operation used by all algorithms.
The violin plot in
Figure 4 supports the observation that the test set contains many textual and structural elements, such as paragraphs, sections, and subsections, while figures, tables, and enumerations appear less frequently. This helps explain why spacing-related operators, especially
vspace, are often useful in this benchmark setting.
The Heuristic algorithm tends to apply all possible vspace reductions extensively, especially at higher reduction levels such as −0.75 and −1. This suggests a more aggressive approach to space reduction, often prioritizing larger reductions regardless of their potential impact on readability. Other algorithms, such as the Simple, Classification, Regression, and combined Classification and Regression models, show a more balanced approach. These algorithms tend to apply smaller vspace reductions first, such as −0.25 and −0.5, before attempting larger reductions. This indicates a more deliberate strategy, consistent with preferring smaller geometric modifications before resorting to more aggressive edits.
Additionally, the Heuristic algorithm combines paragraphs much more frequently than the other algorithms. This approach may reduce spacing effectively, but it can also harm readability and the logical flow of the document, since paragraph separation is often important for conveying distinct ideas. The learning-based models, particularly the Classification and Regression Model, use the “combine 2 pars” operator much less frequently than the Heuristic algorithm.
This empirical pattern is consistent with the intended use of paragraph merging as a higher-risk operator: it may be useful in selected cases, but it should be applied conservatively and remains subject to policy-level restriction or manual rejection when it harms discourse structure.
In summary, the heatmap reveals that although all algorithms employ a variety of operators to reduce document length, there are notable differences in their strategies. The Heuristic algorithm follows a more aggressive policy, whereas the other methods adopt more balanced and prediction-guided strategies.
5.3.3. Influence of Content Variety on Reduction Outcomes
Focusing on the last two pages of each article often highlights the predominance of text over figures or tables in academic papers. Consequently, a substantial portion of the test set (47 out of 140 articles) consisted solely of text. This limitation meant that only text-based operators could be applied, significantly reducing the potential for effective document reduction. To better understand this effect, we analyze text-only articles separately.
In
Figure 10, the X-axis represents the different algorithms, while the Y-axis shows the percentage of articles that were successfully shortened. The red bars indicate the success rate for text-only articles (out of 47), whereas the blue bars represent the success rate for the remaining articles (out of the remaining 93). The data reveal a clear disparity in success rates between the two categories.
Text-only articles consistently exhibited a lower reduction success rate across all algorithms due to the limited set of applicable operators. In contrast, articles with additional elements showed a much higher success rate. In particular, the combined classification and regression approach achieves the highest reduction percentage for both text-only and mixed-content articles, yielding the best observed performance among the compared methods in this analysis.
The improvement in the reduction success rate is more pronounced for the combined Classification and Regression Model than for the other variations when evaluated on text-only articles. In this subset, the model achieves a success rate of 62%, compared to 49% for the closest baseline. This result is consistent with the broader feature distribution shown in
Figure 4, where textual and structural elements are common across the corpus. Since academic papers are largely composed of text and related structural components, strong performance on text-dominant articles is practically important.
In practical terms, this means that the combined model is more likely to recover the required page budget on difficult real articles, while still keeping the number of executed operators and the total edit cost relatively low.
Overall, these results suggest that the combined Classification and Regression Model offers the most favorable balance among the evaluated methods for both text-only and mixed-content articles, although the empirical margins are moderate rather than dramatic.
This analysis shows that reduction performance is sensitive to the structural composition of the document: when only text operators are available, the task becomes substantially harder, whereas mixed-content papers offer more opportunities for effective local edits.
To synthesize the main empirical observations,
Table 4 summarizes the key findings of the study together with their practical interpretation. The table highlights the main takeaways regarding predictive quality, end-to-end reduction effectiveness, computational trade-offs, hard cases, and the scope of the current evaluation. Overall, the table emphasizes that the main contribution of the proposed approach is not a dramatic gain on every single metric, but rather a consistent and practically useful balance between reduction success, edit cost, and runtime under a constrained real-document setting.
6. Discussion
The set of operators used in this work reflects a practical and representative choice, rather than a prescription. This distinction is also important relative to traditional
![Applsci 16 04846 i001 Applsci 16 04846 i001]()
space-saving packages: whereas rule-based tools such as
savetrees,
microtype, or title-formatting packages apply predefined global or category-level typographic adjustments, our framework is designed as a decision-support system that screens and ranks candidate local edits under explicit space constraints. Our pipeline is designed to be policy-aware and user-configurable: the
operator pool is provided as a profile (whitelist + parameter bounds), and the feature set is configurable. In other words, to comply with a specific venue or style guide, one only needs to provide a tailored list of allowed operators (together with their parameter bounds). The algorithm then explores and ranks
only that subset. High-risk edits (e.g., negative
\vspace or paragraph merging) can be completely disabled, assigned tighter bounds, or given higher costs, depending on policy and user preference. This applies in particular to paragraph merging: although it can be effective for saving space, it may also disrupt discourse structure or blur boundaries between distinct ideas. For that reason, the framework treats such edits as optional and policy-sensitive rather than universally desirable. This includes the possibility of enforcing visual uniformity constraints, such as consistent scaling factors for related figures or global typography policies, thereby ensuring that layout modifications remain aesthetically coherent in real-world deployments.
The default experiments use one profile and one feature schema, but users can supply a venue-specific operator list and, if desired, a custom feature plug-in. The greedy search is independent of these choices and can be replaced by another policy if needed. In particular, users need not adopt all operator categories suggested by the system. Operators that may affect discourse structure, such as paragraph merging, can be excluded entirely or assigned stricter costs so that they are less likely to be selected. In particular, high-risk operators such as paragraph merging are not mandatory components of the framework. They can be fully disabled, bounded, or assigned stricter costs through the configurable operator profile, allowing the system to comply with venue-specific or aesthetic consistency requirements. More generally, the framework is not intended to force all available edits onto a document. Rather, it supports selective and document-specific operator choice, allowing users or venue policies to exclude categories of edits that may be considered too aggressive or stylistically undesirable.
Limitations and Generalizability
The present study is intentionally framed as an AAAI-focused case study under a fixed template and page limit regime. This design was chosen intentionally in order to evaluate and compare the proposed algorithms under a controlled, realistic, and practically relevant benchmark setting. This design provides a controlled evaluation under a realistic and practically relevant setting, while broader cross-venue generalization is left for future work. Applying the same framework to other venues is possible in principle, but doing so would involve venue-specific operator profiles, legality constraints, and feature/operator calibration. An important next step is therefore to evaluate the same system architecture on additional mainstream templates, such as IEEE- or ACM-style formats, while preserving the same overall reduction framework. In addition, the synthetic repository used for training, although large and diverse, is still generated under bounded assumptions on entity counts, operator applicability, and layout composition. These assumptions improve controllability and coverage, but may not capture all real-world document structures. A further limitation is that readability and layout quality are not modeled directly in the optimization objective. Instead, the framework minimizes a geometric proxy for edit severity and relies on a separate manual validation step to assess the acceptability of the final output. We therefore view the current work as a first step toward broader layout-aware document reduction across additional templates and publication formats.
7. Summary and Future Work
In this paper, we tackled the challenge of reducing document length while preserving content, a problem we defined as DSOpt. We modeled this task as a combinatorial search problem, aiming to find a low-cost sequence of legal layout modifications that reduces the document to satisfy space constraints while minimizing the associated costs.
To address this challenge, we developed a greedy algorithm that, given an article, iteratively selects candidate operators according to a cost-ordered search procedure. To determine which operators are likely to be useful, we built regression and classification models that learn predictive signals from the extensive data we generated. These predictive capabilities were enhanced using Mixture of Experts techniques, allowing for more accurate gain estimation and effective document reduction. Our extensive evaluation on a large set of generated
![Applsci 16 04846 i002 Applsci 16 04846 i002]()
files demonstrates that our gain prediction model improves over the baseline heuristic approach.
We implemented three variations of the greedy algorithm based on prediction models: one in which the operator is selected using a classification model, another using a regression model, and a third combining both models. These variations were compared against two different baselines. Testing on 140 articles downloaded from arXiv showed that the combined classification and regression approach effectively leveraged the strengths of both techniques. This approach achieved the highest number of successful article reductions, while also maintaining relatively favorable compilations, processing time, and overall cost among the evaluated methods.
More broadly, the empirical results suggest that the main contribution of the proposed framework is not a dramatic improvement on every individual metric, but rather a practically useful balance between reduction success, computational efficiency, and edit cost under a controlled and realistic real-document setting. The study is therefore best interpreted as an AAAI-focused evaluation under a fixed and practically relevant benchmark setting, rather than as an attempt to establish immediate cross-venue generalization. In addition, readability and layout quality are not modeled directly in the optimization objective. Instead, the framework minimizes a geometric proxy for edit severity and validates the final output through a separate manual audit.
Looking ahead, future work will focus on several key areas. One important direction is broader empirical validation across additional venue templates, such as IEEE and ACM formats, in order to examine the extent to which the proposed architecture transfers under different layout conventions and operator profiles. First, we plan to apply heuristic search algorithms to further optimize operator selection and the sequence of operations. One significant advantage of considering a sequence of operations is the ability to anticipate future benefits. While a greedy approach focuses on the immediate next acceptable option, a sequence-based approach can make a small, seemingly suboptimal change initially in order to enable a more significant and beneficial adjustment later. By looking ahead and considering how one operation might set the stage for subsequent improvements, such an approach may achieve more effective document reduction. Additionally, we intend to integrate our non-LLM-based approach with LLM-based techniques for rephrasing paragraphs recommended by the prediction model, as highlighted in the related work. This integration aims to enhance the document reduction process by combining structural and linguistic optimizations.