---
title: 'TaFo: Neuro-Symbolic Table Formatting'
url: https://www.emergentmind.com/topics/tafo
type: topic
---

# TaFo: Neuro-Symbolic Table Formatting

TaFo, introduced in "Tabularis Formatus: Predictive Formatting for Tables" [2508.11121], is a neuro-symbolic method for predictive suggestion of conditional formatting (CF) rules for tables and spreadsheets. Its defining objective is to remove the dependency on user specification used by existing techniques in the form of formatted examples or natural language instruction: given only a table and a target column, TaFo automatically learns both the rule trigger and the associated visual formatting. The system combines component-based symbolic synthesis, semantic knowledge from language models, execution-guided diversity-preserving ranking, and corpus-grounded format learning over 1.8 Million public workbooks with CF and manual formatting [2508.11121].

## 1. Task definition and formal rule space

TaFo targets value-based formatting rather than structural formatting. Structural formatting systems focus on layout and presentation, such as headers and groups, whereas value-based formatting is data-dependent and driven by predicates over values, including comparisons to constants, statistics, and aggregates. TaFo is designed for the latter setting, with the explicit goal of surfacing analytical insights such as outliers, recent dates, and status markers like "PASS" [2508.11121].

The formal object manipulated by the system is a table
\[
\mathbf{E} = [e_i^j]_{i = 1 \rightarrow n}^{j = 1 \rightarrow m},
\]
with columns \(E_i\), rows \(E^j\), and headers \(H_i\). A cell is represented as
\[
e = (v, t, \mathbf{f}), \quad v \in \mathcal{V}, \ t \in \mathcal{T}, \ \mathbf{f}: F \rightarrow \mathcal{F}_F,
\]
where \(v(e)\), \(t(e)\), and \(\mathbf{f}(e)\) denote value, type, and format. The types considered are text, numeric, and date; the formatting identifiers are fill color, font color, bold, italics, and underline; and \(\mathbf{f}_\perp = \varnothing\) denotes no formatting [2508.11121].

A condition predicate is defined as
\[
C: (\mathcal{V} \times \mathcal{T})^n \rightarrow \mathbb{B},
\]
with \([\@H_i]\) denoting the value/type of the cell of the current row in column \(i\). A conditional formatting rule is then
\[
R = (C, \mathbf{f}),
\]
applied to a target column \(j\). The predictive formatting task is to generate a list of desirable \(R\) for a given \((\mathbf{E}, j)\) [2508.11121].

This formulation is technically significant because it requires joint inference over two coupled spaces: the predicate space and the style space. The paper emphasizes that prior systems either depend on user-authored examples or natural-language instructions, or focus on structural rather than value-based formatting. TaFo instead treats CF as a fully predictive problem, synthesizing both trigger and style directly from table context and corpus priors [2508.11121].

## 2. Neuro-symbolic architecture and condition generation

TaFo consists of three condition generators: a purely symbolic synthesis engine, a purely neural LLM generator, and a neuro-symbolic combination that allows bidirectional interaction between the two [2508.11121].

The symbolic path begins with a curated set of property templates tailored to CF. These include numeric statistics such as `AverageValue`, `Percentiles`, and `Skew`; datetime predicates such as `InLastWeek`, `InLastMonth`, `Today`, and `Year`; text profiles such as `MostCommonValues(k)`, `DuplicatesValues(k)`, `Categories`, `FreeText`, and `AverageLength`; and general counts such as `NumErrors`, `NumLogicals`, `NumDate`, `NumBlanks`, `NumNA`, `NumDuplicates`, `NumUniques`, `NumFormatted`, and `Formulas(k)` [2508.11121]. These extracted properties provide the building blocks for subsequent synthesis.

Predicate enumeration is performed with bottom-up component-based synthesis. The smallest search elements include composed components such as `NOT(Blanks())`. For multi-valued properties, each output becomes an individual constant candidate. Complex conditions are expressed in DNF over predicates. Because naive enumeration yields more than 100K candidates per table, TaFo trains a ranker and uses it in a beam search to keep only promising partial and complete rules [2508.11121].

