TL;DR
Large Language Models (LLMs) are increasingly used to analyze tabular data, but they are surprisingly fragile to how that data is arranged. This paper introduces Adversarial Table Permutation (ATP), a gradient-based attack that shuffles rows and columns to expose a fundamental vulnerability: changing a table's layout without altering its meaning can completely fool state-of-the-art LLMs.
What Problem Does This Paper Address?
Tabular data is inherently permutation-invariant—shuffling the rows or columns of a table doesn't change the underlying relational information. However, modern LLMs process tables by linearizing them into a flat sequence of text tokens (e.g., comma-separated or Markdown strings) to fit standard prompt formats.
Because Transformer architectures are fundamentally order-sensitive, this "linearize-then-prompt" paradigm creates a structural mismatch. The authors investigate whether this order-sensitivity makes LLMs vulnerable to simple table rearrangements, showing that two tables containing identical information but presented in different layouts can elicit completely inconsistent and incorrect answers.
Methods
To systematically find the worst-case table layouts, the authors propose Adversarial Table Permutation (ATP). Finding the worst-case permutation is a discrete, combinatorial optimization problem (NP-hard). ATP bypasses this by relaxing the discrete search space into a continuous one:
- Convex Relaxation: It relaxes permutation matrices to doubly stochastic matrices using the Birkhoff-von Neumann theorem and a differentiable Sinkhorn operator.
- Hybrid Permutation: Soft permutations are applied to continuous token embeddings during optimization, while hard permutations (computed via the Hungarian algorithm) are projected onto discrete position IDs and attention masks to ensure the final generated attack is valid.
- Entropy Regularization: Instead of using a low temperature in the Sinkhorn operator (which causes numerical instability in low-precision formats like float16/bfloat16), they introduce an information entropy penalty to force the soft matrices to converge cleanly toward sharp, valid permutations.
Datasets
The method was evaluated on three popular Table Question Answering (TQA) datasets:
- WTQ (WikiTableQuestions): Complex reasoning over semi-structured HTML tables from Wikipedia.
- TATQA: A hybrid dataset containing both tabular and textual financial data.
- FeTaQA: A free-form table question answering dataset focusing on text generation.
Note: The authors filtered out the small fraction (~1-3%) of questions that explicitly depend on order (e.g., "What is in the first row?").
Key Insights and Ideas
- The Linearization Flaw: Row-wise linearization creates artificial local token adjacencies. The final token of one row sits right next to the first token of the next row. ATP exploits this by maximizing attention across these artificial boundaries, distracting the model from actual within-row relationships.
- Column Shuffling is Deadlier Than Row Shuffling: Shuffling columns alters the token sequence inside every single row, disrupting the serialized text much more aggressively than simply reordering rows.
- Non-Additive Joint Effects: Shuffling rows and columns together (joint attack) causes a performance drop significantly worse than the sum of row-only and column-only drops.
- Attention Misdirection: Mechanistic analysis reveals that adversarial layouts don't just mess up the final decoding step; they fundamentally alter internal attention maps, redirecting attention mass away from the correct evidence cells toward irrelevant ones.
Key Results
The ATP attack consistently outperformed random shuffling and heuristic baselines across a wide range of open-source models (including Llama-3.1, Qwen2.5, and TableLLM):
- On WTQ, the performance of
Qwen2.5-14B-Instructdropped from a vanilla score of 0.47 to 0.26 under joint ATP.Llama-3.1-8B-Instructdropped from 0.46 to 0.22. - On TATQA,
Llama-3.1-8B-Instructplummeted from 0.49 to 0.20. - Even closed-source models like GPT-4o and Gemini-2.5 (tested via gradient-free heuristic searches like evolutionary search because ATP requires white-box gradients) showed significant drops: Gemini-2.5 dropped from 0.88 to 0.60 on WTQ.
Limitations and Future Work
- White-Box Constraint: ATP is gradient-based, meaning it requires access to model embeddings and gradients, making it directly inapplicable to closed APIs (though proxy models or zeroth-order optimization could bridge this gap).
- Scope: The study focuses strictly on order-invariant questions and standard text-based linearization.
- Future Directions: The authors suggest using ATP for adversarial training (min-max optimization) to build robust models, exploring randomized smoothing during linearization, and extending the analysis to other structured formats like JSON and XML.
Summary updated