Skip to main content

Lattice · low-discrepancy (quasi-random) sequences

Fill space more evenly than random. Lattice is a deterministic quasi-random oracle: it serves Halton / van der Corput low-discrepancy points that blanket the unit cube far more uniformly than white noise — the substrate for faster quasi-Monte-Carlo integration, sampling, and space-filling search.

tests coverage protocol license

Landing: oracles.modelmarket.dev · Ecosystem: ecosystem.modelmarket.dev · Oracle family: oracles Part of the alexar76 AI agent economy — discoverable via AIMarket Protocol v2 (signed manifest), built on the shared oracle-core, and a sibling of Chronos (verifiable delay) and Platon (chaotic randomness beacon).

White noise clumps. Lattice doesn't. Random sampling leaves gaps and clusters by chance (star discrepancy ~ O(1/√N)). A low-discrepancy sequence is engineered so every prefix is already spread out (O((log N)^d / N)). Same number of samples, lower error.


How it works

flowchart LR
  AGENT["Autonomous agents<br/>QMC · sampling · search"] --> HUB["AIMarket Hub<br/>modelmarket.dev"]
  MESH["AI service mesh"] --> HUB
  HUB -->|"routes signed, paid calls"| LAT["Lattice Oracle<br/>lattice.sequence@v1"]
  LAT --> VDC["van der Corput<br/>radical inverse φ_b(n)"]
  VDC --> PTS["Halton points in [0,1)^d<br/>coprime prime bases 2,3,5,7…"]
  PTS -->|"signed receipt + provenance"| HUB

  subgraph FAMILY["Oracle family on oracle-core"]
    LAT
    CHR["Chronos · VDF"]
    PLA["Platon · chaos beacon"]
  end

The oracle maps each sample index n to a point by taking the radical inverse of n in successive coprime prime bases. Coordinate k uses the k-th prime base, so the per-axis 1D sequences are jointly equidistributed and the point set fills [0,1)^d without lattice-alignment artefacts.

n  = Σ aᵢ · bⁱ            (base-b digits of n)
φ_b(n) = Σ aᵢ · b^-(i+1)   ∈ [0,1)     ← reflect digits around the radix point
point(n) = ( φ₂(n), φ₃(n), φ₅(n), … )  ∈ [0,1)^d

AIMarket capabilities

ID What agents buy Price
lattice.sequence@v1 count Halton points in [0,1)^dim (1–4096 points, dim 1–8) — quasi-random, deterministic, lower-discrepancy than RNG. Returns points, dim, count, bases. $0.002

Every invoke returns a signed 7-field protocol receipt and a sha256 input_hash. Manifest p50_latency_ms / success_rate_30d are measured from real calls (rolling window), not hardcoded.


Use-cases in the agent economy

  • Quasi-Monte-Carlo integration — a pricing/risk agent estimating an integral or expectation gets the same accuracy as plain Monte-Carlo with far fewer samples (lower variance, deterministic and reproducible for audit).
  • Hyperparameter & design-of-experiments search — an AutoML agent sweeps a 6-D config space; Halton points cover every region instead of clustering, so no corner of the search space is missed early.
  • Procedural / texture / scatter placement — a generative agent places N objects, dither samples, or sensor probes that look evenly spread with no visible clumps, fully reproducible from (count, dim, skip).
  • Stratified A/B and survey sampling — pick representative points across a normalized feature cube without the gaps that uniform random leaves at small N.

Invoke it

# Discover
curl -s http://localhost:9301/.well-known/ai-market.json | jq .
curl -s http://localhost:9301/ai-market/v2/manifest | jq '.tools[].capability_id'

# Buy 256 quasi-random points in 2D
curl -X POST http://localhost:9301/ai-market/v2/invoke \
  -H "Content-Type: application/json" \
  -d '{"capability_id":"lattice.sequence@v1","input":{"count":256,"dim":2,"skip":0}}'

Response (truncated):

{
  "ok": true,
  "capability_id": "lattice.sequence@v1",
  "output": {
    "sequence": "halton/van-der-corput",
    "points": [[0.5, 0.3333], [0.25, 0.6667], "…"],
    "dim": 2, "count": 256, "skip": 0, "bases": [2, 3]
  },
  "price_usd": 0.002,
  "provenance": {"source": "prod-lattice", "input_hash": "…"},
  "receipt": {"…signed 7-field receipt…"}
}

Run

# from the monorepo root, with oracle-core installed in the venv
PYTHONPATH=oracles/lattice .venv/bin/python -m lattice.main   # serves on :9301

Tests

cd /path/to/oracles
PYTHONPATH=oracles/lattice .venv/bin/python -m pytest oracles/lattice/tests -q

The suite proves the math (radical-inverse values, determinism, points in [0,1), skip semantics) and the product claim (1D max-gap far smaller than random; 2D cell occupancy beats random; QMC integration error below MC) plus the app (signed manifest, invoke round-trip).


Visual

A live cosmic visualization ships in frontend/index.html — open the file directly (no build, no CDN). Quasi-random points drop in one-by-one and tile a square ultra-evenly, beside a faint clumpy white-noise cloud for contrast. You can see the lower discrepancy.

Docs

Detailed write-ups (math, diagrams, use-cases) in English · Русский · Español.


License

MIT — alexar76 ecosystem

Metadata

Release files for aimarket-oracle-lattice 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aimarket-oracle-lattice 0.1.0
File Size Uploaded Provenance
aimarket_oracle_lattice-0.1.0.tar.gz 9.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aimarket-oracle-lattice 0.1.0
File Interpreter ABI Platform
aimarket_oracle_lattice-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.2 kB

Release files / aimarket_oracle_lattice-0.1.0.tar.gz

Download URL aimarket_oracle_lattice-0.1.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
050bd06b5b175989975a33e5085e7f67145786e4b54990c2c97018a9405ec0f1
BLAKE2b-256 checksum
How to use checksums
37b93c946d6d00c6b2e65e389022c0ad02c3867424656f05c6dd4bc4da158f65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / aimarket_oracle_lattice-0.1.0-py3-none-any.whl

Download URL aimarket_oracle_lattice-0.1.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2155d23941f48fdee4162ac3a07d859e03e2114679ad80e674caa980141152b
BLAKE2b-256 checksum
How to use checksums
c5ac7a836bccef37121f2df95df2ec17e3f88ac38c20cab118307564afa9d73f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for aimarket-oracle-lattice 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page