The learning principle
Sparse Crossing
Sparse Crossing is the algorithm that Algebraic Machine Learning (AML) uses in practice. The freest model of a task is usually too large to compute. Since what is wanted is a generalizing subset of its atoms, Sparse Crossing computes such a subset directly from the axioms, without building the whole model first.
The idea
Sparse Crossing rests on two facts. Every subset of the atoms of the freest model satisfies all the positive axioms. And a negative axiom is satisfied as soon as the model contains a single atom that separates its two sides. There are therefore always subsets of atoms that satisfy every axiom of the task and are no larger than the number of negative axioms.
Sparse Crossing enforces the positive axioms one at a time, as Full Crossing does, but at each step it keeps only some of the new atoms and discards the rest. Keeping just the atoms that satisfy the negative axioms at that step would not work, because those atoms may fail to do so after later steps. The atoms are chosen instead so that a certain quantity, called the trace, stays unchanged. Preserving the trace guarantees that every negative axiom is still satisfied once all the positive axioms have been enforced.
The five steps of a batch
The axioms are processed in batches. Each batch goes through five steps.
- Trim. Remove from the model accumulated so far the atoms that conflict with the positive axioms of the batch.
- Build the dual. Construct an auxiliary structure from the axioms of the batch and the atoms learned so far. The trace is measured against it.
- Prepare the starting model. Compute traces, check that they meet the conditions the batch requires, and add simple atoms until they do.
- Cross. Enforce each positive axiom of the batch, keeping only enough of the new atoms to preserve the trace. If the model grows beyond a set threshold, simplify it.
- Merge. Add the model obtained for the batch to the accumulated model.
In symbols, with \(N_0 = M_0\), each batch does the following: (1) trim \(N_{i-1}\) of the atoms inconsistent with \(R_i^+\); (2) build the dual \(D_i\); (3) compute the trace of every atom of \(M_{i-1}\), evaluate the trace constraints, and add atoms until all are satisfied, repeating as necessary; (4) calculate the sparse-crossing of every duple in \(R_i^+\) to obtain \(M_i\), discarding atoms with the traces of all constants kept invariant whenever the model exceeds a threshold; (5) obtain \(N_i\) as the union of \(M_i\) with the trimmed \(N_{i-1}\).1
Master models and union models
Batch \(i\) has axioms \(R_i = R_i^+ \cup R_i^-\). Processing it starts from a model \(M_{i-1}\) and ends with a model \(M_i\) that satisfies \(R_i\). The \(M_i\) are called master models; \(M_0\) is usually the freest semilattice \(F_C(\emptyset)\). A second sequence, the union models, accumulates the masters:
\[N_i = \{\phi \in N_{i-1} : \phi \models R_i^+\} \cup M_i .\]After a number of batches the union models satisfy the entire set of axioms, and training reaches a point after which no atoms are removed and the union models only grow.2
Sparse-crossing a duple
Full-crossing a duple \(r\) replaces each atom \(\phi\) of the discriminant by the atoms \(\phi \triangledown \psi_k\) for every \(\psi_k \in L^a_M(r_R)\). Sparse Crossing uses a subset \(S_\phi \subseteq L^a_M(r_R)\),
\[\phi \rightarrow \{\phi \triangledown \psi_k : \psi_k \in S_\phi\}, \qquad \text{where } Tr(\phi) = \bigcap_{\psi_k \in S_\phi} Tr(\phi \triangledown \psi_k).\]The resulting model is atomized by a subset of the atoms of \(\square_r M\).3
For the worked example of Full Crossing, the following subset of the atoms of the full-crossing table suffices to preserve the trace of all the terms mentioned in the axioms:
| \(D \,\backslash\, R\) | \(\phi[c_1, c_2, c_3]\) | \(\phi[c_3]\) | \(\phi[c_3, c_4]\) |
|---|---|---|---|
| \(\phi[c_2, c_5]\) | \(\phi[c_2, c_3, c_5]\) | ||
| \(\phi[c_1, c_6]\) | \(\phi[c_1, c_3, c_6]\) | \(\phi[c_1, c_3, c_4, c_6]\) |
The dual
The trace takes its values in an atomized semilattice \(D_i\), the dual, built for each batch. Let
\[E_i = C \cup \mathrm{Terms}(R_i^+ \cup R_i^-) \cup \{T_\phi : \phi \in N_{i-1} \wedge \phi \models R_i^+\},\]where \(\mathrm{Terms}(R_i)\) are the terms mentioned in the axioms of the batch and \(T_\phi\) is the pinning term of \(\phi\). The dual has one constant for each element of \(E_i\); the constant for \(x\) is written \([x]\) and called the dual of \(x\). The dual satisfies the axioms of the batch reversed: \((r_L, r_R) \in R_i\) gives \(([r_R], [r_L]) \in R_i^*\). The dual satisfies its negative axioms if and only if \(R_i\) is a consistent set of axioms, which provides a consistency check at no additional computational cost. The dual \(D_i\) corresponds to only a small subset of the dual of \(F_C(R_i^+)\).5
The trace
Given a dual \(D\), the trace maps the elements of a model to sets of atoms of \(D\). For an atom over \(C\),
\[Tr(\phi) = \bigcup_{c \in U^c(\phi)} L^a([c]),\]and for a regular element \(x\) of a model \(M\),
\[Tr_M(x) = \bigcap_{\phi \in L^a_M(x)} Tr(\phi).\]The trace of an atom is the same in every model; the trace of a regular element depends on the model. The trace satisfies the following two identities.6
\[Tr(\phi \triangledown \psi) = Tr(\phi) \cup Tr(\psi), \qquad Tr(a \odot b) = Tr(a) \cap Tr(b)\]Trace constraints
Before the positive duples of a batch are crossed, the starting model must satisfy
\[r \in R_i^+ \rightarrow Tr(r_R) \subseteq Tr(r_L), \qquad r \in R_i^- \rightarrow Tr(r_R) \not\subseteq Tr(r_L),\]the positive and negative trace constraints. A model that satisfies \(Tr(b) \not\subseteq Tr(a)\) satisfies \(a \not\leq b\), so a negative duple whose constraint holds remains negative under any trace-preserving operation. The positive constraints are what make the crossing itself trace-invariant. Both sets of constraints can be met by adding to \(M_{i-1}\) a set of atoms \(\Lambda_i\), each with a single constant in its upper constant segment.7
Simplification
Removing atoms while leaving the trace of every constant unaltered is also trace-invariant, since the trace of a term is the intersection of the traces of its component constants. With trace-invariant simplification and sparse-crossing, the size of the master model depends only on the size of the dual, whose atomization needs no more than \(\vert R^- \vert\) atoms.8
Pinning terms
The pinning term of an atom \(\phi\) over the constants \(C\) is the term with component constants \(C - U^c(\phi)\).9 Including in \(E_i\) the pinning terms of the atoms of the union model lets atoms learned in all previous batches influence which atoms are discarded. The effect is similar to augmenting the set of negative axioms, and it favours atoms that are common components of previously learned atoms, which makes non-redundant atoms more likely to be found. Without pinning terms a valid trace is still obtained, but learning may be significantly slower.10
What a batch yields
The result of a batch is a subset of the atoms of the freest model. It satisfies the positive and negative duples of the batch; it is small, with fewer atoms than there are negative duples; and all its atoms are very successful for the positive task duples.11
Hyperparameters
Sparse Crossing has four hyperparameters. They were set manually, from experience with synthetic datasets and MNIST, and were not optimized for each dataset.12
| Hyperparameter | Role | Values reported |
|---|---|---|
| Simplification threshold \(\gamma\) | If the master model grows from a size \(N\) to more than \(\gamma N\) while positive axioms are crossed, simplification is triggered | \(\gamma = 1.5\) for the image datasets; \(\gamma = 1.1\) for Sudoku and Hamiltonian cycles |
| Batch size | Affects computation time and test accuracy | For images, 500 at the start, increasing linearly to 2/3 of the training set at batch 500; for Sudoku and Hamiltonian cycles, all duples in every batch |
| Union model fractioning parameter \(\kappa\) | The minimal proportion of atoms of the dual associated with negative duples, as opposed to pinning terms | \(\kappa = 0.1\) for image datasets; larger values, such as \(\kappa = 0.5\), for Hamiltonian cycles |
| Model reduction parameter \(\delta\) | The fraction of the union model kept by subset selection | \(\delta = 0.1\) for image datasets; no reduction for Sudoku and Hamiltonian cycles |
The parameter \(\kappa\) has a significant impact on model performance, particularly for smaller training sets, and the simplification threshold may or may not affect the quality of the models. For the image datasets, training stops when the union model has zero error on the training set.
Subset selection
A generalizing model is extracted from the union model as follows. The atoms are sorted at random. Starting from an empty subset \(S\), an atom \(\phi\) is added to \(S\) only if some negative duple of the training set is discriminated by \(\phi\) and by no other atom of \(S\). The subset obtained discriminates the entire training set and has fewer atoms than there are negative duples. Subsets selected in this way are added together until the model reaches 1/10 of the size of the model obtained from Sparse Crossing. Atoms whose upper constant segment contains no label constant are removed.12
Stochasticity and parallelism
Sparse Crossing is a stochastic algorithm, so several different models of the same axioms can be computed. Since the union of models, as a set union of atoms, is also a model of the axioms, larger models can be calculated by parallel computation.11 See Model additivity.
References
- Martin-Maroto, Abderrahaman, Méndez and de Polavieja (2025), Algebraic Machine Learning: Learning as computing an algebraic decomposition of a task, arXiv:2502.19944.
See also
- The freest model and Full Crossing
- Why subsets of the freest model generalize
- Model additivity
- Open-AML-Engine
The Vertical Bar tutorial trains a model with Sparse Crossing on a small problem and compares the atoms it finds with the exact solution.
Footnotes
-
Martin-Maroto et al. (2025), Supplementary section “Putting all together”. ↩
-
Martin-Maroto et al. (2025), Supplementary section “Building free models iteratively”. ↩
-
Martin-Maroto et al. (2025), Supplementary section “Keeping model size under control”. ↩
-
Martin-Maroto et al. (2025), section “Practical computation of generalizing subsets with Sparse Crossing”, Table 2. ↩
-
Martin-Maroto et al. (2025), Supplementary section “Building the dual”. ↩
-
Martin-Maroto et al. (2025), Supplementary sections “Building the trace” and “Trace-invariant simplification of the master”. ↩
-
Martin-Maroto et al. (2025), Supplementary section “Trace constraints and \(\Lambda_i\)”. ↩
-
Martin-Maroto et al. (2025), Supplementary section “Trace-invariant simplification of the master”. ↩
-
Martin-Maroto et al. (2025), Supplementary section “Atomized Semilattices”, Definition 17. ↩
-
Martin-Maroto et al. (2025), section “Practical computation of generalizing subsets with Sparse Crossing”; Supplementary section “Crossing smarter every batch”. ↩
-
Martin-Maroto et al. (2025), section “Practical computation of generalizing subsets with Sparse Crossing”. ↩ ↩2