Skip to content

feat(evals): add near-field template experiment#62

Open
xywei wants to merge 13 commits into
mainfrom
boxcode-nearfield-experiments
Open

feat(evals): add near-field template experiment#62
xywei wants to merge 13 commits into
mainfrom
boxcode-nearfield-experiments

Conversation

@xywei

@xywei xywei commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #61.

Adds the first CUTKIT-side near-field template experiment for folded-decomposition box-code handoff work.

What Changed

  • Adds docs/nearfield-template-experiments.md with the point-target and bilinear target-piece derivation.
  • Frames the feasibility result around reusable template singular models plus functional expansions in the smooth metric field M(z) = DT(z)^T DT(z).
  • Adds cutkit.evals.nearfield_templates with an analytic straight fan map, point-target Laplace potential, bilinear self-interaction reference, scale-law check, and diagonal metric-remainder samples.
  • Adds scripts/run_nearfield_template_experiment.py for the baseline experiment.
  • Adds tests for fan-map invariants, point-target convergence, log-kernel scaling, and diagonal singular-split behavior.
  • Archives the execution plan with outcomes and remaining risks.

Validation

  • uv run --extra dev python -m pytest tests/evals/test_nearfield_templates.py tests/test_script_wrappers.py
  • uv run --extra dev python scripts/run_nearfield_template_experiment.py --order 6
  • make dev

Add an analytic folded fan near-field experiment for issue 61. The prototype derives and documents the mapped point-target and bilinear self-interaction forms, frames the reusable correction hypothesis as a functional expansion in the smooth metric field M(z), and adds a script wrapper for running the baseline check. Tests cover fan-map invariants, log-kernel scale behavior, point-target convergence, and the diagonal metric singular split.\n\nValidation: uv run --extra dev python -m pytest tests/evals/test_nearfield_templates.py tests/test_script_wrappers.py; uv run --extra dev python scripts/run_nearfield_template_experiment.py --order 6; make dev

Entire-Checkpoint: 3d4ca5797c60

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e1e907dff4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cutkit/evals/nearfield_templates.py Outdated
Document how smooth metric fields in folded chart singular integrals can be expanded around a reference metric to recover fixed template tables times per-chart runtime coefficients. The derivation ties the precomputed-table technique to the fan-map metric M(r,t), Jacobian factors, and smooth-remainder payloads.\n\nValidation: uv run python scripts/check_docs_freshness.py

Entire-Checkpoint: 7ffd824cac89

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e987ed6079

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cutkit/evals/nearfield_templates.py
Comment thread src/cutkit/evals/nearfield_templates.py Outdated
Convert the near-field template derivation from text code fences to display math so GitHub renders the formulas properly. The content is unchanged aside from LaTeX notation cleanup.\n\nValidation: uv run python scripts/check_docs_freshness.py

Entire-Checkpoint: c15094b32a03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2653068aff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/nearfield-template-experiments.md Outdated
xywei added 2 commits June 12, 2026 18:55
Address Codex review feedback on the near-field template prototype. Reject direct self-interaction quadrature choices with overlapping source/target nodes, report a clear error when point-target quadrature hits a coincident source node, and generalize the log-kernel scale law to density-weighted source and target masses. Also weaken the local metric split documentation so it describes a leading singular model plus bounded/higher-order corrections rather than an unqualified smooth remainder.\n\nValidation: make dev

Entire-Checkpoint: 95096c66f419
Update the near-field template derivation to start from a CAD-realistic Bezier trim fan chart instead of a straight-edge specialization. Straight fan pieces are now described as smoke-test fixtures, while the metric-field expansion is framed in terms of Bezier control points and seed locations.\n\nValidation: uv run python scripts/check_docs_freshness.py

Entire-Checkpoint: c9e0b70886a7

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38560bbfc3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

order=order,
source_order=source_order,
)
near_point_target = (0.47, 0.42)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use an off-surface point-target reference

For the current fan, (0.47, 0.42) is inside the source triangle (approximately (r,t)=(0.773,0.603)), so the baseline computes its point_target_reference with ordinary Gauss quadrature over an on-surface logarithmic singularity. Since point_target_laplace_potential only rejects exact quadrature-node coincidences, this reported low-order-vs-reference error can be dominated by singular quadrature artifacts rather than a reliable near-disjoint reference; fresh evidence beyond the earlier coincident-node comment is that the committed baseline target itself lies on the source piece.

