{
 "artifacts": null,
 "category": "architecture",
 "description": "Replace a dense or ad hoc sparse attention pattern with a circulant mask generated by the paper's carry word c(m,k). Every query attends to exactly m of k relative positions, and the selected positions are prefix-balanced, avoiding the large gaps and collisions produced by random sparsification. Use several Farey-related slopes across heads or layers to combine local, medium-range, and long-range coverage.",
 "formulas_latex": [
  "$$s_j=jm\\bmod k,\\qquad j=0,1,\\ldots,k-1$$",
  "$$c_j(m,k)=\\left\\lfloor\\frac{(j+1)m}{k}\\right\\rfloor-\\left\\lfloor\\frac{jm}{k}\\right\\rfloor\\in\\{0,1\\},\\qquad \\sum_{j=0}^{k-1}c_j=m$$",
  "$$\\sum_{j=0}^{r-1}c_j=\\left\\lfloor\\frac{rm}{k}\\right\\rfloor,\\qquad 0\\leq\\frac{rm}{k}-\\sum_{j=0}^{r-1}c_j\u003c1$$",
  "$$M_{i,j}=\\mathbf{1}\\!\\left[c_{(j-i)\\bmod k}(m,k)=1\\right],\\qquad \\operatorname{Attn}(Q,K,V)_i=\\operatorname{softmax}_{j:M_{i,j}=1}\\!\\left(\\frac{q_i k_j^{\\top}}{\\sqrt{d}}\\right)V_j$$"
 ],
 "id": 2996,
 "implementation": "Integrate the construction at the attention-logit stage of a decoder or encoder Transformer. Choose a period k dividing the target context length and choose a reduced density m/k, such as m = 64 and k = 512 or m = 128 and k = 1024. Compute the Boolean vector with `c[j] = floor((j+1)*m/k) - floor(j*m/k)` using integer arithmetic or high-precision arithmetic, then precompute the allowed relative offsets `O = {j: c[j] == 1}`. For query position i, form the key indices from these offsets, retain only indices satisfying the causal condition j \u003c= i for a decoder, and compute logits, softmax, and the value sum only on those keys. Pseudocode is: `for j in 0..k-1: c[j] = floor((j+1)*m/k) - floor(j*m/k)`; `O = where(c == 1)`; `for each query i: J = [i + offset for offset in O if 0 \u003c= i + offset \u003c L and, if causal, i + offset \u003c= i]`; `logits = Q[i] @ K[J].T / sqrt(d)`; `A = softmax(logits)`; `Y[i] = A @ V[J]`. For a production implementation, avoid materializing an L by L mask and write or adapt a block-sparse kernel that gathers the m allowed offsets for each query block. For bidirectional attention, use signed offsets or combine two masks generated by slopes m/k and (k-m)/k. The mathematical quantities computed exactly are the carry word, its m selected offsets, and its prefix-balance guarantee. The engineer must estimate empirically whether this balance improves connectivity and optimization; measure graph reachability across layers because a single periodic mask may create undesirable residue classes. Begin with a 12-layer, 256-dimensional Transformer on WikiText-103 or a synthetic long-range copying task at context length 2048. Compare dense attention, a contiguous local window with the same number of edges, random m-edge attention, fixed strided attention, and the Christoffel mask. Keep parameter count and attention-edge count equal. Measure validation perplexity, loss versus training FLOPs, wall-clock throughput, peak memory, and accuracy on long-range copying or retrieval. The method succeeds if it matches or improves perplexity while reducing attention memory and compute, or if it gives faster loss descent at equal sparse-attention FLOPs. Also inspect attention-reachability, offset histograms, and gradient norms to detect disconnected or overly periodic behavior.",
 "math_summary": "For a reduced fraction m/k with 0 \u003c m \u003c k, the paper defines the direction permutation s_j = jm mod k and the carry word c(m,k) = (c_0,...,c_{k-1}), where c_j = floor(((j+1)m)/k) - floor((jm)/k) is either 0 or 1. Therefore the word contains exactly m ones, and every prefix of length r contains floor(rm/k) ones, so its discrepancy from the ideal allocation rm/k is less than one. The paper identifies c(m,k) as a lower Christoffel word and organizes coprime parameters through Farey mediants. Its canonical parent denominator is k_1 = m^{-1} mod k, with m_1 = (m k_1 - 1)/k and (m_2,k_2) = (m - m_1, k - k_1). We use the exact carry-word formula to define relative attention offsets. For a sequence of length L and period k, the mask is M_{i,j} = 1 when c_{(j-i) mod k}(m,k) = 1, subject to causal or bidirectional constraints.",
 "math_tags": [
  "combinatorics",
  "number-theory",
  "geometry"
 ],
 "ml_areas": [
  "attention",
  "transformer",
  "inference-speedup"
 ],
 "paper": {
  "arxiv_id": "2609.01270",
  "arxiv_url": "https://arxiv.org/abs/2609.01270",
  "summary_what_math_gives_to_ml": "The paper gives an explicit arithmetic construction of balanced binary words and a unique Stern-Brocot/Farey recursion for generating them from smaller coprime fractions. The transferable asset is not the tiling geometry itself, but the deterministic distribution property of the carry word: exactly m of k positions are selected, while every prefix tracks the ideal density m/k with rounding error below one. This can parameterize structured sparse attention or conditional-compute masks whose connectivity is evenly distributed rather than clustered, with only a coprime slope and a small recursive description. The cleanest first experiment is a circulant Christoffel-word attention mask at long context, compared against local, random, and strided sparse attention at equal edge count.",
  "title": "Farey Structure in Modulo Krinkle Tilings: Mediant Splicing and Generation of Prototiles from a Single Edge",
  "year": "2026"
 },
 "ratings": {
  "difficulty": 5,
  "novelty": 7,
  "usefulness": 5
 },
 "solves": [
  "memory",
  "speedup",
  "scalability"
 ],
 "title": "Christoffel-Balanced Sparse Attention",
 "url": "https://synthcore.org/idea/2996/christoffel-balanced-sparse-attention",
 "verification": {
  "peer_reviewed": false,
  "status": "unverified",
  "status_label": "Unverified",
  "verdict_source": "deterministic test code (paired-seed permutation statistics)",
  "verification_axes": {
   "benchmark_mechanism": {
    "confirmed": null,
    "tested": false
   },
   "practical_benchmark": {
    "beats_baseline": null,
    "tested": false
   },
   "toy_mechanism_gate": {
    "confirmed": null,
    "tested": false
   }
  }
 }
}