The ranker is a three-layer dense network trained with a logistic regression objective over features from table properties and rule execution, including percentage highlighted, rule type/category, and argument length. Its predicted logit is used as the node score during search. This design is not merely a ranking convenience: it is the main mechanism that makes large-scale DNF synthesis operational in the absence of explicit user intent [2508.11121].

The neural path uses an LLM prompt with multi-step reasoning. The prompt includes headers, types, sample values, and extracted properties, and asks the model to identify relevant columns, propose predicates/functions, list constants, and synthesize rule suggestions. The few-shot prompt contains three static examples annotated with reasoning steps [2508.11121].

The neuro-symbolic combination is the characteristic mechanism. Symbolic insights prime the LLM, while LLM outputs are imported back into symbolic synthesis. Columns and constants obtained from the LLM are added to the enumerator, and predicates using these receive a `+10% reward` to their node scores. The paper gives the example that a semantically meaningful arithmetic component such as `[@Budget] - [@Cost]` can thereby become a viable synthesis primitive [2508.11121]. This suggests that TaFo uses the LLM less as a direct generator of final answers than as a semantic prior over a symbolic search space.

## 3. Execution-guided diversity ranking and automatic format learning

TaFo does not simply score candidate conditions independently. It also clusters them by execution behavior on the target column and interleaves selections across clusters to preserve diversity [2508.11121]. For each candidate condition \(C_i\), execution over the column produces a boolean vector \(O_i \in \mathbb{B}^n\). Semantic equivalence classes are then defined by identical execution:
\[
\forall C_i, C_j \in EC_k : O_i = O_j.
\]
The score of a cluster is
\[
S_k = Avg(s_r \in EC_k),
\]
where \(s_r\) is the node score of a rule in the cluster. Round-robin sampling then orders clusters by \(S_k\) and, within each cluster, orders rules by \(s_r\) [2508.11121].

This mechanism is central to TaFo’s notion of useful suggestions. A list of syntactically different rules that all highlight the same cells would be redundant; TaFo instead aims to cover different execution behaviors. The paper explicitly links this to diversity both in rule space and output space [2508.11121].

Format learning is handled separately from condition synthesis. Candidate formats are drawn from
\[
\mathbf{f}_c = \mathbf{f}_e \cup \mathbf{f}_r,
\]
where \(\mathbf{f}_e\) are formats already present in the sheet and \(\mathbf{f}_r\) are formats mined from similar tables and rules in the corpus [2508.11121]. Table similarity is computed from headers and contained formulas, and rule similarity from predicates and constants, using weighted Hamming distance with weights learned via regression on `100 manually annotated table similarities`. Mining retrieves up to \(\lambda_N\) matches or stops when similarity falls below \(\lambda_T\) [2508.11121].

Selection of individual format identifiers uses identifier frequency scoring, with \(\mathbf{f}_e\) weighted double to bias toward in-sheet styles. Identifiers whose average score exceeds `0.5` are kept. Identifier values are selected by frequency ranking; colors are compared using the closest CSS color from the extended web color set based on Euclidean distance in RGB space. A final style-grounding rule aligns the suggestion with local sheet aesthetics: if `≥75%` of existing formatted cells use a specific shade, TaFo adopts that shade for the suggested color [2508.11121].

A plausible implication is that TaFo treats style as a corpus-conditioned and sheet-conditioned retrieval problem rather than a purely generative one. This differs from generic LLM-based formatting proposals, which the paper notes tend to select saturated colors such as red and green without regard to local style conventions [2508.11121].

## 4. Data, training protocol, and evaluation methodology

