Exploring the Limits of Fine-grained LLM -based Physics Inference via Premise Removal Interventions (2024)

Abstract: Language models (LMs) can hallucinate when performing complex mathematical reasoning. Physics provides a rich domain for assessing their mathematical capabilities, where physical context requires that any symbolic manipulation satisfies complex semantics ( e.g., units, tensorial order). In this work, we systematically remove crucial context from prompts to force instances where model inference may be algebraically coherent, yet unphysical. We assess LM capabilities in this domain using a curated dataset encompassing multiple notations and Physics subdomains. Further, we improve zero-shot scores using synthetic in-context examples, and demonstrate non-linear degradation of derivation quality with perturbation strength via the progressive omission of supporting premises. We find that the models’ mathematical reasoning is not physics-informed in this setting, where physical context is predominantly ignored in favour of reverse-engineering solutions.

## introduction language models demonstrate some level of mathematical ability @xcite @xcite . this reasoning modality requires controlled symbolic behaviour involving the repeated application of mathematical operations @xcite , and lms struggle to deliver this reliably @xcite . a particularly challenging mathematical domain is that of physics, where equation derivations serve as a rich environment within which the mathematical inference capabilities of lms may be thoroughly examined, yet in contrast to other forms of mathematical reasoning @xcite @xcite , there are few examples of such efforts @xcite . while mathematics proofs are closer to a logical argument over more abstract domain types, physics derivations are centered around the integration of the abstraction of physical properties and laws into approximations and premises, where algebraic and calculus-related symbolic manipulations are performed to obtain novel equations, through a step-wise derivation, in close dialogue with empirical evidence. an explanation for the lack of physics-related approaches @xcite @xcite is the fact that automating scientific discovery in mathematics has a long tradition in the context of automated theorem provers and proof assistants @xcite , and this relies on the translation of mathematical proofs into logical forms @xcite . however, much of physics is less compatible with logical formalisation @xcite @xcite @xcite . the flexibility of transformerbased models as soft reasoners @xcite offers the opportunity to circumvent formalisation requirements, and develop models capable of detailed mathematical reasoning based on informally defined scientific knowledge. however, as with any form of mathematical reasoning, these models need to be built around models that support controlled, step-wise, symbolic inference. one reason why current lms fail in this regard, is because online resources used for training (such as wikipedia and arxiv), and many mathematical datasets @xcite @xcite , do not feature the required detail necessary for fine-grained reasoning. physics derivations contain specific notations (e.g., dirac notation) that are relied upon to build symbolically complex text spans, and complex operations (e.g., laplace transform, taylor expansion) form sophisticated dependencies between textual elements. moreover, the derivations presented in papers and textbooks omit a significant number of steps, reinforcing difficulties in training models to perform more detailed calculations. for instance, in fig. 1 , gpt-4 fails a derivation (from the present data) related to the uncertainty principle in quantum mechanics. the first error arises from attempting to substitute the rhs of the second equation into the rhs of the first, but gpt erroneously keeps the ´∞ -∞ db in the lhs. the second error involves an incorrect evaluation of an integral over a dirac delta function (by a factor of 2π), which is a critical result in physics. realworld research inherently involves equation manipulation which is out-of-distribution with respect to models' training data, either through a derivation's specific use of notation or its underlying reasoning. if state-of-the-art lms fail at such basic manipulation, and if current evaluation metrics fail to account for such fine-grained errors @xcite , to what extent are leading methods appropriate for inference in mathematical domains @xcite ? this paper aims to explore these considerations, contributing with: through these contributions, we measure and qualify the ability of current lms in performing out-of-distribution, fine-grained, multi-step mathematical reasoning, and aim to provide empirical foundations for developing transformer-based reasoners suitable for assisting discovery in physics and related fields. ## related work our focus is on the generation of step-wise detailed derivations of physics equations with lms @xcite @xcite @xcite . while we presently consider solely equations, math generation exists in various forms, split between approaches that consider formal languages @xcite @xcite and those considering informal mathematical natural language @xcite @xcite @xcite . informal reasoning approaches generally involve code generation as input to symbolic solvers @xcite @xcite @xcite , or directly generating math reasoning in natural language @xcite @xcite . numerous approaches exist for evaluating the mathematical and symbolic capabilities and robustness of models @xcite @xcite , in contexts such as solving math word problems @xcite @xcite . various datasets exist containing mathematical reasoning @xcite @xcite , and to a lesser extent, physics @xcite @xcite . we narrow our scope to isolate equational content from natural language descriptions, for the purpose of testing purely the equation manipulation capabilities of lms in the physics domain. to summarise, we consider an equation derivation generation task, contribute a fine-grained physics dataset spanning multiple subdomains, perturb input prompts with a premise removal intervention, and explore model performance and degradation due to perturbations. we aim for this data to improve the detailed step-wise equation derivation capabilities of lms, and use it to analyse their ability to perform physics reasoning with complex equational forms (fig. 1 and 2 ). we later highlight the difference between coherent mathematical and physical reasoning (fig. 4 ), and discuss underlying generation degradation laws and how lms perform mathematics in this context. ## physics dataset construction to elicit the level of mathematical detail and coherence from models as described in section 1, we randomly select a number of derivations from wikipedia spanning electromagnetism, quantum, classical and statistical mechanics, and expand each example until the required granularity is obtained (approximately one operation per step). we rely on the support of two annotators with adequate physics expertise (master's level). fig. 2 gives an example of this rewriting and the departure from natural language. with respect to granularity differences, the single intermediate step (denoted by red) in the wikipedia derivation on the left, is actually composed of multiple finegrained steps naturally omitted for the sake of succinct communication online. experienced physicists may indeed skip these steps within their own workings, but there is no guarantee that lms can reliably perform them without error @xcite @xcite @xcite . on the right-hand side, this single step is expanded into four finer-grained steps that improve explainability. the first and second equations in the expanded derivation are premises extracted from the text. the third equation is formed by substituting the second premise into the first, and the fourth equation is not explicitly written anywhere -it is the fourier transform of φ(χ) described non-mathematically within the initial description now included for completeness. the remaining equations are obtained through substitution. we algorithmically describe this expansion and annotation process for converting online derivations into examples rendered in appendices b-d, in alg. 1. this protocol was applied by each annotator within a double swap, review and refine setting. initial derivations were split between each annotator, and after initial annotation, the datasets were swapped for review and changes were tracked. a second swap was performed for accepting the proposed changes. the inclusion of the (implicit) fourier transform and the (explicit) premise in fig. 2 , give an example of how a combined modality of natural language and equations is mapped into a single equational modality. the expansion of one step into four, describes the emphasis towards the explainable reasoning we wish to elicit from models. high-quality @xcite data of this kind is necessary to bridge an incompleteness gap between the communicative reasoning available online (used to train/evaluate models) and the reality of physics calculations @xcite @xcite @xcite . establishing that models can robustly perform such reasoning is a prerequisite enabling their utility and application in theoretical discovery. ## derivation generation and generalisation capabilities the experimental analysis occurs in two parts: evaluation on an in-distribution test set in the setting of a derivation generation task, followed by an out-of-distribution evaluation facilitated by the progressive removal of premises from in-distribution prompts. perturbed prompts are out-of-distribution with respect to either a model's training data or in-context examples. ## conclusion we explore the mathematical ability of lms in the context of a derivation generation task using a novel dataset of equation derivations and prompt interventions, with the intent of emulating granular mathematical workings and exploring how models perform detailed calculations involving a variety of physics notations. we apply premise removal interventions on prompts to reveal a non-linear relationship between the perturbation strength and average derivation quality, as reported by manual and automatic scores. we find that models (particularly gpt-4) derive goal equations from premises through reverse-engineering intermediate steps without appropriate consideration of basic underlying physics. this becomes increasingly apparent as we progressively remove premises from few-shot prompts. furthermore, many algebraic errors arise from attempts at substitution. while it is challenging to build synthetic datasets that reflect all aspects of mathematical reasoning @xcite , it is more manageable to focus on the application of individual operations (such as substitution), and use symbolic engines to apply them in the context of vast vocabularies of symbols and notations representative of target subdomains, which could potentially bolster models' out-of-distribution math-ematical abilities. our use of synthetic in-context examples (involving substitution) improves models' evaluation scores. although exploration of the synergy between language models and symbolic engines is underway @xcite , physics derivations rely on physical behaviour which is implicitly assumed (e.g., commutative properties of quantum operators), yet is ignored by lms. such assumptions govern the reasoning paths allowed in derivations, and are hence independent of the ability to perform fine-grained algebraic manipulation. this is effectively a premise/operation selection problem, and integrating symbolic solvers does not inherently improve this limitation @xcite . we find contemporary language models severely lacking in this regard, and suggest research efforts should be directed towards lm-based querying of appropriate knowledge bases during inference alongside solver integration @xcite .