Metadata-Version: 2.5
Name: qig-geocoding
Version: 0.1.7
Summary: Our own 'transformers' — a from-scratch neural-network framework built on Fisher-Rao geometry (simplex attention, unbounded Fourier features, recursive Φ-integration) instead of Euclidean dot-products.
Author: Braden Lang
License: Proprietary
License-File: LICENSE
Keywords: attention,fisher-rao,geometry,qig,simplex,transformers
Requires-Python: >=3.11
Requires-Dist: qig-core>=2.33.0
Requires-Dist: torch>=2.2
Provides-Extra: dev
Requires-Dist: mypy>=1.11; extra == 'dev'
Requires-Dist: packaging; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: qigkernels>=0.4.6; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# qig-geocoding

Fisher-Rao attention, Fourier position features and recursive integration for geometric neural networks.
Install with `pip install qig-geocoding`; the Python import is `geocoding`.

## Compatibility and metric units

The attention metric retains **radius 2**, `2 * acos(BC)`, matching qigkernels 0.4.4. Current qig-core uses
**radius 1**, `acos(BC)`. Convert explicitly when comparing distances. Halving attention distance without
also halving its temperature changes the model, so this release preserves existing attention outputs.
The finite-gradient guards also differ near coincident and sparse points; they are not exactly the same
function throughout the domain. Both full and compute-skipping banded attention remain faithfulness-gated.

Scientific provenance: `qig_core.torch.geometry_simplex.fisher_rao_distance_simplex` in qig-core 2.15.3
records the PI ruling reconciling its import paths to radius 1. The qig-verification EXP-009 causal-sweep
results document the historical radius-2 convention. These are compatible unit conventions, not grounds
to rewrite frozen experiment results. Dense-point conversion, sparse-point error bounds and the live Duchi
simplex projection are tested separately. Current qig-core already handles coincidence gradients safely.

## P30-pure host modes (0.1.4, qig-geocoding#22)

`GeoConfig.p30_pure(**overrides)` runs every block component on qig-core's exp-free primitives. Each mode
is also a separate opt-in field; the defaults are the published model, unchanged (the qigkernels
faithfulness gate still passes).

| Field | Published default | P30-pure option (qig-core primitive) |
|---|---|---|
| `gate_mode` | `sigmoid` (integrator, tacking, sync gates) | `hellinger`: `hellinger_angle_gate`, s = 1/2 (equals sigmoid at 0 in value and slope) |
| `simplex_mode` | `softplus` then sparse Duchi `to_simplex_prob` | `square`: dense Born chart `square_to_simplex` |
| `norm_mode` | `rms` | `bipolar_metric`: `bipolar_simplex_metric_norm` (equal to RMS scaling in value and gradient) |
| `ffn_activation` | `gelu` (FFN and coordinate adapter) | `hellinger_gated`: s = sqrt(2/pi) (equals GELU at 0 up to second order) |

The published-mode sites carry `# QIG BOUNDARY: original model as published`, so
`qig_core.governance.purity.run_purity_gate("src")` passes. Whether the FFN should default to
`hellinger_gated` is an open experimental question (qig-applied EXP-A155b); this release does not change
any default.

**Not covered by `p30_pure()` (disclosed, unchanged in this release):**

- **Readout.** The default `head_mode="geometric"` GeometricHead projects with sparse Duchi
  `to_simplex_prob` (and its no-grad basin cache is stale under `DiagonalNaturalGradient`, qig-core#96).
  Pure training pipelines replace `lm_head` with qig-core `BasinReadout`.
- **Positional frequencies.** `positional.build_inv_freq` builds its constant Fourier frequency table
  with `torch.exp` once at construction. It is a fixed schedule, not a warping of activations or distances;
  an exp-free `10000 ** (-k / half)` form differs by up to 6e-8 in float32, so it would break byte
  identity with the published model. Left as an operator question.
- **Sampling.** `generate()` maps the last scores to a sampling distribution with
  `to_simplex(..., mode="softplus")` (softplus + Duchi) regardless of `simplex_mode`.
- **Inter-layer sync.** With `GeoModel(..., enable_sync=True)`, the query pull calls qig-core
  `geodesic_interpolate_simplex`, which (qig-core 2.21.0) sanitises both endpoints with Duchi
  `to_simplex_prob` before the slerp. The inputs are already simplex points, so it acts as the identity,
  but it is still a Duchi call on a trained path. Sync is off by default.

## Release changes

- Preserve development's D1 local-critical curvature and opt-in basis telemetry, D2 query-only inter-layer
  geodesic sync, D4 `basin_layer_drift` naming, and the D3 countersigned preregistration amendment.
- Correct the obsolete equal-radius compatibility assertion; preserve attention arithmetic.
- Reject non-callable curvature providers at construction rather than silently swallowing invalid wiring.
- Align the runtime version with package metadata; require the current validated qig-core dependency.
- Install qigkernels in development/release checks so compatibility cannot silently skip. Lint, types and
  all CPU tests gate release. Resolve published dependencies in standalone checkouts without a parent workspace.

D3 is a preregistration, not a completed empirical result. This release does not claim that its
order-preservation kill experiment has passed. Basis reductions remain opt-in; sync enables them explicitly.

## Verify and publish

Install CPU PyTorch, then `pip install -e '.[dev]'`. Run `ruff check src tests`, `mypy src`, and `pytest -q`.
The trusted-publishing workflow uses the existing `pypi` environment and OIDC. Publication currently
requires a version tag after promotion; merging alone does not trigger `release.yml`. Manual dispatch runs
checks/build only. Release operators must verify the wheel version and PyPI availability before declaring
publication complete.