TaFo is trained and evaluated on a corpus of `1.8 million public Excel workbooks`, the same source used by Cornet and FormaT5 [2508.11121]. From these workbooks, de-duplicated CF tasks yield `105K rule tasks`, with `80K training tasks` for ranker and synthesis and `25K evaluation tasks` for CF. For manual-formatting tasks, where no CF rules are present, the corpus contains `683K tables discovered`, of which `100K` are randomly sampled for evaluation [2508.11121].

CF rules and aligned target columns are extracted from spreadsheets and parsed into abstract syntax trees over TaFo’s predicate grammar. Associated formats are also collected. Column data types are annotated as text, numeric, or date, consistent with spreadsheet usage distribution. On CF benchmarks, the ground truth is the user-authored rule and format; on manual-formatting benchmarks, formatted cells are treated as positives and predicted rules are evaluated against the observed formatted cells [2508.11121].

The baselines span symbolic, neural, and prompt-based systems. Symbolic baselines include Greedy Enumeration, which uses component-based enumeration plus the Cornet ranker with `beam width 10, depth 5`, and an adapted Cornet configuration using unsupervised clustering with two classes, formatted versus non-formatted. Neural table encoders include TAPAS and TUTA. Natural-language CF generation is represented by FormaT5 with its NL channel removed but its placeholder-filling mechanism retained. Code LLM baselines include CodeT5+, StarCoder, CodeLlama, and GPT-4; among CoT, ToT, and PoT prompting strategies, `program-of-thought prompting worked best`, using table information and five few-shot examples retrieved by CodeBERT similarity [2508.11121].

Evaluation distinguishes condition quality, format quality, and diversity. Condition quality uses exact match, sketch match, and execution match, where execution equivalence is
\[
\forall E^j \in \mathbf{E}: \quad C_L(E^j) = C_U(E^j).
\]
Condition diversity uses average pairwise token-level edit distance, average pairwise cosine similarity of CodeBERT embeddings, and average pairwise Hamming distance over execution vectors. Format quality uses exact color match via closest CSS color mapping and property match at the identifier level regardless of value [2508.11121].

## 5. Empirical results and ablations

TaFo reports its strongest results on condition learning. For execution match, Top-1/3/5 scores are `36.7% / 46.8% / 64.3%`. For exact match, the corresponding values are `18.6% / 24.5% / 30.1%`. For sketch match, they are `54.2% / 73.3% / 84.8%` [2508.11121]. The paper states that TaFo bests GPT-4 and FormaT5 across all metrics, and that versus GPT-4 the execution match gains are `+5.5%` at Top-1, `+7.7%` at Top-3, and `+6.0%` at Top-5 [2508.11121].

For manual-formatting tasks without CF rules, TaFo could have automated `≈55%` of column formatting with Top-3 suggestions measured by execution match [2508.11121]. For format learning, exact color match at Top-1/3/5 is `13.2% / 18.9% / 21.3%`, while property match is `26.5% / 47.2% / 55.4%`. The paper reports improvements over GPT-4, CodeT5+, and FormaT5 of `+4.8–9.1%` for exact match and `+9.4–23.7%` for property match [2508.11121]. End-to-end, TaFo reaches `≈50%` execution match with Top-3 suggestions [2508.11121].

The diversity metrics reinforce the design rationale of execution-based clustering. For Top-5 suggestions, TaFo achieves `14.3` average pairwise edit distance, `0.87` average pairwise embedding similarity, where lower is better, and `0.65` average pairwise execution Hamming distance [2508.11121]. The paper attributes lower diversity in LLM baselines to mode collapse.

The abstract summarizes the aggregate gain by stating that TaFo outperforms competing systems by `15.6\%--26.5\%` on matching user added ground truth rules in tables [2508.11121].

