Source-linked AI summary
Continuous Optimization for p-adic Models
Julian Salazar, Dimitri Kanevsky, Matt Harvey, Pascal Getreuer, Lucas Dixon
TL;DR
Native optimization for p-adic models is difficult because Qp is disconnected and standard losses can be flat away from minima. The paper uses continuous optimization in a Berkovich setting and reports efficient gradient-based training, including depth-5 regression.
Problem
Method
The paper uses the continuous radius in the Berkovich parameter space to vary losses that are flat over Qp and formulates continuous p-adic optimizers.
Source: §1 · p. 2, §3.1 · p. 3Results
With batches of 32, gradient methods reached depth 5 after 0.95–0.98 training-example equivalents on average, compared with 35.5 for beam search of width five.
Source: §5 · p. 8Takeaways & Limitations
The framework trains affine models and one restricted two-layer model with p-adic parameters and provides a basis for research toward deep p-adic neural networks.
Source: §1 · p. 2, §7 · p. 10The ideal architecture and setup for deep models remain open questions, and convergence guarantees remain open.
Source: §7 · p. 10
Abstract
from arXiv · showhide
We present the first method for native, continuous gradient descent for machine learning models with $p$-adic parameters. Existing native optimizers are discrete, mostly combinatorial searches, as the $p$-adic numbers $\mathbb{Q}_p$ are totally disconnected, with standard losses that are flat away from their minima. To enable continuous optimization, we propose working with $\mathbb{Q}_p$ via its Berkovich affine line: a canonical, path-connected expansion of $\mathbb{Q}_p$ that preserves its isometries and uniquely extends its analytic maps. This hull is a metric tree with interpretable points and local derivatives, which we show enables effective optimizers and backpropagation. We formulate gradient descent and show that its approximations efficiently learn linear models with coefficients in $\mathbb{Q}_p$ to do modular arithmetic, an XOR-like task not expressible by linear models in $\mathbb{R}$. We also demonstrate momentum and Adam variants, linear regression, and classification on binary-encoded hierarchies (Quillian semantic networks), addressing open problems posed by Martins (2025). Library at https://github.com/google-deepmind/padic-ml
1 Introduction
Direct optimization over Qp is difficult because the field is totally disconnected and natural losses can have vanishing gradients. The paper uses the Berkovich affine line to formulate continuous optimization and demonstrates p-adic optimizers on learning tasks.
- P-adic models may suit ultrametric data, subtree-correlated hierarchies, and number-theoretic algorithms; hyperbolic embeddings and ultrametric fitting instead learn real-valued representations.An isometric embedding of N ultrametric points requires at least N−1 Euclidean dimensions.Source: §1 · p. 1
- The Berkovich affine line provides a canonical path-connected enlargement of Qp to which analytic maps and the p-adic norm extend.The paper uses this analytic structure to construct continuous losses with informative directional derivatives.Source: §1 · pp. 1–2
- The paper demonstrates native continuous optimization for p-adic models, where direct optimization is difficult because Qp is totally disconnected and natural losses can have vanishing gradients.Existing methods use discrete searches or real-valued optimization; systematic searches can scale exponentially, while random walks and annealing do not use gradients to guide proposals.Source: §1 · pp. 1–2
- The paper defines Γp as the tight span of Qp, its convex hull in the Berkovich affine line, and places model parameters in the product space Γ^d_p.Source: §1 · p. 2
- The proposed optimizers include joint gradient descent, Momentum, and Adam, approximated through grouped coordinate descent, and the losses train linear models for modular arithmetic and binary-encoded semantic hierarchies.Source: §1 · p. 2
- The paper formulates backpropagation, releases an open-source library, and addresses Martins (2025) problems 6.1 and 6.2 while opening a path toward problem 6.3.Source: §1 · p. 2
2 Background: p-adics and Related Work
The section introduces p-adic arithmetic and geometry, then explains why ordinary loss optimization is difficult: Qp has no compatible total order or nonconstant paths, and natural losses can be locally flat. It also reviews discrete p-adic learning methods and real-valued approaches to tree-like data.
- P-adic numbers are represented as base-p series; the valuation marks the rightmost nonzero digit, the norm is p^-v, and distance satisfies the strong triangle inequality.Source: §2 · p. 2
- Qp has no total ordering compatible with its arithmetic and is totally path-disconnected; Figure 1 contrasts disconnected 3-adics with the path-connected p-adic hull.Optimization losses require values in an ordered field such as R.Source: §2 · p. 2, Figure 1 · p. 3
- Natural p-adic absolute-error losses are locally constant away from exact fits, producing vanishing gradients at parameters that are not exact fits.Predictions closer to each other than to the target have the same loss.Source: §2 · p. 2
- Prior p-adic learning approaches include digit-prefix searches, residue modifications, random increments, and polynomial feasibility over finite rings; other methods use real-valued optimization.Source: §2 · pp. 2–3
- Related hierarchy methods include hyperbolic embeddings and real edge-weight ultrametric fitting, while metric gradient flows and subgradient methods optimize on tree-like spaces.Source: §2 · p. 3
3 Analytic Maps on the p-adic Hull Γp
The paper uses the Berkovich affine line to give p-adic parameters a canonical path-connected space where analytic maps extend. Its tree geometry supports continuous variation in parameter radii and a continuous loss for optimization.
3.2 Forward Propagation
- Analytic maps extend uniquely to the hull, enabling stage-by-stage propagation through model stages.The stagewise composite extends the original model, though it need not equal the unique extension of the full composition.Source: §3 · p. 3, §3.2 · p. 4
3.1 Parameter Space
- Γp is the convex hull of Qp in the Berkovich affine line and is identified as the tight span of the p-adic metric space.The paper presents this as a canonical connected parameter space.Source: §3 · p. 3, §3.1 · p. 4
- Ordinary p-adic values have radius zero, while positive radii provide a continuous variable over which losses can vary.The tree’s branches encode p-adic digit choices.Source: §3.1 · pp. 3–4
- The product space Γp^d omits mixed seminorms of the full Berkovich affine space, whose possible optimization benefit remains open.Those seminorms may offer additional descent directions.Source: §3.1 · p. 4
3.2 Forward Propagation
- The output radius is the maximum over Taylor coefficients scaled by input radii, with maximizing monomials designated as active terms.For convergent analytic maps, the active-term set is finite whenever the output radius is positive.Source: §3.2 · p. 5
- Stagewise propagation is exact at centers but can overestimate output radii when a parameter reaches a stage along multiple paths.Merging stages can tighten the radius bound at the cost of larger analytic expressions.Source: §3.2 · p. 5
- The direct loss is a continuous relaxation whose radius term makes it decrease as the prediction radius grows, even when the maximum term stays constant.It is formed by comparing the prediction hull point with the target’s zero-radius point.Source: §3.2 · p. 5
4 Continuous Optimization
The paper defines descent on the metric tangent directions of the p-adic hull and approximates joint updates through coupled parameter groups. It also describes momentum and Adam variants and a backpropagation procedure for computing directional derivatives.
4.1 Gradient Descent
- Gradient descent selects the steepest available tangent direction and clips steps at vertices, where the available directions and slopes change.At inner vertices, downward directions correspond to choosing a p-adic digit.Source: §4.1 · pp. 5–6
- Momentum averages directional slopes and child-direction excesses; Adam rescales a coordinate’s directions using one second-moment value per parameter.On differentiable edges, momentum reduces to Euclidean momentum when the incoming histories satisfy the stated symmetry condition.Source: §4.1 · p. 6
4.2 Approximation via Parameter Groups
- Naive joint direction selection can enumerate up to (p + 1)^d choices, while grouping coupled parameters makes enumeration linear in the number of groups.Updates select one coordinate per group and move selected coordinates together under the clipping rule.Source: §4.2 · pp. 6–7
4.3 Backpropagation
- Backpropagation propagates directional rates through model stages, with exact centers and bounded radii; its derivative matches the composed extension when no parameter reaches a stage along two paths.For affine models, the Jacobian approximation equals the model, and child slopes can be accumulated in O(m + p) work rather than O(mp).Source: §4.3 · pp. 7–8
5 p-adic Regression
The section evaluates gradient methods on affine and two-layer p-adic regression, including an engineered adverse initialization. They recover target coefficients across the reported seeds, with gradient methods using little training work on the affine task.
Experimental setup
- The affine experiment uses noisy three-dimensional Q3 regression and a two-layer model with four-input targets and the same noise setting.It uses 512 train, development, and test examples, with batch size 32.Source: §5 · p. 8
- Learning rates and beam widths are selected by work to first depth-five agreement on every independent validation observation of the same function.Work counts repeated example uses, so each batch-32 update or beam-candidate scoring contributes 32/512 training-example equivalents.Source: §5 · p. 8
Affine regression
- The engineered adverse start is a digitwise local minimum lifted to disks of radius 3^-8, allowing radius growth to revisit coarser digits.For affine regression, gradient methods otherwise start at the Gauss point, while beam search starts with coefficients at zero.Source: §5 · p. 8
- 0.95–0.98 training-example equivalents brought gradient methods to depth 5, versus 35.5 for width-five beam search.From the engineered adverse start, plain GD recovered on three of five seeds, while Momentum and Adam recovered on all five.Source: §5 · p. 8
Two-layer regression
- 1.45 ± 0.25 training-example equivalents let GD recover the two-layer model on all five seeds, with test loss close to the true-coefficient loss.Momentum and Adam also recovered all five; beam search did so at selected widths, while width five missed one seed.Source: §5 · p. 9
6 p-adic Classification
The section extends p-adic linear classification to multiple classes using valuation logits and a continuous training loss. Experiments report perfect test accuracy for matched-prime modulo classifiers and show that gradient descent approaches beam-search accuracy on the Quillian benchmark.
6 p-adic Classification
- The paper extends the p-adic linear classifier to multiclass classification by defining softmax and optimizing it with gradient descent in Γp^d.This resolves Martins (2025)’s Open Problem 6.1 and addresses 6.2.Source: §6 · p. 9
6.1 Logits, Softmax, and Loss
- Training logits use the negative base-p logarithm of the radius of the output’s lowest common ancestor with zero, bounding the output norm across representatives.When the center’s norm exceeds the radius, the logit is the center’s valuation; otherwise it is the negative log-radius.Source: §6.1 · p. 9
6.2 Experiments
- For modulo classification, initialization selects the weight’s depth from training labels but is identical across classes, so it predicts at chance before training.The experiment tests whether training finds class biases that complete the solution under cross-entropy with valuation logits.Source: §6.2 · p. 9
- Matched-prime classifiers attain perfect test accuracy across five seeds, while mismatched primes, permuted codes, and Euclidean linear classifiers remain near chance.The results emphasize prime-dependent encodings that linearly separate congruence classes; one-hot encodings also fit, at a dimension cost.Source: §6.2 · p. 9, Table 2 · p. 10
- The Quillian benchmark comprises 1,680 propositions and 28 independent binary property tasks, using fixed hand-designed Q2 entity codes with shared prefixes for semantically close entities.Only 8.04% of labels are positive; reported metrics include positive-class F1, average precision, and accuracy.Source: §6.2 · p. 10
- Gradient descent approaches both beam-search baselines in accuracy on the Quillian benchmark, where test error measures learning from the training split.Hand-set weights from Martins classify every proposition correctly, and a permuted control tests the hierarchy-preserving 2-adic encoding.Source: §6.2 · p. 10, Table 3 · p. 10
7 Conclusion
The framework trains affine models and one restricted two-layer model using approximate joint gradient descent with exact derivatives. The authors identify open questions about deep-model design, convergence, and evaluation scale, and disclose their use of AI.
7 Conclusion
- The framework trains affine models and one restricted two-layer model with approximate joint gradient descent using exact derivatives.The theory is described for arbitrary-depth models, but the tradeoff between radius bounds and stage-collection cost, and suitable deep-model architecture, remain open.Source: §7 · p. 10
- Formal convergence guarantees remain open, and the authors intend to explore adelic formulations combining real and p-adic norms.Over Berkovich spaces, the proposed direction is Arakelov geometry.Source: §7 · p. 10
A Disclosures
- The authors report that AI drove implementation, technical proofs, and formal presentation, while they drove research direction, conceptual foundations, exposition, and experiment design.They state that they revised the AI-driven work and accept responsibility for the publication.Source: A Disclosures · p. 13
B Comparison with p-adic Optimization Methods
This block contrasts p-adic optimization approaches, defines the Berkovich hull’s metric structure, and gives equivariance properties for coordinate-based optimizers.
B Comparison with p-adic Optimization Methods
- Earlier p-adic methods optimize classical values or finite digit prefixes, while the Berkovich hull permits gradient descent to use positive-radius states.Other compared approaches include real-valued optimization, hyperbolic embeddings, and ultrametric fitting.Source: B Comparison with p-adic Optimization… · pp. 13, 15
- Beam search expands finite digit prefixes and can discard a prefix of the best later solution; Hamming-graph heuristics instead replace one coefficient residue at a time.Beam search retains a fixed width of candidates, while the Hamming-graph methods include greedy sweeps, hill climbing, and simulated annealing.Source: B Comparison with p-adic Optimization… · p. 14
C Formal Geometric Definitions
- The scalar hull consists of disk points ζa,r, whose arcs rise to a shared maximum radius before descending; at a vertex, directions comprise one parent and p child rays.The Berkovich line has a unique arc between distinct points.Source: C Formal Geometric Definitions · pp. 15–17
- The tight span is a minimal hyperconvex space containing an isometric copy of the original metric space; Γp is identified as the tight span of Qp.The embedded radius-zero points preserve the p-adic metric.Source: C Formal Geometric Definitions · p. 16
C.1 Coordinate restriction
- Coordinate Momentum and Adam updates are equivariant in distribution under factorwise tree isometries and coordinate permutations, under the stated group, direction, and boundary conditions.The corresponding grouped updates preserve the mapped optimizer state and step after clipping.Source: §C.1 · p. 18
D Evaluation and Extension on Product States
The appendix establishes how analytic maps extend to product states and how directional derivatives propagate backward through a model. It also clarifies that joint parameter states and joint motion can matter beyond coordinatewise evaluation.
D Evaluation and Extension on Product States
- Equivalent representatives yield the same output state and loss derivative along each geometric ray.The analytic extension is uniquely determined by a bounded algebra homomorphism, not by density of rational points.Source: D Evaluation and Extension on Product… · p. 19
- Coordinate images alone need not determine a vector-valued map’s full analytic image, so dependent intermediate outputs cannot always be replaced by independent coordinate disks.The centered Taylor expansion is evaluated in the product Gauss seminorm, under a convergence assumption; zero-radius coordinates are specialized to their centers.Source: D Evaluation and Extension on Product… · pp. 19–20, E Automatic Differentiation on the… · p. 20
E Automatic Differentiation on the p-adic Hull
- The directional chain rule propagates the remaining loss derivative backward, scaling it by the output speed when positive and returning zero at zero speed.The stated sufficient conditions use local Lipschitz continuity of the remaining loss and maps.Source: E Automatic Differentiation on the… · p. 20
- When tied terms attain an output-radius maximum, coordinatewise rates need not add: moving both coordinates up at unit rate gives rate 1, not 2.The joint rate is evaluated for the multi-coordinate velocity.Source: E Automatic Differentiation on the… · pp. 20–21
F Sparse Affine Backpropagation
Sparse affine backpropagation exploits the limited number of exceptional child slopes to reduce their computation. The appendix also specifies optimizer-update conditions and implementation-cost bounds.
F Sparse Affine Backpropagation
- O(m + p) operations produce the child slopes, replacing O(mp) work by accumulating contributions from the m outputs.The slopes take the form B + Cγ, where each output contributes at most one exceptional child.Source: F Sparse Affine Backpropagation · p. 21
- The direct affine loss need not be geodesically convex; one example has a strict maximum at the midpoint of a product-path geodesic.The example uses p = 3, F(θ1, θ2) = θ1 + θ2, and target 1.Source: F Sparse Affine Backpropagation · p. 21
G.1 Optimizer updates
- With changing coordinate groups, the random-permutation rule does not guarantee every coordinate repeated turns.The queue marks coordinates for turns within the groups determined before each update.Source: §G.1 · p. 22
G.2 Numerical implementation and cost
- Sparse affine backpropagation reduces the slope computation to O((b + p)|G|), giving O(bd + p|G|) overall for scalar affine regression.These bounds assume the arithmetic and hash-table conditions stated in the appendix.Source: §G.2 · p. 22
G.3 Experimental protocol
The protocol specifies training budgets, initialization, and validation-based selection across regression, modulo classification, and Quillian classification. It also describes Euclidean comparison settings and a classification-split overlap caveat.
G.3 Experimental protocol
- Training uses batch size 32, with 1,000 updates for regression and modulo and 2,000 for Quillian.The appendix gives separate train, validation, and test stream sizes for the tasks.Source: §G.3 · p. 23
- Modulo and Quillian select p-adic gradient-method multipliers using validation accuracy and pooled validation average precision, respectively.The selected multiplier is the same for the complete Quillian model within each code assignment; ties go to the smaller multiplier.Source: §G.3 · p. 23
- Classification splits overlap, so a test observation can enter shared rate selection through another split’s validation set.Learning rates and beam widths are tuned only on validation data.Source: §G.3 · p. 23
- The Euclidean Quillian MLP uses Adam for 1,000 updates, while Euclidean modulo models use batch size 32 for 6,750 updates.The modulo fits total 216,000 sampled training examples each, with repetitions counted separately.Source: §G.3 · p. 23
- Initialization searches input coordinates and residue depths for compatible positive-example classes while minimizing negative examples in those residue classes.Quillian searches three entity coordinates at depths zero through six; modulo searches to the smallest depth D with q^D ≥ m, separately by class.Source: §G.3 · p. 23
G.4 Regression
In matched modulo tasks, all three p-adic gradient methods achieve perfect test accuracy. Regression examples show both single-digit local traps and sensitivity to initialization, while a beam-search example illustrates exact ties among candidates.
G.4 Regression
- All 48 single-digit changes weakly increase exact training loss at the reported regression point; the smallest increase is 1/2519424.The dataset was redrawn until such a point existed.Source: §G.4 · p. 24
- Replacing specified non-Gauss parameter states with Gauss points yielded depth-five recovery on none of five seeds at κ ∈ {1, 10, 100} within 1,000 GD updates.The tested replacements were either two states or four states in the two-layer model.Source: §G.4 · p. 24
- At beam width five, nine candidates tie after two digits, and the beam keeps five; after the third digit, the candidate matching the target ninth is among them.The tie occurs when the target v1 is divisible by 9; the nine candidates agree with the target modulo 27 in w2, v1, and v2.Source: §G.4 · p. 24
- On the seed missed at width five, full-data beam scoring fails on the same seed as minibatch scoring and costs sixteen times as much.The regression beam searches depths v = 0 through 7 using mean point L1 loss.Source: §G.4 · p. 24
G.5 Modulo classification
- Test accuracy is 1.000 for plain descent, Momentum, and Adam on matched modulo tasks, using either learned parameter states or extracted points.The matched tasks are modulo 4 and modulo 9.Source: §G.5 · p. 24
G.6 Quillian benchmark
The Quillian benchmark evaluates beam-search classifiers on binary-encoded hierarchies, including full-training scoring and a batch-32 variant. Across five splits, both variants achieve zero training error in most fits.
G.6 Quillian benchmark
- The Euclidean MLP reproduction has 703 parameters and uses 15 sigmoid hidden units and 28 sigmoid outputs.The paper reports that Martins gives 690 parameters, apparently counting 15 rather than 28 final-layer biases; the reproduction uses the Appendix G.3 Adam protocol, while batch size and epoch budget are unspecified in Martins. Metrics pool 336 propositions per split across 28 properties and include positive-class F1, average precision, and accuracy.Source: §G.6 · p. 25
- The permutation control reassigns complete three-dimensional code vectors among entities while keeping the code multiset, relation indicators, and proposition labels fixed.The initialization procedure is repeated on the permuted training data.Source: §G.6 · p. 25
- 137 of 140 fits attain zero training error with beam width 10 across five splits and 28 properties.Search uses maximum depth 8 and returns the fewest-error candidate from the last nonempty beam if it reaches the depth limit or exhausts admissible candidates.Source: §G.6 · p. 25
- 133 of 140 fits attain zero training error with the batch-32 beam variant across the same widths, depth limit, and splits.At each depth, candidates share a fresh sample of up to 32 training propositions; candidates with no batch error are checked on remaining training negatives.Source: §G.6 · p. 25
H Logit Separation and Margins
Theorem H.1 gives a logit-margin guarantee for finite training sets that are p-adically separable at fixed centers and have independent additive output biases. For any prescribed common output radius in (0, 1], it constructs a positive-radius parameter state with unchanged centers and a margin of at least 1.
H Logit Separation and Margins
- The guarantee assumes a finite training set p-adically separable at fixed centers, analytic class maps near those centers, and independent additive class biases.The class output is represented as a Berkovich point with a center and radius.Source: H Logit Separation and Margins · p. 25
- For every ρ ∈ (0, 1], a positive-radius parameter state preserves the chosen centers, gives every training output radius ρ, and retains a correct-class logit margin of at least 1.The guarantee applies on every training example.Source: H Logit Separation and Margins · pp. 25–26
- The proof chooses sufficiently small positive parameter radii for convergent expansions, then assigns each independent bias radius ρ to set the output radius.The bias term cannot cancel with the class-map terms, so the Gauss formula gives the prescribed output radius while centers remain unchanged.Source: H Logit Separation and Margins · pp. 25–26