Useful? React with 👍 / 👎.

Remove the folded-target and bilinear self-interaction framing from the near-field template experiment. The docs now describe source folded pieces evaluated at physical target nodes in containing and neighboring boxes, and the experiment API now reports point-target scale-law quantities only.\n\nValidation: make dev; uv run --extra dev python -m pytest tests/evals/test_nearfield_templates.py tests/test_script_wrappers.py; uv run python scripts/check_docs_freshness.py

Entire-Checkpoint: 6cb8d3064a3b

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db19ee4e0d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

point_reference = point_target_laplace_potential(
fan,
near_point_target,
order=max(order + 8, 16),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject nonpositive experiment orders

When order <= 0 is passed through the public experiment helper or CLI (for example --order 0), this max(order + 8, 16) silently promotes the reference rule to 16 while the low-order path is promoted to 2, so the run succeeds and reports an invalid result.order instead of rejecting the input. This can let automated sweeps record misleading rows, unlike the underlying quadrature helpers that require positive orders; validate order at the experiment entry point before deriving these rule sizes.

Useful? React with 👍 / 👎.

jacobian = fan.signed_jacobian(r)
for t, wt in zip(nodes, weights, strict=True):
source = fan.point(r, t)
if hypot(target[0] - source[0], target[1] - source[1]) <= _COINCIDENT_TOL:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid absolute coincidence tolerances

When a valid disjoint near-field case is expressed in a small coordinate scale, this absolute 1e-14 cutoff rejects finite integrals as coincident; for example a fan with vertices on the order of 1e-15 and an off-surface target at (2e-15, 2e-15) raises this error even though no source node equals the target. Since the experiment includes scale-law checks and box-local near-field geometry, use an exact or scale-relative coincidence test so small boxes are not misclassified.

Useful? React with 👍 / 👎.

xywei added 7 commits June 12, 2026 19:56
Revise the point-target singular split to use a high-order Taylor-jet distance model instead of a leading metric-only model. Also adjust display equations to use aligned environments and scalable matrix delimiters so GitHub Markdown renders the formulas correctly.\n\nValidation: uv run python scripts/check_docs_freshness.py

Entire-Checkpoint: d6bbf8d080ee
Clarify that P_K is the high-order local model of the physical displacement x - T(xi), obtained by substituting the chart Taylor jet into the point-target kernel distance. This makes the critical table object explicit before defining it.\n\nValidation: uv run python scripts/check_docs_freshness.py

Entire-Checkpoint: b61a31d972cf
Rewrite the metric-field expansion tables section around the full high-order displacement polynomial P_K for both on-surface and off-surface point targets. The metric-only model is now explicitly a K=1, d=0 sanity case rather than the intended table construction.\n\nValidation: uv run python scripts/check_docs_freshness.py

Entire-Checkpoint: 26fe5c4309e9
Revise the feasibility assessment to reflect the full point-target displacement-jet analysis. The reusable object is now framed as reference-jet tables plus compact interpolation or low-rank coefficients, with metric-only organization called out as a possible subcase rather than the main hypothesis.\n\nValidation: uv run python scripts/check_docs_freshness.py

Entire-Checkpoint: 9b045011c52a
Document the Gaussian-window kernel split proposed for controlling point-target near-field tables. The singular table is now restricted to targets inside or very close to each fan piece, while the smooth remainder is handled by ordinary folded-decomposition quadrature.\n\nValidation: uv run python scripts/check_docs_freshness.py

Entire-Checkpoint: 3c186d8f69f9
Document the simplification for interior point targets: choose the folded-decomposition anchor at the target and refold the source panel so the logarithmic singularity sits at the Duffy apex. This reduces the table problem to near-boundary/outside targets after Gaussian windowing.\n\nValidation: uv run python scripts/check_docs_freshness.py

Entire-Checkpoint: bd206c686530
Update the Gaussian-window split to reflect the DMK-style approach: evaluate the compact local singular part with analytic or semi-analytic asymptotic expansion, while using ordinary folded quadrature for the smooth remainder. The local table target is now asymptotic moments/coefficient maps rather than a generic near-field table.\n\nValidation: uv run python scripts/check_docs_freshness.py

Entire-Checkpoint: 4d7a58573bba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explore folded-decomposition handoff to box-code near/far fields

1 participant