The ablation studies isolate the major contributing components. Removing execution-guided ranking reduces Top-1/3/5 execution match to `19.8% / 34.5% / 56.4%`. Removing symbolic property extraction yields `17.2% / 20.7% / 53.4%`, described as the largest drop. Removing LLM multi-step reasoning yields `23.5% / 38.2% / 58.8%`. Replacing neuro-symbolic interaction with simple pooling yields `25.8% / 40.0% / 59.6%` [2508.11121]. For format learning, removing corpus retrieval gives `17.5% / 28.1% / 34.8%`, removing sheet properties alignment gives `23.1% / 40.0% / 48.2%`, and removing style grounding gives `21.4% / 36.6% / 44.4%`; the full format learner achieves `26.5% / 47.2% / 55.4%` [2508.11121].

A concise summary of the headline numbers is as follows.

| Evaluation target | Metric | TaFo |
|---|---|---|
| Condition learning | Execution match Top-1/3/5 | 36.7% / 46.8% / 64.3% |
| Condition learning | Exact match Top-1/3/5 | 18.6% / 24.5% / 30.1% |
| Condition learning | Sketch match Top-1/3/5 | 54.2% / 73.3% / 84.8% |
| Format learning | Exact color match Top-1/3/5 | 13.2% / 18.9% / 21.3% |
| Format learning | Property match Top-1/3/5 | 26.5% / 47.2% / 55.4% |
| Manual-formatting automation | Top-3 execution match | ≈55% |
| End-to-end | Top-3 execution match | ≈50% |

These results indicate that TaFo’s main empirical advantage lies not only in learning more accurate predicates, but in producing suggestion sets that are simultaneously diverse and stylistically grounded.

## 6. Failure modes, practical characteristics, and broader significance

TaFo’s qualitative analysis identifies several recurring failure modes. Neural-only candidates may exhibit low diversity or propose trivial predicates that highlight entire columns, such as `"[Budget] > [Cost]" when true everywhere`. Symbolic-only candidates lack semantic associations and therefore may fail to relate columns such as Budget and Cost in a meaningful arithmetic expression. Style misalignment remains possible because generic LLMs tend to choose saturated colors, although TaFo’s corpus mining and grounding reduce this effect. Large numeric and date spaces also remain difficult because thresholds and granular time windows produce expansive search spaces [2508.11121].

From a systems perspective, TaFo is relatively lightweight. Its average latency is `1218.5 ms`, including GPT-4 API network latency, while the symbolic-only variant runs at `189.3 ms`. Its memory footprint is `Disk 4.5; CPU 8.3; GPU not applicable`, since the LLM is accessed via API [2508.11121]. The symbolic-only mode is therefore suitable for low-resource or offline environments.

Robustness results show that the method works across text, numeric, and date columns, with strongest performance on text and improved numeric/date performance as more suggestions are allowed. Under partial data availability, using only `5–10%` of rows, TaFo maintains `>40% Top-3 execution match`, outperforming GPT-4 in low-data settings [2508.11121]. This suggests that execution-guided synthesis and corpus-grounded styles remain effective even under viewport-like constraints.

The paper also emphasizes usability and interface implications. Because suggestions are interleaved across distinct execution clusters, the presented list is non-redundant. Because styles are grounded to existing sheet aesthetics, the proposals are less likely to clash with the spreadsheet’s visual conventions. The reported outcome is that three suggestions suffice to automate `≈50–55%` of tasks across CF and manual-formatting scenarios [2508.11121].

Future work in the paper extends the same neurosymbolic synthesis-plus-grounding paradigm to data cleaning, transformation, visualization, and querying. It also proposes richer domain-specific semantics, improved diversity objectives, smaller on-premise LLMs, and accessibility-aware personalization. The ethical discussion notes that corpus-driven priors may propagate conventions such as red/green semantics and may not address broader cultural or accessibility issues, including color-blindness, without explicit intervention [2508.11121].

In that sense, TaFo occupies a specific technical position within spreadsheet intelligence: it reframes conditional formatting as a predictive synthesis problem over executable predicates and grounded styles, rather than as a user-specification problem. Its significance lies in combining symbolic completeness, LLM-derived semantic bias, execution-based diversity control, and sheet-aware style grounding into a single CF generation pipeline [2508.11121].

Source: https://www.emergentmind.com/topics/tafo