<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4442573390356643522</id><updated>2026-11-24T10:01:17.712-05:00</updated><category term="Flex"/><category term="ArcGIS"/><category term="Big Data"/><category term="Machine Learning"/><category term="Python"/><category term="GenAI"/><category term="GIS"/><category term="Spark"/><category term="Java"/><category term="AI"/><category term="Talks"/><category term="ArcGIS Pro"/><category term="Mobile"/><category term="Shapefile"/><category term="Clustering"/><category term="Computer Vision"/><category term="Heat Map"/><category term="JavaScript"/><category term="MLX"/><category term="Docker"/><category term="DuckDB"/><category term="Jupyter"/><category term="MCP"/><category term="Generative AI"/><category term="GeoAI"/><category term="MPC"/><category term="Rust"/><category term="WebGPU"/><category term="3D"/><category term="Agents"/><category term="ArcPy"/><category term="AutoGluon"/><category term="AutoML"/><category term="CUDA"/><category term="Claude Code"/><category term="Control Systems"/><category term="DQN"/><category term="Deep Reinforcement Learning"/><category term="GPU"/><category term="Gymnasium"/><category term="Jetson"/><category term="Knowledge"/><category term="LunarLander"/><category term="Model Predictive Control"/><category term="NYC"/><category term="OpenCV"/><category term="PyTorch"/><category term="Quadratic Programming"/><category term="RAG"/><category term="Reinforcement Learning"/><category term="Technology"/><category term="Unsloth"/><category term="WebAssembly"/><category term="langchain"/><category term="ollama"/><title type='text'>Thunderhead Explorer</title><subtitle type='html'>Tips and Tricks using GIS BigData, GeoAI, GenAI, ML and other fun stuff :-)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>222</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-2481863512552281979</id><published>2026-11-24T09:48:21.000-05:00</published><updated>2026-11-24T10:01:17.712-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="GPU"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>e-means Meets DBSCAN: Two Moons Said Yes, Cairo Said No</title><content type='html'>&lt;p&gt;Back in 2016, I wrote &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2016/01/dbscan-on-spark.html&quot;&gt;DBSCAN on Spark&lt;/a&gt;. I like DBSCAN because you do not have to give it the number of clusters. But it uses a lot of time and memory when the input is large. This month, Meta FAIR and École des Ponts released e-means in &lt;a href=&quot;https://github.com/facebookresearch/faiss&quot;&gt;faiss&lt;/a&gt; 1.16.0. It does the work of k-means in a few passes over the data.&lt;/p&gt;

&lt;p&gt;So I asked a simple question: can e-means make the data small, so that DBSCAN can do the rest? In this post, I show how I combined the two and how fast e-means is on a GPU. Then I test the method on real satellite data of Cairo. It did not win there. The source is on GitHub: &lt;a href=&quot;https://github.com/mraad/emeans-dbscan&quot;&gt;mraad/emeans-dbscan&lt;/a&gt;.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/emeans-dbscan/main/img/explorer.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/emeans-dbscan/main/img/explorer.jpg&quot; width=&quot;600&quot; alt=&quot;e-means explorer. Left: settings. Middle: satellite map of Cairo with three cluster colors. Right: scores, cluster table and list of runs.&quot;&gt;&lt;/a&gt;
  &lt;figcaption&gt;The e-means explorer after one run on Cairo with k = 3. All the arithmetic runs in the browser.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;The terms&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;Vector.&lt;/b&gt; One row of numbers. There are n vectors, and each vector has d numbers.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Centroid.&lt;/b&gt; The center point of a cluster. There are k centroids.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Epoch.&lt;/b&gt; One pass over all the training vectors.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Noise.&lt;/b&gt; The vectors that DBSCAN does not put in a cluster. Their label is -1.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;ARI.&lt;/b&gt; The adjusted Rand index. It compares cluster labels with reference labels. 1 is a full match. Random labels give a value near 0.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;The two algorithms&lt;/h2&gt;

&lt;p&gt;&lt;b&gt;e-means&lt;/b&gt; solves the k-means problem. Lloyd, the usual k-means algorithm, moves the centroids one time per epoch, and faiss runs 25 epochs by default. e-means moves the centroids after each batch of vectors. It uses an exponential moving average, and the step becomes smaller during training. It calculates the batch size and the first step from n, k and the number of epochs. The default is 5 epochs. It can also move a centroid that has too few vectors. This is named revival.&lt;/p&gt;

&lt;p&gt;e-means has the limits of k-means. You must set k. Each cluster is a convex cell, so a curved cluster becomes many pieces. There is no noise.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;DBSCAN&lt;/b&gt; has two settings: &lt;code&gt;eps&lt;/code&gt; and &lt;code&gt;min_pts&lt;/code&gt;. A vector is a core vector when at least &lt;code&gt;min_pts&lt;/code&gt; vectors are within the distance &lt;code&gt;eps&lt;/code&gt;. DBSCAN connects the core vectors that are near each other. It finds clusters of any shape, and it finds noise. But it must search around each vector, and that is slow when n is large.&lt;/p&gt;

&lt;h2&gt;The combined method&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;Run e-means with a k that is much larger than the number of real clusters. Each result is a micro-cluster.&lt;/li&gt;
  &lt;li&gt;Count the vectors in each micro-cluster.&lt;/li&gt;
  &lt;li&gt;Run DBSCAN on the centroids. The count is the weight of each centroid.&lt;/li&gt;
  &lt;li&gt;Give each vector the DBSCAN label of its centroid.&lt;/li&gt;
&lt;/ol&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/emeans-dbscan/main/img/pipeline.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/emeans-dbscan/main/img/pipeline.png&quot; width=&quot;600&quot; alt=&quot;Pipeline: input vectors, e-means micro-clusters, vector counts, weighted DBSCAN on the centroids, label for each vector.&quot;&gt;&lt;/a&gt;
  &lt;figcaption&gt;The four steps. DBSCAN sees k centroids. It does not see n vectors.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The idea of a summary before the clustering is not new. BIRCH and DenStream do the same. The new part is a fast e-means for the summary. &lt;a href=&quot;https://optuna.org&quot;&gt;Optuna&lt;/a&gt; searches for k, &lt;code&gt;eps&lt;/code&gt; and &lt;code&gt;min_pts&lt;/code&gt;, and it keeps the settings with the highest ARI on the tuning data. The final score uses different data.&lt;/p&gt;

&lt;h2&gt;Two moons&lt;/h2&gt;

&lt;p&gt;I started with the classic: two curved clusters, 20,000 vectors, d = 2. Optuna did 150 trials for each tuned method.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/emeans-dbscan/main/img/moons.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/emeans-dbscan/main/img/moons.jpg&quot; width=&quot;600&quot; alt=&quot;Three plots of two moons. e-means with k = 2 cuts the moons. The combined method and tuned DBSCAN find both moons.&quot;&gt;&lt;/a&gt;
  &lt;figcaption&gt;Left: e-means with k = 2. Middle: the combined method, with the centroids in black. Right: DBSCAN.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;Method&lt;/th&gt;&lt;th&gt;Settings&lt;/th&gt;&lt;th&gt;ARI&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;e-means&lt;/td&gt;&lt;td&gt;k = 2&lt;/td&gt;&lt;td&gt;0.2544&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Combined method&lt;/td&gt;&lt;td&gt;k = 111, eps = 0.164, min_pts = 74&lt;/td&gt;&lt;td&gt;0.9998&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;DBSCAN&lt;/td&gt;&lt;td&gt;eps = 0.124, min_pts = 56&lt;/td&gt;&lt;td&gt;0.9991&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;The combined method works. DBSCAN works too, in about the same time. At 20,000 vectors, DBSCAN has no speed problem to solve.&lt;/p&gt;

&lt;h2&gt;GPU and CPU&lt;/h2&gt;

&lt;p&gt;Next, speed. The data is synthetic: 1,000,000 vectors, d = 128, k = 4,096. The GPU is an NVIDIA RTX A4000. The CPU is a Xeon E5-1620 v3 from 2014. The error is the mean squared distance from a held-out vector to its nearest centroid.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/emeans-dbscan/main/img/bench_error_time.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/emeans-dbscan/main/img/bench_error_time.png&quot; width=&quot;600&quot; alt=&quot;Held-out error against training time. GPU e-means is the fastest. Both e-means lines have a lower error than both Lloyd points.&quot;&gt;&lt;/a&gt;
  &lt;figcaption&gt;Error against training time. The numbers on the points are epochs. The time scale is logarithmic.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;Method&lt;/th&gt;&lt;th&gt;Epochs&lt;/th&gt;&lt;th&gt;Training time&lt;/th&gt;&lt;th&gt;Error&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;CPU Lloyd&lt;/td&gt;&lt;td&gt;25&lt;/td&gt;&lt;td&gt;104.8 s&lt;/td&gt;&lt;td&gt;39.17&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;GPU Lloyd&lt;/td&gt;&lt;td&gt;25&lt;/td&gt;&lt;td&gt;6.02 s&lt;/td&gt;&lt;td&gt;39.56&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;CPU e-means&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;29.0 s&lt;/td&gt;&lt;td&gt;31.72&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;GPU e-means&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;0.18 s&lt;/td&gt;&lt;td&gt;31.78&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;GPU e-means is 162 times faster than CPU e-means. On the same GPU, it is 33.6 times faster than my Lloyd. My Lloyd is plain PyTorch in FP32, so do not read that number as &quot;faster than every GPU k-means&quot;. The error is 19% lower than Lloyd, but this data has clusters of very different sizes, and that helps e-means.&lt;/p&gt;

&lt;h2&gt;Cairo&lt;/h2&gt;

&lt;p&gt;Synthetic data is easy to like. I wanted real data. My first choice was Beirut, but the two windows were 42% and 73% sea. So I moved to Cairo: the Nile, the city, the crops and the edge of the desert.&lt;/p&gt;

&lt;p&gt;The vectors are the AlphaEarth Foundations embeddings for 2021. Each 10 m pixel has one vector with d = 64. The reference labels are from ESA WorldCover 2021. There are two windows of 4,096 × 4,096 pixels that do not overlap. Optuna uses the tune window. The final score uses the test window, which has 16,777,216 vectors. I call the score land ARI, because it does not count the water pixels.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/emeans-dbscan/main/img/cairo_map.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/emeans-dbscan/main/img/cairo_map.jpg&quot; width=&quot;600&quot; alt=&quot;Four maps of the Cairo test window: WorldCover, the combined method with the Mac settings, the combined method with the Xeon settings, and e-means with k = 3.&quot;&gt;&lt;/a&gt;
  &lt;figcaption&gt;The test window. Each cluster has the color of its most frequent WorldCover class. White is noise.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;Method&lt;/th&gt;&lt;th&gt;Tune land ARI&lt;/th&gt;&lt;th&gt;Test land ARI&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Combined method, k = 199 (tuned on the Mac)&lt;/td&gt;&lt;td&gt;0.812&lt;/td&gt;&lt;td&gt;0.353&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Combined method, k = 823 (tuned on the GPU)&lt;/td&gt;&lt;td&gt;0.785&lt;/td&gt;&lt;td&gt;0.307&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Combined method, k = 7,393 (tuned on the Xeon)&lt;/td&gt;&lt;td&gt;0.808&lt;/td&gt;&lt;td&gt;0.494&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;DBSCAN, 320,000 vectors, best of two settings&lt;/td&gt;&lt;td&gt;0.802&lt;/td&gt;&lt;td&gt;0.493&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;e-means, k = 3&lt;/b&gt;&lt;/td&gt;&lt;td&gt;0.715&lt;/td&gt;&lt;td&gt;&lt;b&gt;0.666&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;And guess what? e-means with k = 3 wins, with one setting and no DBSCAN. The combined method has three settings. It fits the tune window better, and then it loses that score on the test window. The two windows are not alike: built-up land is 8% of the tune window and 37% of the test window.&lt;/p&gt;

&lt;p&gt;Look at the map again. The top right map, with 122 clusters, looks almost like WorldCover. Its land ARI is 0.353. Each small cluster takes the color of its most frequent class, so many small clusters always look good. Do not trust the picture. Check the number.&lt;/p&gt;

&lt;p&gt;I must be clear about one thing. I added the test of k = 2 to 16 after I saw the first results. The tune window selected k = 3 on all three backends (Mac CPU, Xeon CPU and GPU), but the idea to look there came late.&lt;/p&gt;

&lt;h2&gt;Two answers for k = 3&lt;/h2&gt;

&lt;p&gt;With k = 3, e-means does not always find the same answer on the test window. I ran ten seeds on each machine:&lt;/p&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;Answer&lt;/th&gt;&lt;th&gt;Mean cosine&lt;/th&gt;&lt;th&gt;Land ARI&lt;/th&gt;&lt;th&gt;CPU&lt;/th&gt;&lt;th&gt;GPU&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Good&lt;/td&gt;&lt;td&gt;0.8656&lt;/td&gt;&lt;td&gt;0.666&lt;/td&gt;&lt;td&gt;8 of 10&lt;/td&gt;&lt;td&gt;9 of 10&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Bad&lt;/td&gt;&lt;td&gt;0.8453&lt;/td&gt;&lt;td&gt;0.365&lt;/td&gt;&lt;td&gt;2 of 10&lt;/td&gt;&lt;td&gt;1 of 10&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;The mean cosine is the mean similarity of each vector to its nearest centroid. It needs no labels, and it is lower for the bad answer. So run a few seeds and keep the highest mean cosine. At 0.8 s per run on the GPU, ten seeds cost about 8 seconds. The same run takes 32.6 s on the Mac CPU and 71.3 s on the Xeon.&lt;/p&gt;

&lt;h2&gt;Two things that went wrong&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;I tuned DBSCAN on a sample and then used the same &lt;code&gt;min_pts&lt;/code&gt; on all the vectors. &lt;code&gt;min_pts&lt;/code&gt; is a count of vectors, so it must grow with n. I threw the first results away and ran everything again.&lt;/li&gt;
  &lt;li&gt;The Mac and the Xeon selected different DBSCAN settings from the same data and the same seed. The first suspect was the library versions. That was wrong: three sets of versions on the Mac give the same 60 trials. I still do not know the cause.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;The explorer&lt;/h2&gt;

&lt;p&gt;I wanted to see these results, so there is a small web app. It is vanilla JavaScript with the ArcGIS Maps SDK for JavaScript 5.2 web components and Calcite. Both load from the Esri CDN. There is no framework and no build step. A Web Worker runs my JavaScript port of e-means on about 1 million pixels per window. For the same seed and without revival, its labels match the faiss labels exactly.&lt;/p&gt;

&lt;p&gt;You can change k, the epochs and the seed. You can swipe the clusters against WorldCover, and click a pixel to see its nearest centroids.&lt;/p&gt;

&lt;p&gt;To start it, you need &lt;code&gt;uv&lt;/code&gt; and about 3 GB of disk space:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Clone the repository: &lt;code&gt;git clone https://github.com/mraad/emeans-dbscan&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Go to the folder: &lt;code&gt;cd emeans-dbscan&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Download the data: &lt;code&gt;uv run --python 3.12 aef_fetch.py&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Prepare the data: &lt;code&gt;uv run --python 3.12 app/prepare_data.py&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Start the server: &lt;code&gt;python3 -m http.server 8123 --bind 127.0.0.1 -d app&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Open &lt;code&gt;http://localhost:8123&lt;/code&gt; in a browser.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To see the two answers for k = 3:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Set &lt;b&gt;Clusters (k)&lt;/b&gt; to 3.&lt;/li&gt;
  &lt;li&gt;Set &lt;b&gt;Seed&lt;/b&gt; to 1.&lt;/li&gt;
  &lt;li&gt;Click &lt;b&gt;Run e-means&lt;/b&gt;.&lt;/li&gt;
  &lt;li&gt;Wait for the status &quot;Done&quot;.&lt;/li&gt;
  &lt;li&gt;Do steps 2 to 4 again for the seeds 2, 3 and 4.&lt;/li&gt;
  &lt;li&gt;Compare the &lt;b&gt;Cosine&lt;/b&gt; values in the &lt;b&gt;Runs&lt;/b&gt; table.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;What this does not show&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Two moons and the speed test use synthetic data. The speed test uses one seed.&lt;/li&gt;
  &lt;li&gt;Cairo is one area and one year.&lt;/li&gt;
  &lt;li&gt;WorldCover is the output of a model. It is not ground truth.&lt;/li&gt;
  &lt;li&gt;Optuna used the reference labels. Most clustering work has no labels.&lt;/li&gt;
  &lt;li&gt;The combined method had 60 Optuna trials. e-means had 15 values of k with three seeds each.&lt;/li&gt;
  &lt;li&gt;GPU runs do not repeat exactly. For k = 199, the land ARI moves by up to 0.005.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The combined method can find curved clusters. Two moons shows that. On 16.8 million real vectors, e-means with three clusters was better and simpler. Lesson learned: run the simple method first. Next, I want to try HDBSCAN on the centroids, because it does not need &lt;code&gt;eps&lt;/code&gt;. More to come.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/2481863512552281979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/2481863512552281979' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/2481863512552281979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/2481863512552281979'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/11/e-means-meets-dbscan-two-moons-said-yes.html' title='e-means Meets DBSCAN: Two Moons Said Yes, Cairo Said No'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-5910343047344875445</id><published>2026-11-20T05:48:49.051-05:00</published><updated>2026-11-20T05:48:49.051-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS"/><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><title type='text'>map-pane: one live map for Claude Code, Codex and Pi</title><content type='html'>&lt;p&gt;I work most of the day in a terminal with a coding agent. When the work is spatial, I want to see the result on a map. I do not want to leave the terminal, and I do not want to write a web app first.&lt;/p&gt;
&lt;p&gt;map-pane is my answer. It is a live web map that an agent drives from the shell. The map uses the ArcGIS Maps SDK for JavaScript 5.2.2. Headless Chrome draws the map, and a terminal pane shows it. The pane also takes your mouse and keys, so you can pan and zoom by hand while the agent works.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/map-pane/main/docs/img/ghostty-split.jpg&quot; width=&quot;640&quot; alt=&quot;A Ghostty window with two splits: JSON output of map commands on the left, a world map of cities on the right&quot;&gt;&lt;/p&gt;
&lt;p&gt;The code is at &lt;a href=&quot;https://github.com/mraad/map-pane&quot;&gt;github.com/mraad/map-pane&lt;/a&gt;, MIT licensed. It needs macOS, Node.js 24 and Google Chrome. It has no npm dependencies. I want to keep it that way.&lt;/p&gt;
&lt;h2&gt;What it does&lt;/h2&gt;
&lt;p&gt;The agent can do these things on the map:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add data: GeoJSON (file, URL or inline), GeoPackage, GeoParquet, CSV, feature services, map services, tile and vector tile layers, and portal items.&lt;/li&gt;
&lt;li&gt;Style data: renderers, labels and filters. GeoJSON with one geometry type gets a legend entry and popups.&lt;/li&gt;
&lt;li&gt;Move the view: to a geocoded place or address, to coordinates, or to a layer.&lt;/li&gt;
&lt;li&gt;Change the basemap.&lt;/li&gt;
&lt;li&gt;Sign in to a portal and save the map as a web map item.&lt;/li&gt;
&lt;li&gt;Write a PNG screenshot.&lt;/li&gt;
&lt;li&gt;Run JavaScript in the map page, when no command does the job.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The map shows in a Ghostty split or in any browser tab. Both show the same map at the same time.&lt;/p&gt;
&lt;h2&gt;How it works&lt;/h2&gt;
&lt;p&gt;There are three parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The bridge&lt;/strong&gt; (&lt;code&gt;mappane/web/server.mjs&lt;/code&gt;). This is one Node process. It keeps a log of every change to the map.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The map pages&lt;/strong&gt; (&lt;code&gt;index.html&lt;/code&gt; and &lt;code&gt;app.js&lt;/code&gt;). Any number of pages can be open. Each page reads commands from the bridge over Server-Sent Events (SSE) and runs them one at a time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The CLI&lt;/strong&gt; (&lt;code&gt;mappane/bin/map-command&lt;/code&gt;). It turns a command line into an &lt;code&gt;{op, args}&lt;/code&gt; message and sends it to the bridge over a Unix socket.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;skill ──&amp;gt; bin/map-command ──Unix socket──&amp;gt; bridge (server.mjs) ──SSE──&amp;gt; every open map page
                                            keeps a log, replays it       (Ghostty pane, browser)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The log is the important part. When a page opens or reconnects, the bridge sends it the full log. The page then shows the same map as the other pages. The bridge also gives each new layer an id (&lt;code&gt;L1&lt;/code&gt;, &lt;code&gt;L2&lt;/code&gt; and so on). A layer has the same id on every page, so &lt;code&gt;remove L2&lt;/code&gt; removes the same layer everywhere.&lt;/p&gt;
&lt;p&gt;Not every command goes into the log. A command that only reads the map or moves the view is not logged. Examples are &lt;code&gt;go_to&lt;/code&gt;, &lt;code&gt;extent&lt;/code&gt; and &lt;code&gt;screenshot&lt;/code&gt;. A sign-in token is never logged and never written to disk.&lt;/p&gt;
&lt;p&gt;The Ghostty pane is a small Node program. It runs headless Chrome over the DevTools protocol, takes the screencast frames and writes them to the terminal with the Kitty graphics protocol. So the pane shows real pixels, not characters. Mouse and key events go back to Chrome the same way.&lt;/p&gt;
&lt;h2&gt;Drive it from the shell&lt;/h2&gt;
&lt;p&gt;The agent uses the same commands that you type. Open the map in a Ghostty split:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sh&quot;&gt;mappane/bin/map-pane --split
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then send commands from another terminal:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sh&quot;&gt;mappane/bin/map-command go_to location &#39;Paris, France&#39;
mappane/bin/map-command graphics examples/cities.geojson --title Cities --renderer examples/population-renderer.json
mappane/bin/map-command update-layer Cities --filter &#39;population__millions_ &amp;gt; 10&#39;
mappane/bin/map-command screenshot /tmp/cities.png
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Each command prints JSON. A failed command prints the error and exits with status 1. The agent reads that JSON, so it knows the layer id, the geocoder match or the error.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/map-pane/main/docs/img/cities-renderer.png&quot; width=&quot;640&quot; alt=&quot;World cities colored by population, with the legend at the bottom right&quot;&gt;&lt;/p&gt;
&lt;p&gt;Renderers, labels and symbols use the SDK&#39;s autocast JSON. The agent writes the same JSON that it finds in the SDK documentation. There is no second schema to learn.&lt;/p&gt;
&lt;h2&gt;One skill, three agents&lt;/h2&gt;
&lt;p&gt;The CLI is the whole interface. A skill (&lt;code&gt;.agents/skills/map-pane&lt;/code&gt;) teaches the CLI syntax to the agent. Claude Code, Codex and Pi all read the same skill.&lt;/p&gt;
&lt;p&gt;Claude Code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/plugin install map-pane --marketplace mraad/map-pane
/map-pane:map-pane go to Kuwait City and add examples/cities.geojson
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Codex:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sh&quot;&gt;codex plugin marketplace add mraad/map-pane &amp;amp;&amp;amp; codex plugin add map-pane@map-pane
codex exec -s workspace-write -c sandbox_workspace_write.network_access=true &#39;$map-pane go to Austin, Texas&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Pi:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sh&quot;&gt;pi install git:github.com/mraad/map-pane
pi -p &#39;/skill:map-pane go to Austin, Texas&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I gave the same task to the three agents: open the map, go to a city, add the cities layer with a renderer, and take a screenshot. These are their screenshots, from left to right: Claude Code, Codex and Pi.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/map-pane/main/docs/img/proof-claude.png&quot; width=&quot;300&quot; alt=&quot;Result of the task from Claude Code&quot;&gt; &lt;img src=&quot;https://raw.githubusercontent.com/mraad/map-pane/main/docs/img/proof-codex.png&quot; width=&quot;300&quot; alt=&quot;Result of the task from Codex&quot;&gt; &lt;img src=&quot;https://raw.githubusercontent.com/mraad/map-pane/main/docs/img/proof-pi.png&quot; width=&quot;300&quot; alt=&quot;Result of the task from Pi&quot;&gt;&lt;/p&gt;
&lt;p&gt;The first version also had a Claude Code mod with its own tools and a side pane. In version 0.5.0 I removed it. Two interfaces to the same map were twice the work, and the skill does the same job for every agent.&lt;/p&gt;
&lt;h2&gt;When the commands are not enough&lt;/h2&gt;
&lt;p&gt;Fixed commands cover the common work. They do not cover a statistics query, a renderer calculated from the data, or a buffer. For that, the agent can send JavaScript to the map page:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sh&quot;&gt;mappane/bin/map-command js query.js --read-only
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The code is the body of an async function. It gets &lt;code&gt;view&lt;/code&gt;, &lt;code&gt;map&lt;/code&gt;, &lt;code&gt;layerId&lt;/code&gt; and an &lt;code&gt;AbortSignal&lt;/code&gt;. It loads SDK modules with &lt;code&gt;$arcgis.import&lt;/code&gt;. The return value comes back as JSON, with the &lt;code&gt;console&lt;/code&gt; lines. A throw comes back as an error, so the agent can correct the code and try again.&lt;/p&gt;
&lt;p&gt;This example makes 300 km geodesic buffers around the three largest cities:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;const [GraphicsLayer, Graphic, buffer] = await $arcgis.import([
  &amp;quot;@arcgis/core/layers/GraphicsLayer.js&amp;quot;,
  &amp;quot;@arcgis/core/Graphic.js&amp;quot;,
  &amp;quot;@arcgis/core/geometry/operators/geodesicBufferOperator.js&amp;quot;,
])
await buffer.load()
const cities = map.layers.find(l =&amp;gt; l.title === &amp;quot;Cities&amp;quot;)
const { features } = await cities.queryFeatures({
  where: &amp;quot;1=1&amp;quot;, orderByFields: [&amp;quot;population__millions_ DESC&amp;quot;], num: 3, outFields: [&amp;quot;name&amp;quot;], returnGeometry: true,
})
const rings = new GraphicsLayer({ id: layerId, title: &amp;quot;300 km around the 3 largest cities&amp;quot; })
const symbol = { type: &amp;quot;simple-fill&amp;quot;, color: [228, 87, 46, 0.2], outline: { color: &amp;quot;#e4572e&amp;quot;, width: 1 } }
for (const f of features) {
  rings.add(new Graphic({ geometry: buffer.execute(f.geometry, 300, { unit: &amp;quot;kilometers&amp;quot; }), symbol, attributes: f.attributes }))
}
map.add(rings)
return { layerId, rings: rings.graphics.length, cities: features.map(f =&amp;gt; f.attributes.name) }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASAB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14L0X4dfGnxR4F8OeYLDSdSuLa3ErbnEaOQoLYGSB3r9xNG/5C1n/13j/9CFfjR+1t/wAnN+Ov+wzdf+jDXw/AOKrV6Vd15uVmt23+Z914h4Sjh6tBUKajdPZJfkfO9FFFfoB+dBRRRQBaso0mvIoZOVZ1B+hNdhqenW08qocqFOBt44xn+lcnpv8AyEYP+ui/zru7z/X/APAv6Gpe5cdmcFqFulrctDGSQMdevIzXqtsix20aIMAKMD8K8y1n/j/f8P5CvUIf9Sn+6P5USHDckoooqDQKpxDddSMe2AKuVUh/4+Zfw/lQBbooooAK8x8QW8dvqbiPPzfMc+pr06vOPE//ACFD/uiqiRPY56iiirMgooooAKKKKACr9rGht5ZGGWXGD6cE5H5VQrStP+PSb/P8LUDRm9eaKKKBHS+F7WG4vWklG4xAFR2zWVftJDdT2iO3liRuCevPet3wl/x8zf7o/nWDqv8AyE7j/ro386XUroUKKKKZIUUUUAFFFFABRRRQAUUUUAf/2Q==&quot; width=&quot;560&quot; alt=&quot;A dark map of South and East Asia with orange 300 km rings around New Delhi, Shanghai and Tokyo&quot;&gt;&lt;/p&gt;
&lt;p&gt;Two rules make this work with the log:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Code that changes the map is logged, like any other command. Each new page runs it again. So the code must give the same result on a new page, and a new layer must use the &lt;code&gt;layerId&lt;/code&gt; that the bridge gives.&lt;/li&gt;
&lt;li&gt;Code that only reads gets &lt;code&gt;--read-only&lt;/code&gt;. It is not logged and does not run again.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Code that blocks the page (an endless loop) gets no answer. After 65 s the bridge drops it from the log, so a new page does not freeze on it too.&lt;/p&gt;
&lt;p&gt;The e2e suite runs every code block in &lt;code&gt;docs/run-js.md&lt;/code&gt; in order. If I break an example, the tests tell me.&lt;/p&gt;
&lt;h2&gt;Sign in and save a web map&lt;/h2&gt;
&lt;p&gt;The map works without a sign-in. Basemap styles, private portal items and web map saves need one:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sh&quot;&gt;mappane/bin/map-command login --client-id &amp;lt;your-client-id&amp;gt;
mappane/bin/map-command save-webmap &#39;World cities&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;login&lt;/code&gt; runs an OAuth flow with PKCE in the CLI and sends the token to the map pages. The bridge keeps the last token in memory and sends it first to each new page. It never writes it to the log or to disk. The pages renew the token before it expires.&lt;/p&gt;
&lt;p&gt;If you already use arcctl, &lt;code&gt;login --arcctl&lt;/code&gt; takes its session instead. map-pane only reads the arcctl config file. It refuses a file that other users can read, and it sends the token only to the portal that issued it.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;save-webmap&lt;/code&gt; saves a private web map item. A layer that the bridge serves from a local file cannot go into a web map, because that URL stops working when the bridge stops. The command refuses such a layer before it creates the item.&lt;/p&gt;
&lt;h2&gt;Security on a local machine&lt;/h2&gt;
&lt;p&gt;The bridge listens only on &lt;code&gt;127.0.0.1&lt;/code&gt;. That is not enough by itself, because a web page in your browser can also send requests to &lt;code&gt;127.0.0.1&lt;/code&gt;. So the bridge also does these things on TCP:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It accepts only the &lt;code&gt;Host: 127.0.0.1:&amp;lt;port&amp;gt;&lt;/code&gt; header. This stops DNS rebinding.&lt;/li&gt;
&lt;li&gt;It refuses a foreign &lt;code&gt;Origin&lt;/code&gt; and a cross-site &lt;code&gt;Sec-Fetch-Site&lt;/code&gt;. This stops a cross-site POST.&lt;/li&gt;
&lt;li&gt;When &lt;code&gt;MAP_PANE_TOKEN&lt;/code&gt; is set, the control endpoints need the &lt;code&gt;x-map-pane-token&lt;/code&gt; header.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Unix socket skips these checks. The socket has mode 0600 in an owner-only folder, and the CLI refuses a folder that another user owns.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;run_js&lt;/code&gt; is not a sandbox. The code runs as the page. After a sign-in, it can read the token and send it to any server. Feature attributes and item titles can carry instructions to the agent. So the risk case is a signed-in map with data that you do not trust. The docs say this, and I say it here: do not sign in when you load data that you do not trust.&lt;/p&gt;
&lt;p&gt;I also assume a single-user machine. A browser cannot send a token on an SSE connection, so &lt;code&gt;/events&lt;/code&gt; is open on TCP. Another account on the same computer could read the map. Do not run it on a shared computer.&lt;/p&gt;
&lt;h2&gt;Things that surprised me&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;The SDK pads the extent of one point.&lt;/strong&gt; In SDK 5.2, &lt;code&gt;queryExtent()&lt;/code&gt; on a client-side layer with one point returns a padded extent in metres, but labels it WGS84. A zoom to that layer went to latitude 0. The fix is in one function, &lt;code&gt;extentOf&lt;/code&gt;. When the query finds one feature, it uses the feature&#39;s geometry instead of the extent.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The CDN reports a different version.&lt;/strong&gt; The SDK loads from the &lt;code&gt;5.2.2&lt;/code&gt; URL, but &lt;code&gt;kernel.fullVersion&lt;/code&gt; says &lt;code&gt;5.2.1&lt;/code&gt;. The tests check the load URL instead.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Most layers have no &lt;code&gt;clone()&lt;/code&gt; in SDK 5.2.&lt;/strong&gt; My first &lt;code&gt;save-webmap&lt;/code&gt; copied the layers into a new WebMap and failed on most of them. Now it saves a WebMap with only the basemap, then writes each layer&#39;s &lt;code&gt;toJSON()&lt;/code&gt; into the item data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Chrome tests are timing-sensitive.&lt;/strong&gt; A test that clicks the zoom button failed under load. Now it waits for &lt;code&gt;view.stationary&lt;/code&gt; before it compares the zoom levels. &lt;code&gt;npm test&lt;/code&gt; runs one file at a time.&lt;/p&gt;
&lt;h2&gt;Try it&lt;/h2&gt;
&lt;p&gt;Clone the repository and open the map:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sh&quot;&gt;git clone https://github.com/mraad/map-pane.git
cd map-pane
mappane/bin/map-pane --split
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;No Ghostty? Use &lt;code&gt;mappane/bin/map-pane --browser&lt;/code&gt;. Then add &lt;code&gt;examples/cities.geojson&lt;/code&gt; with a renderer. After that, ask your agent to do the same.&lt;/p&gt;
&lt;p&gt;The docs have the details: &lt;a href=&quot;https://github.com/mraad/map-pane/blob/main/docs/standalone.md&quot;&gt;standalone.md&lt;/a&gt; for the CLI and the agents, &lt;a href=&quot;https://github.com/mraad/map-pane/blob/main/docs/run-js.md&quot;&gt;run-js.md&lt;/a&gt; for JavaScript in the map, and &lt;a href=&quot;https://github.com/mraad/map-pane/blob/main/docs/architecture.md&quot;&gt;architecture.md&lt;/a&gt; for the protocol and the security rules.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;ArcGIS is a trademark of Esri. This project is not affiliated with Esri.&lt;/em&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/5910343047344875445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/5910343047344875445' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/5910343047344875445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/5910343047344875445'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/11/map-pane-one-live-map-for-claude-code.html' title='map-pane: one live map for Claude Code, Codex and Pi'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-4025583930927842082</id><published>2026-11-13T06:37:44.067-05:00</published><updated>2026-11-13T06:37:44.068-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS"/><category scheme="http://www.blogger.com/atom/ns#" term="CUDA"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><category scheme="http://www.blogger.com/atom/ns#" term="WebGPU"/><title type='text'>Service Areas on the GPU and in the Browser, Checked Against ArcGIS</title><content type='html'>&lt;p&gt;I have used ArcGIS Network Analyst for service areas for a long time. You give it a start point and a few drive times, and it gives you the streets and the area that you can reach. It is correct, and it is the reference that people trust. But it is not fast. For 100 crash locations in Adams County, Ohio, with breaks of 1, 5 and 10 minutes, the solve takes 69 seconds. For all 2,483 crashes, it takes 31 minutes.&lt;/p&gt;

&lt;p&gt;So I asked a simple question: can a GPU calculate the same service areas, and I mean the same, not &quot;close enough&quot;? And if the GPU can do it, can the browser do it too? In this post, I show the three engines that I built, how I compare them with ArcGIS, and where they do not agree. The source is on GitHub: &lt;a href=&quot;https://github.com/mraad/service-area&quot;&gt;mraad/service-area&lt;/a&gt;.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/service-area/main/docs/images/live_hover.gif&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/service-area/main/docs/images/live_hover.gif&quot; width=&quot;600&quot; alt=&quot;Animation: the mouse moves along a street near West Union and the 5-minute service area changes with it.&quot;&gt;&lt;/a&gt;
  &lt;figcaption&gt;The live page. The mouse moves along a street near West Union, Ohio. The browser calculates the 5-minute service area again at each position.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;The problem&lt;/h2&gt;

&lt;p&gt;The study area is Adams County, Ohio. The data is a file geodatabase with 3,063 street lines and 2,483 crash points. The start points are the crashes. The question for each crash is: which streets, and which area, can you reach from it in 1, 5 and 10 minutes?&lt;/p&gt;

&lt;p&gt;The street data has no speed field and no one-way field. Each street gets a speed from its road class (the Census &lt;code&gt;MTFCC&lt;/code&gt; code), and the travel time in minutes comes from that speed. One Python file holds this table, and every engine uses it. If two engines use different costs, a comparison between them means nothing.&lt;/p&gt;

&lt;h2&gt;Three engines, one network&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;ArcGIS engine.&lt;/b&gt; ArcPy and Network Analyst on Windows with ArcGIS Pro 3.7. It writes the reference lines, the polygons and the facility locations. I use the Network Analyst layer API, because the newer &lt;code&gt;arcpy.nax&lt;/code&gt; API fails on this network dataset (no travel modes).&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;CUDA engine.&lt;/b&gt; Python and CuPy on Linux with an NVIDIA RTX PRO 6000 Blackwell. A &lt;code&gt;RawKernel&lt;/code&gt; calculates the shortest paths. Each crash gets one thread block. The arithmetic is float64, and the kernel stops a path when it passes the largest break.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Browser engine.&lt;/b&gt; JavaScript in the ArcGIS Maps SDK for JavaScript. It has a Float64 Dijkstra, a WebGPU version, a WebGL2 layer that draws the area, and GEOS in WebAssembly that makes the real polygon.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All three read the same street table. The ArcGIS prep step makes it: filter by road class, planarize, integrate at the network XY tolerance, and drop duplicate streets. The CUDA engine and the browser read the result as Parquet. If the network is different, the engines are different, and no tolerance fixes that.&lt;/p&gt;

&lt;h2&gt;What &quot;the same&quot; means&lt;/h2&gt;

&lt;p&gt;This was the hard part. A service area has two outputs, and I check each one in a different way.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Lines.&lt;/b&gt; ArcGIS gives the reached part of each street, cut at the break. The CUDA engine gives the same thing as intervals along each street: reached from the start node, reached from the end node, or reached on the crash&#39;s own street. The gate is exact. The cumulative minutes must agree within 1e-6 minutes, and the cut positions must agree within 1e-6 of the street length.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/service-area/main/docs/images/lines.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/service-area/main/docs/images/lines.png&quot; width=&quot;600&quot; alt=&quot;ArcGIS service area lines and CUDA reached intervals for one crash, colored by break.&quot;&gt;&lt;/a&gt;
  &lt;figcaption&gt;One crash. Left: the ArcGIS lines. Right: the CUDA intervals. The colors show the 1, 5 and 10 minute bands.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The result on the 100-crash sample: 0 cost mismatches in 84,676 lines. The largest difference is 1.8e-15 minutes. That is float64 noise. There is 1 interval mismatch in 97,362 interval sets. I will come back to that one.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Polygons.&lt;/b&gt; Here I cannot be exact. Esri generalizes its polygons, and I cannot reproduce that step. So the gate uses one polygon builder for both sides. The builder takes the ArcGIS lines and makes a polygon, and it takes the CUDA lines and makes a polygon. Then I compare the two polygons: IoU 0.99 or more, and Hausdorff distance 50 ft or less. The native ArcGIS polygons are a reference only, and I report how far they are from mine.&lt;/p&gt;

&lt;p&gt;The builder works like this. It buffers each reached street piece by 100 m with flat ends, because ArcGIS also cuts flat at the break. It adds a disk at junctions where all the streets are reached. It fills a city block when all the streets around it are reached. Then it keeps only the ground whose nearest street is reached. That last step came from Franklin County (Columbus). There, many unreached streets run next to freeways, and a buffer along the freeway covered them. ArcGIS does not include that ground. To find the nearest street, the builder cuts each street into 50 ft pieces and makes a Voronoi cell for each piece.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/service-area/main/docs/images/polygons.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/service-area/main/docs/images/polygons.png&quot; width=&quot;600&quot; alt=&quot;CUDA polygons and native ArcGIS polygons for one crash at 1, 5 and 10 minutes.&quot;&gt;&lt;/a&gt;
  &lt;figcaption&gt;One crash. Blue: my polygon. Orange: the native ArcGIS polygon.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;With the shared builder, 299 of 300 polygons pass the gate. Against the native ArcGIS polygons, the median IoU is 0.962 at 1 minute, 0.975 at 5 minutes and 0.986 at 10 minutes. The nearest-street step raised the Franklin pilot from 0.86 / 0.93 / 0.95 to 0.97 for all three breaks.&lt;/p&gt;

&lt;h2&gt;The one mismatch&lt;/h2&gt;

&lt;p&gt;Crash 1800, at 5 minutes. My first guess was a bug in my kernel. Then I suspected dirty geometry, so I ran the OGC geometry check on the source streets. It found 0 problems in Adams and in Franklin. The real cause is on the ArcGIS side. For this crash, ArcGIS does not split one street at the 5-minute break. For another crash, it splits the same street correctly. The Franklin pilot shows the same behavior on 2 lines. My gate labels this case, but it still counts it as a failure. I did not widen a tolerance to make it go away, because that would also hide a real bug.&lt;/p&gt;

&lt;h2&gt;Speed&lt;/h2&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/service-area/main/docs/images/timing.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/service-area/main/docs/images/timing.png&quot; width=&quot;600&quot; alt=&quot;Batch time for 100 crashes: ArcGIS solve against the CUDA stages, log scale.&quot;&gt;&lt;/a&gt;
  &lt;figcaption&gt;100 crashes, 3 breaks. The scale is logarithmic.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Now the best part. For the same 100 crashes and 3 breaks:&lt;/p&gt;

&lt;table&gt;
  &lt;tr&gt;&lt;th&gt;Stage&lt;/th&gt;&lt;th&gt;Time&lt;/th&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;ArcGIS solve&lt;/td&gt;&lt;td&gt;69.3 s&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;CUDA shortest paths&lt;/td&gt;&lt;td&gt;0.08 s&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;CUDA reached intervals&lt;/td&gt;&lt;td&gt;0.11 s&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Polygons (shapely and GEOS, 48 CPU processes)&lt;/td&gt;&lt;td&gt;4.35 s&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;The shortest paths are not the problem anymore. The polygons are. They run on the CPU, and the nearest-street step doubled their time (from 2.41 s to 4.35 s). I accept that cost, because fidelity comes first and speed comes second.&lt;/p&gt;

&lt;p&gt;The same engine runs as a live FastAPI server. One request is one crash and one break. The server time at the median is 3.7 ms for 1 minute, 18.9 ms for 5 minutes and 67.6 ms for 10 minutes. I also ran everything on an NVIDIA GB10 (aarch64, 121 GB unified memory). The outputs are equal bit for bit, and the polygons are faster there, because its CPU cores are faster.&lt;/p&gt;

&lt;h2&gt;In the browser&lt;/h2&gt;

&lt;p&gt;The browser engine does not need the server. It loads one binary file (24 MB) with the street graph, the snap geometry and a static mesh. It snaps the mouse position to the nearest street, and runs a Float64 Dijkstra. A 10-minute solve takes about 0.03 ms in Node. A WebGL2 layer draws the area: rasterization does the union of the buffers, and the depth buffer finds the nearest street of each pixel. GEOS in WebAssembly makes the real polygon with the same rules. Against the server polygon, the browser polygon passes the gate for 300 of 300 crash-breaks.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/service-area/main/docs/images/client_both.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/service-area/main/docs/images/client_both.png&quot; width=&quot;600&quot; alt=&quot;Web map with the browser fill and the server outline at 5 minutes.&quot;&gt;&lt;/a&gt;
  &lt;figcaption&gt;Both engines at 5 minutes. Blue fill: the browser. Orange outline: the server.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;And guess what? When the browser is fast, you can ask a different question. The planner page solves all 2,483 crashes as candidate stations with WebGPU in about 40 ms. Then it picks the stations that reach the most crashes. Five stations reach 1,228 crashes (49.5%) in 5 minutes.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/service-area/main/docs/images/planner.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/service-area/main/docs/images/planner.png&quot; width=&quot;600&quot; alt=&quot;Adams County with 5 stations, crashes reached in 5 minutes in blue, other crashes in red.&quot;&gt;&lt;/a&gt;
  &lt;figcaption&gt;Five stations, 5 minutes. Blue: crashes reached. Red: crashes not reached.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;What this does not show&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Adams County is a small rural network (5,035 edges). Franklin County has a pilot of 20 crashes only.&lt;/li&gt;
  &lt;li&gt;The speeds come from the road class. There are no posted speeds, no one-way streets and no traffic.&lt;/li&gt;
  &lt;li&gt;The polygon match with native ArcGIS is close, but it is not exact. The gate uses my builder on both sides.&lt;/li&gt;
  &lt;li&gt;The polygons run on the CPU. They are now the slowest step.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Try it&lt;/h2&gt;

&lt;p&gt;The repository has the Adams County test data: the prepared streets, the crashes, and the ArcGIS output for the 100-crash sample. With these files, you can run the CUDA engine and the parity gate without an ArcGIS licence. The README has the rules, the measured results and the procedures.&lt;/p&gt;

&lt;p&gt;Next, I want to move the polygon step to the GPU, and I want to run the 2,000-crash check on Franklin County. More to come.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/4025583930927842082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/4025583930927842082' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/4025583930927842082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/4025583930927842082'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/11/service-areas-on-gpu-and-in-browser.html' title='Service Areas on the GPU and in the Browser, Checked Against ArcGIS'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-1935495984539802563</id><published>2026-11-09T16:54:18.000-05:00</published><updated>2026-11-20T05:51:03.282-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS"/><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><title type='text'>A Map Beside the Chat: An ArcGIS Mod for Claude Code</title><content type='html'>&lt;p style=&quot;border-left:4px solid #e4572e;padding:8px 12px;background:rgba(228,87,46,0.08)&quot;&gt;&lt;b&gt;Update, November 2026:&lt;/b&gt; This project is now part of map-pane. One skill drives the same live map from Claude Code, Codex and Pi. Read the current post: &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/11/map-pane-one-live-map-for-claude-code.html&quot;&gt;map-pane: one live map for Claude Code, Codex and Pi&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Claude Code now has &lt;a href=&quot;https://code.claude.com/docs/en/plugins/mods/overview&quot;&gt;mods&lt;/a&gt;. A mod is a plugin with a hooks module: a TypeScript file whose functions Claude Code calls when events occur. A mod can add tools for Claude, slash commands, and panes beside the chat. When I read that, I had one question. Can I put a live ArcGIS map next to Claude, and can Claude draw on it while I talk to it?&lt;/p&gt;

&lt;p&gt;The answer is yes, with one interesting detour. In this post, I show the mod, explain how the parts connect, and tell you what does not work yet. The source is on GitHub: &lt;a href=&quot;https://github.com/mraad/claude-mod-map&quot;&gt;mraad/claude-mod-map&lt;/a&gt;.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/claude-mod-map/main/docs/img/browser-world.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/claude-mod-map/main/docs/img/browser-world.jpg&quot; alt=&quot;ArcGIS map with a dark basemap, seven labeled red city markers and a blue geodesic route from Sydney to San Francisco.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;Markers in seven cities, labels, a geodesic route and a dark basemap, all placed with the mod&#39;s tools.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;What the mod does&lt;/h2&gt;

&lt;p&gt;The mod gives Claude six tools. Each tool changes a map that uses the &lt;a href=&quot;https://developers.arcgis.com/javascript/latest/&quot;&gt;ArcGIS Maps SDK for JavaScript&lt;/a&gt; 5.2.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code&gt;add_graphic&lt;/code&gt; adds a point, a line or a polygon. The input is GeoJSON geometry and an optional ArcGIS symbol.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;add_layer&lt;/code&gt; adds a feature, GeoJSON, GeoParquet, tile, vector tile, imagery or portal item layer. It takes a URL or a local file path.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;remove_layer&lt;/code&gt; and &lt;code&gt;clear_graphics&lt;/code&gt; remove content.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;go_to&lt;/code&gt; moves the map to a center and zoom, or to a layer.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;map_state&lt;/code&gt; tells Claude what is on the map.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The command &lt;code&gt;/map&lt;/code&gt; shows the map in the Claude Code pane on the right side. The command &lt;code&gt;/map browser&lt;/code&gt; shows the same map in a Chrome app window on the right half of the screen. You can open both. Each tool changes both.&lt;/p&gt;

&lt;p&gt;The mod has no npm dependencies. It uses the Node standard library, the mods API and the Google Chrome that is already on my Mac. The basemap is OpenStreetMap, so you do not need an API key.&lt;/p&gt;

&lt;h2&gt;How the parts connect&lt;/h2&gt;

&lt;p&gt;A hooks module has no DOM and no Node. It talks to the outside world only through the engine interface. So the map cannot live inside the mod. The map lives in a web page, and the mod talks to that page through a small local server. I call that server the bridge.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Claude calls a tool, for example &lt;code&gt;add_graphic&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;One &lt;code&gt;tool.call&lt;/code&gt; hook in the mod gets the call. It keeps only the fields that are in the tool schema.&lt;/li&gt;
  &lt;li&gt;The hook sends &lt;code&gt;POST /cmd&lt;/code&gt; to the bridge on &lt;code&gt;127.0.0.1:8765&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;The bridge sends the command to each open map page as a Server-Sent Event.&lt;/li&gt;
  &lt;li&gt;The page does the command with the SDK and sends the result and its map state back with &lt;code&gt;POST /ack&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;The hook gives the result to Claude.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The mod starts the bridge when the session starts, and the bridge stops with the mod. The bridge also prints one line on its standard output for each map change, for example &lt;code&gt;STATE {...}&lt;/code&gt;. The mod reads these lines and updates the pane header and the status line. A plain text protocol on stdout was the simplest channel I found, and it needs no polling.&lt;/p&gt;

&lt;h2&gt;The detour: a map in a terminal pane&lt;/h2&gt;

&lt;p&gt;The pane is drawn in the terminal. It has text, boxes and buttons. It does not have a web view. But it has an &lt;code&gt;Image&lt;/code&gt; element, and Ghostty can show pictures. So I render the map somewhere else and send pictures of it into the pane.&lt;/p&gt;

&lt;p&gt;The bridge starts a headless Chrome on the same map page. It drives Chrome over the Chrome DevTools Protocol on &lt;code&gt;--remote-debugging-pipe&lt;/code&gt;, with no library. Chrome sends a PNG frame each time the map changes. The bridge writes the frame to a file, then renames it, so the terminal never reads half a picture. The mod swaps the picture in the pane with &lt;code&gt;$.ui.blit&lt;/code&gt;, without a redraw.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/claude-mod-map/main/docs/img/pane-italy.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/claude-mod-map/main/docs/img/pane-italy.jpg&quot; alt=&quot;Map frame from the pane: Italy with a blue outline from a filtered feature layer.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;A pane frame. The page hides its layer list in this mode. The Italy outline is a feature layer with the filter &lt;code&gt;COUNTRY = &#39;Italy&#39;&lt;/code&gt;.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Mouse input goes the other way. Under the picture, the pane has an empty &lt;code&gt;Client&lt;/code&gt; element, and the picture sits on top of it in an absolute box. The &lt;code&gt;Client&lt;/code&gt; gets the pointer and key events and posts them to the mod. The mod sends them to the bridge, and the bridge gives them to Chrome as real mouse and key events. A drag pans the map. A double-click zooms in. One detail took some thought: a later post in the same frame replaces an earlier one. So each post carries the last 32 events with sequence numbers, and the mod forwards only the new ones.&lt;/p&gt;

&lt;p&gt;Before I wrote the viewer, I measured. Lightpanda is the fastest headless browser in published benchmarks, but it has no rendering engine, and the SDK needs WebGL2. So I compared Chrome setups on my M4 Max:&lt;/p&gt;

&lt;table style=&quot;border-collapse:collapse;margin:0 auto;&quot;&gt;
  &lt;tr&gt;&lt;th style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Setup&lt;/th&gt;&lt;th style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Map ready&lt;/th&gt;&lt;th style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Command to frame&lt;/th&gt;&lt;th style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Frames/s&lt;/th&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Raw CDP, Metal GPU&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;1.30 s&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;64 ms&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;58.8&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Raw CDP, SwiftShader&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;3.04 s&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;86 ms&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;58.1&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;puppeteer-core, Metal GPU&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;1.32 s&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;50 ms&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;58.7&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;The browser driver made almost no difference. The GPU flag did: &lt;code&gt;--use-angle=metal&lt;/code&gt; cut the time to a ready map from 3.0 s to 1.3 s. So the viewer uses raw CDP, which needs no dependency, and the Metal GPU.&lt;/p&gt;

&lt;h2&gt;Seven cities, one GeoJSON document&lt;/h2&gt;

&lt;p&gt;Here is a request that I like to test with: &quot;Create markers in Sydney, Dubai, Beirut, Florence, Paris, New York and San Francisco. Connect them with a geodesic line. Make the basemap dark. Put everything in one GeoJSON document.&quot;&lt;/p&gt;

&lt;p&gt;The GeoJSON part is the interesting one. A GeoJSON line is straight in longitude and latitude, so it is not geodesic. To make it geodesic, I put 32 points on the great circle for each leg. The result is one FeatureCollection with seven Points and one LineString of 193 points, about 27,400 km long. It is in the repository as &lt;a href=&quot;https://github.com/mraad/claude-mod-map/blob/main/examples/cities-route.geojson&quot;&gt;examples/cities-route.geojson&lt;/a&gt;.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/claude-mod-map/main/docs/img/browser-europe.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/claude-mod-map/main/docs/img/browser-europe.jpg&quot; alt=&quot;Europe and the Middle East on a dark basemap with Paris, Florence, Beirut and Dubai labels and the blue route.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;The same route at zoom 4. The labels are text symbols in their own graphics layer.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The dark basemap shows a gap in my tool set. The mod has no basemap tool, and a new layer always goes on top. So Claude added the Esri Dark Gray tile layers, removed the graphics layers, and added them again on top. It worked, but a &lt;code&gt;set_basemap&lt;/code&gt; tool is the better answer.&lt;/p&gt;

&lt;h2&gt;GeoParquet, and one HEAD request&lt;/h2&gt;

&lt;p&gt;The SDK has a &lt;code&gt;ParquetLayer&lt;/code&gt;, so GeoParquet support was a small step. The mod sends a local path to the bridge. The bridge registers the file and serves it at a random URL. The first test failed with &quot;Failed to parse file&quot;. The cause was not the file. &lt;code&gt;ParquetLayer&lt;/code&gt; sends a &lt;code&gt;HEAD&lt;/code&gt; request first to get the file size, then range requests for the footer. My bridge answered &lt;code&gt;HEAD&lt;/code&gt; with 404. After I added &lt;code&gt;HEAD&lt;/code&gt; and range support, 300 sample points loaded at once.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/claude-mod-map/main/docs/img/geoparquet-kuwait.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/claude-mod-map/main/docs/img/geoparquet-kuwait.jpg&quot; alt=&quot;Kuwait with orange GeoParquet points, a green country outline, a red polygon and a blue marker.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;300 points from a local GeoParquet file (orange), a filtered feature layer (green) and two graphics.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;A local server is still a server&lt;/h2&gt;

&lt;p&gt;The bridge listens only on &lt;code&gt;127.0.0.1&lt;/code&gt;, but any web page in your browser can send requests to &lt;code&gt;127.0.0.1&lt;/code&gt;. So the bridge refuses a request when the &lt;code&gt;Host&lt;/code&gt; header is not &lt;code&gt;127.0.0.1:8765&lt;/code&gt; (this stops DNS rebinding) or when the &lt;code&gt;Origin&lt;/code&gt; header is from a different site. That check does not stop other programs on the same computer. So the mod also makes a random token each time it loads, and the bridge refuses the control requests without it. File URLs use random keys. The bridge is still for one user on one computer, and the documentation says so.&lt;/p&gt;

&lt;h2&gt;Try it&lt;/h2&gt;

&lt;p&gt;You need macOS, Claude Code v2.1.287 or later, Node.js and Google Chrome. A mod runs with your permissions, so read the code first.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Start Claude Code.&lt;/li&gt;
  &lt;li&gt;Type &lt;code&gt;/plugin install arcgis-map --marketplace mraad/claude-mod-map&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Type &lt;code&gt;/map&lt;/code&gt; or &lt;code&gt;/map browser&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Ask Claude to put something on the map.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;What does not work yet&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;The terminal does not send the scroll wheel to a pane. In the pane, you zoom with a double-click, the map buttons or the &lt;code&gt;+&lt;/code&gt; and &lt;code&gt;-&lt;/code&gt; keys.&lt;/li&gt;
  &lt;li&gt;The pane picture assumes a terminal cell of 1:2. Other cell shapes stretch the picture.&lt;/li&gt;
  &lt;li&gt;The port is fixed at 8765, so there is one map per computer. During testing, another program took that port, and the tools stopped until it was free again.&lt;/li&gt;
  &lt;li&gt;A &lt;code&gt;GeoJSONLayer&lt;/code&gt; takes one geometry type. My seven-city document has points and a line, so it cannot load as one layer.&lt;/li&gt;
  &lt;li&gt;The hidden Chrome for the pane uses 1.2 to 1.9 GB of memory. The bridge stops it 90 seconds after the pane closes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, I want a &lt;code&gt;set_basemap&lt;/code&gt; tool and a &lt;code&gt;geometryType&lt;/code&gt; option on &lt;code&gt;add_layer&lt;/code&gt;, so one GeoJSON document can load as two layers. The code, the tests and a full STE100 HTML document are in &lt;a href=&quot;https://github.com/mraad/claude-mod-map&quot;&gt;the repository&lt;/a&gt;. More to come.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/1935495984539802563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/1935495984539802563' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/1935495984539802563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/1935495984539802563'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/11/a-map-beside-chat-arcgis-mod-for-claude.html' title='A Map Beside the Chat: An ArcGIS Mod for Claude Code'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-8841074734999259504</id><published>2026-11-08T15:28:45.782-05:00</published><updated>2026-11-08T15:28:45.782-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS"/><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="MCP"/><title type='text'>mcp-rwee: Four Tools, and arcpy Runs on Another Machine</title><content type='html'>&lt;p&gt;In my post &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/10/arcpi-not-everything-needs-mcp-to-be.html&quot;&gt;arcpi: Not Everything Needs an MCP to Be Agentic&lt;/a&gt;, I let an agent call the ArcGIS REST API directly, with no MCP server in front of it. This time I have the opposite problem. My data and arcpy are on a Windows machine with ArcGIS Pro. Claude Code runs on my Mac. arcpy has no REST API, and it does not run on a Mac. So here, a small MCP server earns its keep.&lt;/p&gt;

&lt;p&gt;The server is &lt;a href=&quot;https://github.com/mraad/mcp-rwee&quot;&gt;mcp-rwee&lt;/a&gt;. The name is its tool list: &lt;strong&gt;r&lt;/strong&gt;ead, &lt;strong&gt;w&lt;/strong&gt;rite, &lt;strong&gt;e&lt;/strong&gt;dit and &lt;strong&gt;e&lt;/strong&gt;xecute. The client writes a Python script on the Windows machine, runs it there and answers from the printed output. In this post, I explain how it works, what one real question looked like, and what Windows taught me that macOS did not.&lt;/p&gt;

&lt;h2&gt;Four tools and a prompt file&lt;/h2&gt;

&lt;p&gt;The server has exactly four tools and one prompt. There is no &lt;code&gt;buffer&lt;/code&gt; tool, no &lt;code&gt;select_by_location&lt;/code&gt; tool and no &lt;code&gt;list_layers&lt;/code&gt; tool. arcpy already has all of these. The client writes the script that calls them.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code&gt;read&lt;/code&gt;, &lt;code&gt;write&lt;/code&gt; and &lt;code&gt;edit&lt;/code&gt; work on text files on the Windows machine.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;execute&lt;/code&gt; runs a &lt;code&gt;.py&lt;/code&gt; file, or a shell command, and returns &lt;code&gt;exit_code&lt;/code&gt;, &lt;code&gt;stdout&lt;/code&gt; and &lt;code&gt;stderr&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;The prompt file gives the client its task. For arcpy, it tells the client to write a script, run it, read the error if there is one, correct the script and run it again.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the same idea as Code Mode, which Philipp Schmid describes in &lt;a href=&quot;https://www.philschmid.de/code-mode&quot;&gt;Why Agents Are Soon Only Going to Have 1 Tool&lt;/a&gt;. A script can read thousands of features, and the model sees only what the script prints. The server keeps the last 100,000 bytes of that output. One difference is important: the script does not run in a sandbox. It runs with the rights of the Windows user that started the server. I come back to this below.&lt;/p&gt;

&lt;h2&gt;Two processes, not one&lt;/h2&gt;

&lt;p&gt;arcpy is native code. A crash in native code does not raise a Python exception, so a &lt;code&gt;try&lt;/code&gt; statement cannot stop it. Only a process boundary can stop it. For this reason, the server and the scripts run in two different processes.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/mcp-rwee/main/docs/images/two-processes.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/mcp-rwee/main/docs/images/two-processes.png&quot; alt=&quot;The Claude client sends tool calls with a token to server.py on the Windows machine. server.py sends jobs to worker.py through pipes. A dashed red line between them marks where a crash stops. The worker writes output to temp files, and the server reads the end of each file.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;The two processes. A crash in the worker stops at the red line. The server stays up.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;code&gt;server.py&lt;/code&gt; is a FastMCP HTTP server. It checks the token and does the file tools. &lt;code&gt;worker.py&lt;/code&gt; runs each script on its main thread with &lt;code&gt;runpy&lt;/code&gt;. The worker is standard library only, so FastMCP and its dependencies do not load beside arcpy.&lt;/p&gt;

&lt;p&gt;The worker stays alive between scripts, so arcpy stays imported. On my test VM, the first script took 4.51 seconds, and most of that was &lt;code&gt;import arcpy&lt;/code&gt;. The same script again took 0.02 seconds. After a crash or a timeout, the server stops the worker, and the next script starts a new one.&lt;/p&gt;

&lt;p&gt;Script output does not go through the job pipe. The worker sends file descriptors 1 and 2 to a temp file for each run. Output from native code and from child processes goes there too, and a script cannot corrupt the channel between the processes. The server reads only the end of each file, so a script that prints without end cannot fill the server&#39;s memory.&lt;/p&gt;

&lt;h2&gt;Errors are part of the loop&lt;/h2&gt;

&lt;p&gt;Most first scripts fail. A dataset name is wrong, or an argument has the wrong type. That is fine, because the error comes back as text.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/mcp-rwee/main/docs/images/question-loop.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/mcp-rwee/main/docs/images/question-loop.png&quot; alt=&quot;Sequence diagram. The client writes test.py and executes it. The worker returns exit code 1 with ERROR 000732, dataset does not exist. The client edits the script and executes it again. The worker returns exit code 0, and the client answers from stdout.&quot; style=&quot;width:100%;max-width:560px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;One question with one correction. The client reads the traceback, edits the script and runs it again.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;A Python exception gives &lt;code&gt;exit_code&lt;/code&gt; 1 and the traceback in &lt;code&gt;stderr&lt;/code&gt;, and the worker stays alive. A native crash gives &lt;code&gt;crashed&lt;/code&gt; true, the output so far and the Python stack. A timeout gives &lt;code&gt;timed_out&lt;/code&gt; true. In each case, the client gets enough text to decide what to do next.&lt;/p&gt;

&lt;h2&gt;A real question&lt;/h2&gt;

&lt;p&gt;I gave Claude a real ArcGIS Pro project, &lt;code&gt;NorthSea.aprx&lt;/code&gt;, and this question: calculate the number of wells with depth greater than 350 m and within 5 miles of an in-service pipeline, and return the statistics. The project is on the Windows machine. The Mac has no copy. (The Claude Code session started before I registered the server, so it called the same four tools through a small FastMCP client. The server got the same calls.)&lt;/p&gt;

&lt;p&gt;Claude made five runs of four scripts. The first script found the maps, layers, fields and coordinate systems. The second script found that &lt;code&gt;water_depth&lt;/code&gt; is the only depth field. The third script calculated the answer with three methods: &lt;code&gt;SelectLayerByLocation&lt;/code&gt; with a geodesic distance, &lt;code&gt;GenerateNearTable&lt;/code&gt; with a geodesic distance, and a NumPy distance to densified pipeline segments. The NumPy method failed with &lt;code&gt;ValueError: Invalid input for distance, expecting float&lt;/code&gt;. The traceback came back, and the server continued to run. The fourth run used the same script with the &lt;code&gt;densify&lt;/code&gt; call corrected, and all three methods selected the same 167 object IDs.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/mcp-rwee/main/docs/images/northsea-167.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/mcp-rwee/main/docs/images/northsea-167.png&quot; alt=&quot;Map in ED50 degrees, latitude 52 to 72 north. 167 selected wellbores are orange dots near blue in-service pipelines. Other wellbores deeper than 350 m are grey circles.&quot; style=&quot;width:100%;max-width:420px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;The 167 selected wellbores (orange), the other wellbores in water deeper than 350 m (grey), and the pipelines.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;table style=&quot;border-collapse:collapse;margin:0 auto;&quot;&gt;
  &lt;tr&gt;&lt;th style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Result&lt;/th&gt;&lt;th style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Value&lt;/th&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Wellbores with water depth &amp;gt; 350 m, within 5 statute miles of an in-service pipeline&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;167&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Wells that hold these wellbores&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;125&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Mean water depth&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;405.81 m&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Median water depth&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;370.00 m&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;Now the part that I like best. The last run checked the answer instead of trusting it. The first output showed a gap of 10,970.80 m between two of the methods. That gap is large only for wellbores that are far from a pipeline, because the NumPy method uses a flat local scale. Under 10 km, the largest gap is 6.24 m. The two nearest wellbores outside the limit are 10.48 m past it, so the gap does not change the count.&lt;/p&gt;

&lt;p&gt;The checks also found the limits of the answer. &lt;code&gt;water_depth&lt;/code&gt; is the depth of the water, not the depth of the wellbore in the rock. 2,258 wellbores have no depth value, and most of them are Dutch or Danish. 119 of these are within the distance limit. The script cannot test them, so they are not in the 167.&lt;/p&gt;

&lt;h2&gt;Getting to the Windows machine&lt;/h2&gt;

&lt;p&gt;The server listens on &lt;code&gt;127.0.0.1&lt;/code&gt; only. A non-local host without a TLS certificate is refused, because plain HTTP would expose the token. From the Mac, I use an SSH tunnel.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/mcp-rwee/main/docs/images/tunnel.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/mcp-rwee/main/docs/images/tunnel.png&quot; alt=&quot;On the Mac, the MCP client sends HTTP with the token to ssh -L on 127.0.0.1:8765. An encrypted SSH tunnel on port 22 goes to sshd on the Windows machine. sshd forwards to server.py on 127.0.0.1:8765, which sends jobs to worker.py, which reads NorthSea.gdb.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;The path of one tool call. Only the red line goes across the network.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The script &lt;code&gt;remote.sh&lt;/code&gt; does the setup in one command. It starts the server over SSH with a new token, opens the tunnel and registers the server in Claude Code for the current folder. The token goes to the server through SSH standard input, so it is not in a remote file or a remote command line. &lt;code&gt;remote.sh stop&lt;/code&gt; removes all three.&lt;/p&gt;

&lt;h2&gt;What Windows taught me&lt;/h2&gt;

&lt;p&gt;All tests passed on macOS. Then I ran them on Windows with real arcpy, and Windows found faults that macOS did not show.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Each first &lt;code&gt;import arcpy&lt;/code&gt; put 680 KB of &quot;Windows fatal exception&quot; text in &lt;code&gt;stderr&lt;/code&gt;, on a good run. arcpy handles these exceptions itself, but &lt;code&gt;faulthandler&lt;/code&gt; reports each one. Now &lt;code&gt;faulthandler&lt;/code&gt; writes to its own file, and the server reads that file only after a crash.&lt;/li&gt;
  &lt;li&gt;Output lines ended with &lt;code&gt;\r\r\n&lt;/code&gt;. The capture file was in text mode, so Windows changed each newline a second time. The worker now opens the files with &lt;code&gt;O_BINARY&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;echo café&lt;/code&gt; came back as &lt;code&gt;caf&amp;#xFFFD;&lt;/code&gt;. &lt;code&gt;echo&lt;/code&gt; uses the code page of the &lt;code&gt;cmd&lt;/code&gt; that started it, so &lt;code&gt;chcp 65001&lt;/code&gt; on the same line had no effect. The server now runs &lt;code&gt;chcp&lt;/code&gt; in one &lt;code&gt;cmd&lt;/code&gt; and the command in a second &lt;code&gt;cmd&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;After a hard stop of the server, the worker continued to run. A hard stop does not run exit handlers. Now a thread in the worker reads the job pipe. When the pipe closes, the worker stops itself and its child processes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The test suite has 97 tests. All 97 passed on a Windows 11 on Arm VM and on a Windows machine with x64 hardware, both with ArcGIS Pro 3.7.3.&lt;/p&gt;

&lt;h2&gt;The honest part&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;execute&lt;/code&gt; is remote code execution, by design. A person who has the token can run code as the server&#39;s Windows user. The worker protects the server against a crash. It is not a security boundary. My advice is short:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Keep the server on &lt;code&gt;127.0.0.1&lt;/code&gt; and use the SSH tunnel.&lt;/li&gt;
  &lt;li&gt;Use a copy of important data, because each script can change data.&lt;/li&gt;
  &lt;li&gt;Stop the server when you finish. Closing the SSH session does not stop it, and its token continues to work.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A dedicated low-privilege Windows user is the next step, but I have not tested it yet. The tunnel stayed open through a quiet period of 90 seconds. I have not tested a longer quiet period behind a proxy.&lt;/p&gt;

&lt;h2&gt;Try it&lt;/h2&gt;

&lt;p&gt;The code is on GitHub at &lt;a href=&quot;https://github.com/mraad/mcp-rwee&quot;&gt;mraad/mcp-rwee&lt;/a&gt;, under the MIT license. The README has the quick start. The manual in &lt;code&gt;docs/index.html&lt;/code&gt; has the install procedure, every test result and the complete NorthSea run. Download it and open it in a browser.&lt;/p&gt;

&lt;p&gt;arcpi showed that an agent does not always need an MCP server. mcp-rwee shows when it does: the library is on another machine, and it has no API. Four tools are enough, because the client writes the rest. More to come.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/8841074734999259504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/8841074734999259504' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/8841074734999259504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/8841074734999259504'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/11/mcp-rwee-four-tools-and-arcpy-runs-on.html' title='mcp-rwee: Four Tools, and arcpy Runs on Another Machine'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-7840073813620810004</id><published>2026-11-08T11:27:23.000-05:00</published><updated>2026-11-08T11:56:52.383-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Agents"/><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS"/><category scheme="http://www.blogger.com/atom/ns#" term="DuckDB"/><category scheme="http://www.blogger.com/atom/ns#" term="MCP"/><category scheme="http://www.blogger.com/atom/ns#" term="Rust"/><category scheme="http://www.blogger.com/atom/ns#" term="WebAssembly"/><title type='text'>An Agent Loop That Runs in the Browser: Rust, WASM and One MCP Endpoint</title><content type='html'>&lt;p&gt;Can the whole agent run on the client? I mean the loop itself: the model calls, the tool calls and the context management. The server still runs the tools. But the part that decides what to do next lives in the browser tab.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/mraad/gen-ai-rs&quot;&gt;gen-ai-rs&lt;/a&gt; is my experiment to answer that question. It is a small agent harness in Rust, compiled to WebAssembly. It talks to an OpenAI-compatible model and runs tools through one same-origin MCP endpoint. A plain question uses one model call. A question about North Sea wells draws them on an ArcGIS map.&lt;/p&gt;
&lt;h2&gt;Where this comes from&lt;/h2&gt;
&lt;p&gt;This is my third pass at the same problem.&lt;/p&gt;
&lt;p&gt;The first was IDRIS, about two and a half years ago. It explored geospatial data with an LLM and SQL. Its text-to-SQL side came from what I learned from &lt;a href=&quot;https://github.com/vanna-ai/vanna&quot;&gt;Vanna&lt;/a&gt;. There was little to copy then, so I learned the loop from the ground up, with help from OpenAI&#39;s &lt;a href=&quot;https://developers.openai.com/tracks/building-agents&quot;&gt;building agents track&lt;/a&gt; and its &lt;a href=&quot;https://cdn.openai.com/business-guides-and-resources/a-practical-guide-to-building-agents.pdf&quot;&gt;practical guide to building agents&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The second was the Generative AI Toolkit. It grew out of IDRIS and became a professional services offering. It taught me what an agent really needs, and what it can do without.&lt;/p&gt;
&lt;p&gt;gen-ai-rs is not a port of the toolkit and shares no code with it. It is a new implementation of the lessons from both. The main lesson: keep the loop small, and delete before you add.&lt;/p&gt;
&lt;h2&gt;The split between browser and server&lt;/h2&gt;
&lt;p&gt;&lt;img alt=&quot;Browser and server responsibilities. The host application calls Rust/WASM in the browser. The same-origin server holds static assets, an optional model proxy and the MCP endpoint.&quot; src=&quot;https://raw.githubusercontent.com/mraad/gen-ai-rs/main/docs/images/architecture.svg&quot; style=&quot;width:600px;max-width:100%;height:auto;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The browser holds two parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The host page.&lt;/strong&gt; It shows the UI, receives events and stores the session state.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Rust core.&lt;/strong&gt; It runs the agent loop, loads skills and keeps the context inside its budget.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The server holds three parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Static files.&lt;/strong&gt; HTML, JavaScript, the WASM file and the exported skills.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A model proxy (optional).&lt;/strong&gt; It keeps the provider key off the page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The MCP endpoint, &lt;code&gt;/mcp&lt;/code&gt;.&lt;/strong&gt; It runs the tools. It must validate the arguments and authorize each action.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The core never writes storage. The host saves &lt;code&gt;state()&lt;/code&gt; after each turn and passes it back on the next &lt;code&gt;create()&lt;/code&gt;. A damaged state value stops the session from starting. It does not silently start empty. A reload of the page restores the conversation.&lt;/p&gt;
&lt;p&gt;The host API is short:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;import init, { GaitSession } from &#39;./pkg/gait_wasm.js&#39;;
await init();
const session = await GaitSession.create({
  model: &#39;openai/my-model&#39;,
  apiBase: &#39;/llm/v1&#39;,
  kbUrl: &#39;kb&#39;,
  mcpUrl: &#39;/mcp&#39;,
  onEvent: event =&amp;gt; renderEvent(event),
  onDelta: text =&amp;gt; appendAnswer(text),
});
const result = await session.send(&#39;Multiply 6 by 7.&#39;);
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;One turn of the loop&lt;/h2&gt;
&lt;p&gt;&lt;img alt=&quot;One agent turn: start the turn, compact if needed, call the model, call the tools in order, add the results, and commit the answer. Cancel, error, a cut-off tool call, the budget or 10 calls stop the turn without a commit.&quot; src=&quot;https://raw.githubusercontent.com/mraad/gen-ai-rs/main/docs/images/agent-loop.svg&quot; style=&quot;width:600px;max-width:100%;height:auto;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The loop does three things: model calls, sequential tool calls and compaction. Nothing more.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The turn copies the state and adds the user prompt.&lt;/li&gt;
&lt;li&gt;If the local token estimate is over budget, the core summarizes the earlier turns. This happens at most once in a turn.&lt;/li&gt;
&lt;li&gt;The core calls the model.&lt;/li&gt;
&lt;li&gt;If the model asks for tools, the core runs them in order and adds the results.&lt;/li&gt;
&lt;li&gt;The loop goes back to step 3, for at most 10 model calls.&lt;/li&gt;
&lt;li&gt;A final answer commits the turn.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Some rules keep the behavior predictable:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Only a successful turn commits.&lt;/strong&gt; A cancelled or failed turn changes neither the conversation nor the active skills.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Nothing is sent again.&lt;/strong&gt; A failed model request ends the turn. A proxy or the host can retry.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A cut-off tool call never runs.&lt;/strong&gt; If the model hits its output limit in the middle of a tool call, the core does not guess the missing arguments.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tool output is capped&lt;/strong&gt; at 30,000 characters plus a truncation marker.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cancel closes the HTTP requests.&lt;/strong&gt; It cannot undo an action that the server already did.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Events go straight to the host through &lt;code&gt;onEvent&lt;/code&gt;. Rust keeps no trace. The host decides what to keep and what to redact.&lt;/p&gt;
&lt;h2&gt;Skills, loaded only when needed&lt;/h2&gt;
&lt;p&gt;&lt;img alt=&quot;Three levels of skill disclosure: the catalog at startup, the instructions of one skill on activation, and one listed resource on request.&quot; src=&quot;https://raw.githubusercontent.com/mraad/gen-ai-rs/main/docs/images/skill-tiers.svg&quot; style=&quot;width:600px;max-width:100%;height:auto;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;A skill is a folder with a &lt;code&gt;SKILL.md&lt;/code&gt; file and optional resources. An exporter turns the folders into a static bundle. The core loads it in three levels:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;The catalog.&lt;/strong&gt; At startup, the model sees only names, descriptions and resource paths.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The instructions.&lt;/strong&gt; The model calls &lt;code&gt;activate_skill&lt;/code&gt; to fetch the body of one skill.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;One resource.&lt;/strong&gt; The model calls &lt;code&gt;read_skill_resource&lt;/code&gt; to fetch one listed file of an active skill.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This keeps the prompt small. The &lt;code&gt;northsea-duckdb&lt;/code&gt; skill, for example, holds the SQL rules for the North Sea data. The model reads them only when a question needs SQL.&lt;/p&gt;
&lt;h2&gt;Tools behind one boundary: the North Sea map&lt;/h2&gt;
&lt;p&gt;All application tools go through &lt;code&gt;/mcp&lt;/code&gt;. For the map demo, a small gateway, &lt;code&gt;tools/gateway.py&lt;/code&gt;, sits in front of an &lt;a href=&quot;https://github.com/mraad/mcp-rwee&quot;&gt;mcp-rwee&lt;/a&gt; server. The gateway serves the page, adds the server token from its environment and relays the calls. The page never sees the token.&lt;/p&gt;
&lt;p&gt;In the default &lt;code&gt;narrow&lt;/code&gt; mode, the model gets two tools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;northsea_layers&lt;/code&gt; returns a short card for each table, or the full metadata of one table.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;northsea_query&lt;/code&gt; runs read-only SQL SELECT statements in DuckDB, with file, network and settings access removed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A result with geometry also writes a map file. The model gets back only the row count, column statistics and 10 sample rows. The map page draws the full file.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;One map file format for each question: the page sets X-Gait-Format, the gateway accepts only geojson or parquet, northsea.py writes one file, and the page draws it with GeoJSONLayer or ParquetLayer.&quot; src=&quot;https://raw.githubusercontent.com/mraad/gen-ai-rs/main/docs/images/map-format.svg&quot; style=&quot;width:600px;max-width:100%;height:auto;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The page has a switch for GeoJSON or GeoParquet. The page sends the choice in a header. The model cannot choose the format. The map uses the ArcGIS Maps SDK for JavaScript 5.2 from the CDN, with &lt;code&gt;GeoJSONLayer&lt;/code&gt; or &lt;code&gt;ParquetLayer&lt;/code&gt;. There is no build step.&lt;/p&gt;
&lt;p&gt;Here is a question I used for testing:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Show all the wells with depth &amp;gt; 350 m and color-code them by the z-score value of their depth.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The first version drew the wells in one color. The SQL was correct, but the map had no way to know which column to use for color. The fix was small. The skill rules now tell the model to return the value as a numeric column named &lt;code&gt;color&lt;/code&gt;. The map page reads the minimum and maximum from the result statistics. When the values span 0, as a z-score does, the ramp goes from blue through gray to orange, centered on 0. I did not add a new tool or a new skill. One rule and one renderer setting were enough.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;The map page after the z-score question: the trace panel shows 4 model calls and 12,480 tokens, and the map shows 600 wells colored from blue to orange.&quot; src=&quot;https://raw.githubusercontent.com/mraad/gen-ai-rs/main/docs/images/map-zscore.png&quot; style=&quot;width:720px;max-width:100%;height:auto;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;A live run with an Azure model and mcp-rwee on the North Sea DuckDB file: 600 wells, 4 model calls, 12,480 tokens, 9.4 seconds. The trace panel on the left shows each model call and tool call.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Token cost&lt;/h2&gt;
&lt;p&gt;Each model call sends the full history again, so large tool results cost tokens on every later step. Two changes made the largest difference:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Table cards.&lt;/strong&gt; &lt;code&gt;northsea_layers&lt;/code&gt; with no table returns a compact card for every table, not the full metadata.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sample rows.&lt;/strong&gt; A result with geometry returns statistics and 10 rows. The full rows go to the map file.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;On five narrow questions with an Azure model, the total went from 106,522 tokens to about 56,300. All 15 answer checks were correct before and after.&lt;/p&gt;
&lt;p&gt;I also tried generic result shaping and a tool-call ledger at the gateway. The two changes above did most of the saving, so I removed them to keep the harness minimal.&lt;/p&gt;
&lt;h2&gt;What I removed&lt;/h2&gt;
&lt;p&gt;The project started as a bigger, extensible prototype. I removed graphs, handoffs, policy hooks, local JavaScript tools, browser embeddings, templates, queued sends, retries, harness-side storage and a retained trace buffer. For each feature, I asked one question: does the loop work without it? Most of the time it did.&lt;/p&gt;
&lt;p&gt;The result, measured on 2026-11-08 on Apple Silicon:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Measure&lt;/th&gt;
&lt;th style=&quot;text-align: right;&quot;&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Rust lines under &lt;code&gt;src/&lt;/code&gt; (with inline tests)&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;2,217&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WASM file, raw&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;272,918 bytes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WASM file, gzip&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;118,255 bytes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WASM start, warm median&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;1.6 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local MCP tool round trip, median of 20&lt;/td&gt;
&lt;td style=&quot;text-align: right;&quot;&gt;0.75 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;These numbers do not include model latency or real network cost. A build fails if the WASM file grows over a budget of 350,000 bytes.&lt;/p&gt;
&lt;h2&gt;Try it&lt;/h2&gt;
&lt;p&gt;You need Rust with the &lt;code&gt;wasm32-unknown-unknown&lt;/code&gt; target, wasm-pack, Python and PyYAML.&lt;/p&gt;
&lt;p&gt;Run these commands from the repository root, in this order. The first builds the WASM package. The second exports the skills. The third starts the demo server.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sh&quot;&gt;wasm-pack build crates/gait-wasm --target web --release --out-dir ../../web/pkg --no-pack
python3 tools/export_kb.py fixtures/kb-src web/kb
python3 tools/demo_server.py
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then open http://localhost:8080.&lt;/p&gt;
&lt;p&gt;Mock mode uses a scripted model and the real MCP endpoint, so it needs no key. The demo server has one harmless tool, &lt;code&gt;multiply&lt;/code&gt;. For a real model, use any OpenAI-compatible API. For an Anthropic model, put an OpenAI-compatible proxy such as LiteLLM in front of it.&lt;/p&gt;
&lt;p&gt;To keep the server in a sandbox, the README shows how to run it in &lt;a href=&quot;https://github.com/NVIDIA/OpenShell&quot;&gt;OpenShell&lt;/a&gt;. The agent loop and the model calls stay in the browser on the host. The sandbox limits what the tools can reach.&lt;/p&gt;
&lt;h2&gt;What I learned&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The browser is a good place for the loop.&lt;/strong&gt; It is close to the user, it streams well and the state stays with the page that shows it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The tools do not belong there.&lt;/strong&gt; Credentials, validation and authorization stay on the server. One endpoint makes that boundary easy to see and easy to check.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Small results beat clever context tricks.&lt;/strong&gt; Compact cards and sample rows did more than any general mechanism I tried.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deleting code is a feature.&lt;/strong&gt; Each removed part is one less thing to test, secure and explain.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The code is on GitHub under the Apache 2.0 license: &lt;a href=&quot;https://github.com/mraad/gen-ai-rs&quot;&gt;mraad/gen-ai-rs&lt;/a&gt;. The README and the detailed guide in &lt;code&gt;docs/index.html&lt;/code&gt; cover the host API, the MCP transport, skills, state, the gateway and the map page.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/7840073813620810004/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/7840073813620810004' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/7840073813620810004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/7840073813620810004'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/11/an-agent-loop-that-runs-in-browser-rust.html' title='An Agent Loop That Runs in the Browser: Rust, WASM and One MCP Endpoint'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-16542226960152489</id><published>2026-11-05T12:59:26.279-05:00</published><updated>2026-11-05T12:59:26.279-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Three Pads: Claude Writes the Weights, No Training</title><content type='html'>&lt;p&gt;In my &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/one-lander-three-controllers.html&quot;&gt;earlier lander posts&lt;/a&gt;, every controller needed something first: training steps, a solver, or a fine-tuned model. This week I read &lt;a href=&quot;https://rikiyat.github.io/blog/weight-space-programming/&quot;&gt;Sparks of Weight-Space Programming&lt;/a&gt; from MIT CSAIL. It makes a claim I had to test: a frontier LLM can read and write the weights of a neural network directly, with no optimizer and no gradient descent. The authors call this Weight-Space Programming.&lt;/p&gt;

&lt;p&gt;Their LLM is GPT-6 Astra. I wanted to know what Claude does with the same inputs, and what the result looks like on a small problem of my own. So I built &lt;a href=&quot;https://github.com/mraad/weight-space-programming&quot;&gt;weight-space-programming&lt;/a&gt; with Claude Code, and I added a small landing game. In this post, I show how the test works, what the numbers say, and where the method fails. You can &lt;a href=&quot;https://mraad.github.io/weight-space-programming/lander/&quot;&gt;play the game here&lt;/a&gt;.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/weight-space-programming/main/docs/img/three-pads.gif&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/weight-space-programming/main/docs/img/three-pads.gif&quot; alt=&quot;The Three Pads page. A network lands a craft on pad 2, then on pad 3. In the last flight, the target changes from pad 1 to pad 3, and the craft changes course and lands on pad 3.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;A 484-weight network flies the craft. Claude wrote the weights in one reply. Nothing was trained. In the last flight, the target changes from pad 1 to pad 3. Shown at 2x speed.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;The claim&lt;/h2&gt;

&lt;p&gt;The post has eight experiments, in three groups:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Read.&lt;/strong&gt; Astra gets the raw weights of a policy as text and names the game it was trained on. It was correct for 4 of 4 games.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Fix.&lt;/strong&gt; Astra edits 0.016% of the weights of Qwen3.5-0.8B to remove thinking loops. MATH-500 goes from 7.9% to 48.1%. The same method does not help Gemma 3 270M, which rarely loops, so the edit removes a fault and does not add an ability.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Write.&lt;/strong&gt; Astra writes a 20,486-weight MinAtar network in one reply. Breakout scores 517.4. PPO at 500M steps scores 25.3.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The authors released their &lt;a href=&quot;https://github.com/RikiyaT/lm_understand-logs&quot;&gt;complete logs&lt;/a&gt;: networks, prompts, replies and scores. This is the good part. I did not have to train anything. I could send the same prompts to Claude and score the replies the same way.&lt;/p&gt;

&lt;h2&gt;How one test runs&lt;/h2&gt;

&lt;p&gt;An LLM with access to the answers can give a false result. Chandan Singh&#39;s &lt;a href=&quot;https://csinva.io/weight-space-programming-autoresearch/analyze/toy_examples/report.html&quot;&gt;report&lt;/a&gt; on the same idea shows this: when his agent could read the evaluation data, it fitted that data. So each call in my tool is one reply, with these limits:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The call runs from a new, empty folder.&lt;/li&gt;
  &lt;li&gt;The call has no tools, no MCP servers, no memory and no instruction files.&lt;/li&gt;
  &lt;li&gt;The tool reads the event stream after the call. If the stream shows a tool, or if the call failed or stopped early, the tool refuses to score the run.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;First, test the scorer&lt;/h2&gt;

&lt;p&gt;A wrong scorer gives wrong conclusions, so I tested it before I spent any tokens. I parsed Astra&#39;s saved replies. The weights match the authors&#39; files exactly. Then I played those networks for 1,000 episodes each, with my own seeds:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Game&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Published&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;My scorer&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td&gt;Breakout&lt;/td&gt;&lt;td&gt;517.4 ± 7.4&lt;/td&gt;&lt;td&gt;501.1 ± 7.8&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Seaquest&lt;/td&gt;&lt;td&gt;53.1 ± 1.4&lt;/td&gt;&lt;td&gt;53.3 ± 1.4&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Asterix&lt;/td&gt;&lt;td&gt;53.2 ± 1.0&lt;/td&gt;&lt;td&gt;55.2 ± 1.1&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;All differences are less than two standard errors. Now I can trust the numbers below.&lt;/p&gt;

&lt;h2&gt;Can Claude read weights?&lt;/h2&gt;

&lt;p&gt;I sent Claude Opus 5.5 the authors&#39; Breakout prompt: 17,253 weights as text, with no game named. It answered Breakout, with 93% confidence.&lt;/p&gt;

&lt;p&gt;The post has no negative control, so I added one. I shuffled the 500 rows of the first weight matrix. The prompt still said that row &lt;em&gt;i&lt;/em&gt; belongs to input &lt;em&gt;i&lt;/em&gt;, which was now false. I expected a false answer with high confidence. I was wrong. Claude wrote that the rows &quot;look scrambled by a fixed permutation&quot;, reduced its confidence to 60%, and counted the types of rows. Then it named Breakout again.&lt;/p&gt;

&lt;p&gt;Were those counts real? I measured them. Claude had no calculator.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Row type&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Claude&#39;s estimate&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Measured&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td&gt;Active rows&lt;/td&gt;&lt;td&gt;about 148&lt;/td&gt;&lt;td&gt;143&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Rows that follow the biases&lt;/td&gt;&lt;td&gt;about 36 to 37&lt;/td&gt;&lt;td&gt;33&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Noise rows&lt;/td&gt;&lt;td&gt;about 315&lt;/td&gt;&lt;td&gt;324&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;So the answer is not a made-up story. But the control is weak: shuffled rows keep their values, and the output layer stays. Breakout is also a well-known game, so it is a likely guess. This is one network and one control.&lt;/p&gt;

&lt;h2&gt;Can Claude write weights?&lt;/h2&gt;

&lt;p&gt;Claude got the authors&#39; Breakout prompt with the source code of the game. It wrote 757 nonzero weights in one reply, with no feedback. The network scored 269.4 ± 7.4 over 1,000 episodes.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Network&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Breakout score&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td&gt;PPO, 100M steps (published)&lt;/td&gt;&lt;td&gt;15.8&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;PPO, 500M steps (published)&lt;/td&gt;&lt;td&gt;25.3&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Claude Opus 5.5, one reply&lt;/td&gt;&lt;td&gt;269.4&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;GPT-6 Astra, one reply (published)&lt;/td&gt;&lt;td&gt;517.4&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;That is one reply on one game, so it does not rank Claude against Astra. PPO is also a low bar here, because the network is a small MLP. This work looks like compilation: the LLM derives a controller from the source code, then writes that controller as weights.&lt;/p&gt;

&lt;h2&gt;Three Pads&lt;/h2&gt;

&lt;p&gt;Next I wanted a problem of my own, with no published answer in any training data. Three Pads is an original game. A craft falls under gravity. Three pads are on flat ground. The pilot must land slowly on the target pad, and the target pad can change during the flight.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/weight-space-programming/main/docs/img/page-flight.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/weight-space-programming/main/docs/img/page-flight.jpg&quot; alt=&quot;The Three Pads page with a pilot list, three pad buttons, fuel and speed readouts, and a craft in flight above three pads.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;The page is vanilla JavaScript with no build step. You can fly the craft, or select a network.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Part&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Value&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td&gt;State&lt;/td&gt;&lt;td&gt;8 numbers: x, y, vx, vy, fuel, and one flag for each pad&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Actions&lt;/td&gt;&lt;td&gt;none, thrust, left, right. One action per tick&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Sticky actions&lt;/td&gt;&lt;td&gt;10% chance that the game repeats the last action&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Fuel&lt;/td&gt;&lt;td&gt;300 units. Main engine uses 1 per tick, side engine 0.5&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Safe touchdown&lt;/td&gt;&lt;td&gt;|vx| ≤ 0.1 and |vy| ≤ 0.25&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Network&lt;/td&gt;&lt;td&gt;8 → 16 → 16 → 4, tanh, 484 weights, all starting at 0&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;One JavaScript file holds the rules. The browser, the scorer and the prompt all use that file, so the model reads the exact code that scores it. The prompt also tells Claude how to write the weights, in the small &quot;edits&quot; language from the authors&#39; prompt. Claude does not see the seeds or the scorer.&lt;/p&gt;

&lt;p&gt;I sent the same prompt three times, each in a new conversation. I made no other attempts. Each reply took 211 to 303 seconds and 20,617 to 29,907 output tokens. Then I scored each network on 3,000 flights. In the second test, the target pad changes once, at a tick from 30 to 120.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Pilot&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Nonzero weights&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Fixed pad&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Pad changes&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td&gt;Claude reply A&lt;/td&gt;&lt;td&gt;34&lt;/td&gt;&lt;td&gt;100.0%&lt;/td&gt;&lt;td&gt;100.0%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Claude reply B&lt;/td&gt;&lt;td&gt;30&lt;/td&gt;&lt;td&gt;100.0%&lt;/td&gt;&lt;td&gt;100.0%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Claude reply C&lt;/td&gt;&lt;td&gt;43&lt;/td&gt;&lt;td&gt;100.0%&lt;/td&gt;&lt;td&gt;100.0%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Plain program, not tuned&lt;/td&gt;&lt;td&gt;–&lt;/td&gt;&lt;td&gt;99.8%&lt;/td&gt;&lt;td&gt;82.0%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Random&lt;/td&gt;&lt;td&gt;–&lt;/td&gt;&lt;td&gt;0.0%&lt;/td&gt;&lt;td&gt;0.0%&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;And guess what? All three replies have the same design. Each one calculates a desired speed for each axis, then fires the engine that reduces the speed error. Each one holds its height until the craft is over the target pad, so it cannot touch down outside the pad. The plain program lost 18% in the second test, and in all of those crashes the craft ran out of fuel.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/weight-space-programming/main/docs/img/page-weights.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/weight-space-programming/main/docs/img/page-weights.jpg&quot; alt=&quot;Three heat maps of the weights of reply B. Most cells are blank, and a few cells at the top left are colored.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;All the weights of reply B. Orange is positive, teal is negative and blank is zero. Only 30 of 484 weights are not zero.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;One decision, by hand&lt;/h2&gt;

&lt;p&gt;This is the part I like most, because you can check it. Here is how reply B sets the vertical control. These comments and numbers are Claude&#39;s:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# unit 1: t = tanh(40*(vy_des - u2)), vertical velocity error
# vy_des = -0.06 - 0.21*u3 + 0.09*(u4 + u5)
W2[2, 1] = -40
W2[3, 1] = -8.4
W2[4, 1] = 3.6
W2[5, 1] = 3.6
b2[1] = -2.4&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Take one state. The craft is at x = 30, y = 40. It moves at vx = 0.1, vy = -0.2. Fuel is 200. The target is pad 3, at x = 80. The forward pass gives:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Action&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Logit&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Chance&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td&gt;none&lt;/td&gt;&lt;td&gt;0.000&lt;/td&gt;&lt;td&gt;0.0%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;thrust&lt;/td&gt;&lt;td&gt;9.995&lt;/td&gt;&lt;td&gt;99.6%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;left&lt;/td&gt;&lt;td&gt;-11.500&lt;/td&gt;&lt;td&gt;0.0%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;right&lt;/td&gt;&lt;td&gt;4.500&lt;/td&gt;&lt;td&gt;0.4%&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The desired vertical speed is about -0.095. The craft falls at -0.2, which is too fast, so thrust wins. The desired horizontal speed is about 0.35. The craft moves at 0.1, which is too slow, so right beats left. Right fires as soon as the fall speed is correct. You can read a control law directly from the weights.&lt;/p&gt;

&lt;h2&gt;Where it fails&lt;/h2&gt;

&lt;p&gt;A score of 100% can mean an easy task, so I changed the start state and left the rules alone. The prompt does not describe these start states. Each value is from 3,000 flights on new seeds.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Start state&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Plain program&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Reply A&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Reply B&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Reply C&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td&gt;Normal&lt;/td&gt;&lt;td&gt;99.8%&lt;/td&gt;&lt;td&gt;100.0%&lt;/td&gt;&lt;td&gt;100.0%&lt;/td&gt;&lt;td&gt;100.0%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Fuel 150&lt;/td&gt;&lt;td&gt;43.4%&lt;/td&gt;&lt;td&gt;59.0%&lt;/td&gt;&lt;td&gt;45.9%&lt;/td&gt;&lt;td&gt;61.8%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Fuel 100&lt;/td&gt;&lt;td&gt;29.5%&lt;/td&gt;&lt;td&gt;8.0%&lt;/td&gt;&lt;td&gt;0.1%&lt;/td&gt;&lt;td&gt;16.0%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Fuel 60&lt;/td&gt;&lt;td&gt;4.8%&lt;/td&gt;&lt;td&gt;0.0%&lt;/td&gt;&lt;td&gt;0.0%&lt;/td&gt;&lt;td&gt;0.0%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Start speed vx ± 1.0&lt;/td&gt;&lt;td&gt;69.2%&lt;/td&gt;&lt;td&gt;68.8%&lt;/td&gt;&lt;td&gt;68.7%&lt;/td&gt;&lt;td&gt;69.6%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Start at the far edge&lt;/td&gt;&lt;td&gt;82.8%&lt;/td&gt;&lt;td&gt;80.6%&lt;/td&gt;&lt;td&gt;80.5%&lt;/td&gt;&lt;td&gt;82.7%&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Fuel is the weak point. All three networks have an input for fuel, and all three set its weights to zero. Reply A says so: &quot;Fuel is enough, so I don&#39;t use the fuel input.&quot; That is correct for the normal start and false for these. The plain program ignores fuel too, and it still lands more often at fuel 100 and 60. I did not find the cause of that change.&lt;/p&gt;

&lt;p&gt;Some limits I want to be clear about:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Three Pads is easy. It has a direct 8-number state and a known control method. These results do not show that Claude can write networks for hard tasks.&lt;/li&gt;
  &lt;li&gt;The networks contain a control program in weight form. Nothing here shows this is better than a program.&lt;/li&gt;
  &lt;li&gt;The largest network I tested has 20,486 weights. These results say nothing about reading a large model. Singh tested Claude on Qwen weights with a baseline, and the gain was only +0.06 ± 0.02 in correlation.&lt;/li&gt;
  &lt;li&gt;The samples are small: one read reply, one control, one Breakout reply and three Three Pads replies.&lt;/li&gt;
  &lt;li&gt;No person has landed the craft by hand for these results. The browser test operates the controls, but it does not fly a full landing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Try it&lt;/h2&gt;

&lt;p&gt;To fly the craft, open the &lt;a href=&quot;https://mraad.github.io/weight-space-programming/lander/&quot;&gt;page&lt;/a&gt;. Set the pilot to You, then use the arrow keys. To watch a network, set the pilot to a Claude reply, then press 1, 2 or 3 during the flight.&lt;/p&gt;

&lt;p&gt;To reproduce the scores, you need &lt;code&gt;uv&lt;/code&gt; and Node. Do these steps. They do not call an LLM:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Clone the repository.
    &lt;pre&gt;&lt;code&gt;git clone https://github.com/mraad/weight-space-programming.git&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Go to the project folder.
    &lt;pre&gt;&lt;code&gt;cd weight-space-programming&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Install the dependencies.
    &lt;pre&gt;&lt;code&gt;uv sync&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Download the authors&#39; logs.
    &lt;pre&gt;&lt;code&gt;.venv/bin/python wsp.py fetch&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Reproduce their scores.
    &lt;pre&gt;&lt;code&gt;.venv/bin/python wsp.py verify&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Score the plain program on Three Pads.
    &lt;pre&gt;&lt;code&gt;node lander/eval.js controller&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;a href=&quot;https://mraad.github.io/weight-space-programming/docs/&quot;&gt;manual&lt;/a&gt; has the full method, all results, every procedure and 75 checked references.&lt;/p&gt;

&lt;h2&gt;What is next&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Add a true null control: random weights, and a prompt with no weights.&lt;/li&gt;
  &lt;li&gt;Run all four networks from the read experiment, three replies each.&lt;/li&gt;
  &lt;li&gt;Write a plain program for Breakout, because that is the fair baseline.&lt;/li&gt;
  &lt;li&gt;Make Three Pads harder with low fuel in the prompt, wind or rotation, and add a network trained with PPO.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So far, I can say this: Claude can derive a controller from source code and write it as weights, in one reply, with no feedback, and the result works on seeds it never saw. On my small problem, it did that three times out of three. That is not the same as understanding a large model, but it is a lot more than I expected. The code is on &lt;a href=&quot;https://github.com/mraad/weight-space-programming&quot;&gt;GitHub&lt;/a&gt; under MIT. More to come.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/16542226960152489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/16542226960152489' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/16542226960152489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/16542226960152489'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/11/three-pads-claude-writes-weights-no.html' title='Three Pads: Claude Writes the Weights, No Training'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-5873903332315249934</id><published>2026-11-04T11:33:21.022-05:00</published><updated>2026-11-04T11:33:21.023-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Knowledge"/><category scheme="http://www.blogger.com/atom/ns#" term="Rust"/><title type='text'>Loci: a landscape for your notes</title><content type='html'>&lt;p&gt;A post on r/secondbrain, &lt;a href=&quot;https://www.reddit.com/r/secondbrain/comments/1xmxw27/maps_organize_information_through_landscapes_why/&quot;&gt;Maps organize information through landscapes — why?&lt;/a&gt;, stopped me for a minute. It brought back &lt;a href=&quot;https://www.penguinrandomhouse.com/books/301277/moonwalking-with-einstein-by-joshua-foer/&quot;&gt;Moonwalking with Einstein&lt;/a&gt;, Joshua Foer&#39;s year with competitive memorizers, and the old trick at the center of it: put each thing you want to remember in a place, then walk the places. The Romans called the places &lt;em&gt;loci&lt;/em&gt;. I have a few thousand notes, clippings and links. I can search them when I remember a word. I cannot walk them. So I built a landscape for them and called it &lt;a href=&quot;https://github.com/mraad/loci&quot;&gt;Loci&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here is the idea in twenty notes. I imported twenty short Markdown files with tags and &lt;code&gt;[[wikilinks]]&lt;/code&gt;. They became five hills. I clicked one note, and then I orbited the terrain.&lt;/p&gt;

&lt;p style=&quot;text-align:center;&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/loci/main/assets/loci-demo.gif&quot; alt=&quot;Twenty linked ideas on the Loci terrain: five hills, one note selected with its connections, then a full orbit of the landscape&quot; style=&quot;max-width:640px;width:100%;&quot; /&gt;&lt;/p&gt;

&lt;h2&gt;What a hill is&lt;/h2&gt;

&lt;p&gt;Every note is a point. Notes that mean the same thing sit near each other. Groups of near notes become regions, and each region is a hill. The hill with the most notes is the tallest and the widest. Height is a count, not a judgment. A tall hill means you wrote a lot about that topic, not that the topic matters more. Contour rings follow the summed surface, so when two hills run together the rings wrap both of them, like a real ridge.&lt;/p&gt;

&lt;p style=&quot;text-align:center;&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/loci/main/docs/blog/loci-3d.jpg&quot; alt=&quot;3D terrain with five hills labeled Memory, Maps, Workflow, Semantics and Rediscovery; the note Method of Loci is selected and a side panel lists its nearby thoughts&quot; style=&quot;max-width:640px;width:100%;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Three signals place the notes:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Meaning.&lt;/strong&gt; A small sentence model, &lt;code&gt;all-MiniLM-L6-v2&lt;/code&gt;, turns each note into a 384-number vector. The quantized weights are about 23 MB. The model runs in the browser, on WebGPU when the machine has it and on WASM when it does not. Long notes are split into overlapping windows of 200 tokens, and the window vectors are averaged into one vector per note.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Words and tags.&lt;/strong&gt; A weighted vocabulary and shared tags carry notes that have no vector yet, and they add a little to notes that do.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Links.&lt;/strong&gt; A &lt;code&gt;[[wikilink]]&lt;/code&gt; is a solid connection. Loci resolves it by path, then by title or alias.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Regions come from farthest-first seeds followed by spherical k-means over the vectors. A small stress solver then arranges regions and notes so that related ones are near each other. The layout is deterministic: the same collection always gives the same map.&lt;/p&gt;

&lt;h2&gt;Two views, one geography&lt;/h2&gt;

&lt;p&gt;The 2D atlas and the 3D terrain use the same coordinates. A note keeps its place when you switch. The atlas is for finding. The terrain is for wandering. In 3D, left-drag orbits and right-drag pans. In 2D, drag pans.&lt;/p&gt;

&lt;p style=&quot;text-align:center;&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/loci/main/docs/blog/loci-2d.jpg&quot; alt=&quot;The 2D atlas: the same five regions seen from above, with contour rings, note labels and the connections of the selected note&quot; style=&quot;max-width:640px;width:100%;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Select a note and the panel shows its nearby thoughts: explicit links first, then the closest vectors. &lt;kbd&gt;Cmd&lt;/kbd&gt;+&lt;kbd&gt;K&lt;/kbd&gt; is full-text search. The &lt;em&gt;serendipity&lt;/em&gt; button opens a random saved note. That one is the point of the whole project. You do not need the title. You walk to the neighborhood, recognize a neighbor, and follow the path back.&lt;/p&gt;

&lt;h2&gt;How it is built&lt;/h2&gt;

&lt;p&gt;The interface is vanilla JavaScript. No framework, no bundler. One Rust crate, &lt;code&gt;loci-core&lt;/code&gt;, owns storage: SQLite with FTS5 for full-text search, sqlite-vec for cosine nearest neighbors, a small edge table for the graph, and a recursive SQL query for traversal. Imports are transactions. A bad note rolls the whole batch back.&lt;/p&gt;

&lt;p&gt;The same interface runs in two hosts. Tauri 2 gives the desktop app, with native folder dialogs and Apple Notes automation on macOS. An Axum server gives browser mode on loopback. The release binary embeds the interface, the model and the ONNX runtime, so it runs without Node or a checkout. Nothing calls a remote inference service. Your notes stay on your machine.&lt;/p&gt;

&lt;p style=&quot;text-align:center;&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/loci/main/docs/blog/loci-settings.jpg&quot; alt=&quot;The Settings dialog: Appearance, optional XYZ scaling sliders, and a Hill base slider at 2.50 times&quot; style=&quot;max-width:640px;width:100%;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;Hill base&lt;/em&gt; slider widens every footprint. At the default, neighboring hills run together into one meadow. Lower it and you get separate mountains with valleys between them.&lt;/p&gt;

&lt;h2&gt;Bring notes in&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Apple Notes.&lt;/strong&gt; The Mac app reads unlocked notes as plain text through macOS automation. Locked notes are skipped. Originals are never changed.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Obsidian vault.&lt;/strong&gt; Point it at a folder. Markdown, YAML tags, inline tags and wikilinks are read. A vault note is identified by its path inside the vault, so moving the folder does not duplicate anything.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Markdown or text files&lt;/strong&gt;, and a &lt;strong&gt;JSON backup&lt;/strong&gt; from a previous export.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Imports are snapshots. Reimport a source and its copy updates. Edit a note and its vector is dropped until you refine the landscape again. The current limits are 5,000 notes, 2 MB per note and 64 regions.&lt;/p&gt;

&lt;h2&gt;What it does not claim&lt;/h2&gt;

&lt;p&gt;Distances are approximate. The projection, the clustering and the space reserved for the hills all distort something. MiniLM is a compact English model, not the best multilingual one, and I chose it to keep the install small. Above 600 notes the layout samples candidate pairs instead of comparing every pair, so nearest-neighbor accuracy drops for big vaults. The demo above has twenty notes and no embeddings at all; it is the vocabulary map. The real test is your own notes, and I have not measured anything beyond &quot;I found things I had forgotten.&quot;&lt;/p&gt;

&lt;h2&gt;Try it&lt;/h2&gt;

&lt;p&gt;Clone &lt;a href=&quot;https://github.com/mraad/loci&quot;&gt;github.com/mraad/loci&lt;/a&gt;. Then:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;npm ci --ignore-scripts
npm run setup:embeddings
npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Open &lt;code&gt;http://127.0.0.1:4173&lt;/code&gt;. Import a folder of Markdown. Open Settings. Click &lt;em&gt;Refine semantic landscape&lt;/em&gt;. Then orbit.&lt;/p&gt;

&lt;p&gt;Next is a larger evaluation on a few hundred labeled note pairs, and a multilevel atlas for collections that outgrow 64 hills. More to come :-)&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/5873903332315249934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/5873903332315249934' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/5873903332315249934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/5873903332315249934'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/11/loci-landscape-for-your-notes.html' title='Loci: a landscape for your notes'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-5039629953099359949</id><published>2026-11-04T11:31:42.288-05:00</published><updated>2026-11-04T11:31:42.288-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Computer Vision"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><title type='text'>TrackAnything: Click an Object, and a DGX Spark Follows It</title><content type='html'>&lt;p&gt;I want to point my Mac camera at a scene, click an object, and see a mask stay on that object while it moves. I do not want to train a model for each object. I also want to run the model on my own hardware, not on a hosted API.&lt;/p&gt;
&lt;p&gt;Segment Anything models can do this. You select an object one time, with a point, a box or a name. The model then finds the same object in each new frame and marks its pixels. This marked area is the mask.&lt;/p&gt;
&lt;p&gt;The project is &lt;a href=&quot;https://github.com/mraad/TrackAnything&quot;&gt;TrackAnything&lt;/a&gt;. It runs three trackers (EfficientTAM, SAM 2.1 and SAM 3) on an NVIDIA DGX Spark. The Mac only shows the camera and the result. In this post, I show how the pieces fit together, what the numbers say, and where the method is wrong.&lt;/p&gt;
&lt;figure&gt;
&lt;img src=&quot;https://raw.githubusercontent.com/mraad/TrackAnything/main/docs/img/traffic.gif&quot; alt=&quot;Cars and trucks on a motorway. Each vehicle has a mask in its own colour.&quot; width=&quot;560&quot; /&gt;
&lt;figcaption&gt;Vehicles on a motorway, tracked with EfficientTAM-S. The detector runs again every 15 frames, so new vehicles get a mask. Video: &lt;a href=&quot;https://commons.wikimedia.org/wiki/File:Motorway_A40_-_on_bridge_above_the_traffic.webm&quot;&gt;&quot;Motorway A40 - on bridge above the traffic&quot;&lt;/a&gt; by Kathinka Engels / Sounds of Changes, &lt;a href=&quot;https://creativecommons.org/licenses/by/3.0&quot;&gt;CC BY 3.0&lt;/a&gt;, via Wikimedia Commons. Changes: audio removed, trimmed to 10 seconds from 0:06, resized, frame rate reduced, masks added.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;What it does&lt;/h2&gt;
&lt;p&gt;The project has three tools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Offline benchmark&lt;/strong&gt; (&lt;code&gt;track.py&lt;/code&gt;). It tracks objects through a video file, measures the speed and writes a video with the masks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Live app&lt;/strong&gt; (&lt;code&gt;live.py&lt;/code&gt; and &lt;code&gt;live.html&lt;/code&gt;). The Mac camera sends frames to the DGX Spark. The browser shows the masks on the live video.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Personal data removal&lt;/strong&gt; (&lt;code&gt;tools/anonymize.py&lt;/code&gt;). It prepares a phone video for use as a public sample. It keeps the subject sharp, blurs the rest, pixelates text and faces on the subject, and removes the metadata and the sound.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;How the tracker works&lt;/h2&gt;
&lt;p&gt;These models do not detect objects and then match them between frames. They do segmentation with memory. Each frame goes through these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The image encoder changes the frame into a grid of features. This step uses most of the compute.&lt;/li&gt;
&lt;li&gt;On the first frame, the mask decoder uses your point or box to make the first mask.&lt;/li&gt;
&lt;li&gt;On the next frames, the features attend to a memory bank. The memory bank holds the prompt frame, 6 recent frames with their masks, and up to 16 object pointers.&lt;/li&gt;
&lt;li&gt;The mask decoder makes a grid of logits. A logit above 0 means &quot;object&quot;.&lt;/li&gt;
&lt;li&gt;The memory encoder combines the new mask with the features. The result goes into the memory bank for the next frame.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;EfficientTAM keeps the SAM 2 design and changes two parts. It uses a small plain ViT as the image encoder, and it makes memory attention less expensive. On the Spark, this gives approximately 4 times the speed of SAM 2.1 small in the live app.&lt;/p&gt;
&lt;h2&gt;The live data path&lt;/h2&gt;
&lt;p&gt;All traffic goes through one SSH tunnel, and the server binds to 127.0.0.1 only. The browser gives camera access only to pages from &lt;code&gt;localhost&lt;/code&gt; or HTTPS. The tunnel makes the page a &lt;code&gt;localhost&lt;/code&gt; page on the Mac.&lt;/p&gt;
&lt;p&gt;For each frame:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The page captures the camera, at most 640 pixels wide.&lt;/li&gt;
&lt;li&gt;The page sends one JPEG over a WebSocket.&lt;/li&gt;
&lt;li&gt;The Spark decodes the JPEG on the GPU with nvJPEG.&lt;/li&gt;
&lt;li&gt;The tracker runs on the frame.&lt;/li&gt;
&lt;li&gt;The server sends the low-resolution logits back as raw float16 values.&lt;/li&gt;
&lt;li&gt;A WebGL2 shader on the Mac upsamples the logits and draws the mask over the video.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The page sends the next frame when the reply arrives. There is one frame in flight, so there is no queue. The camera preview does not depend on the server. If the server stops, the video continues.&lt;/p&gt;
&lt;p&gt;Why raw logits? I first tried uint8, because it is smaller. The clamped values moved the mask edges, and the IoU with the server mask fell to 0.91. With float16, the shader gives the same mask as the server (IoU 1.0 over 100 frames). The cost is 32 KiB per object per frame for EfficientTAM.&lt;/p&gt;
&lt;p&gt;EfficientTAM has no streaming API, only an offline video predictor. So &lt;code&gt;live.py&lt;/code&gt; adds each frame to the video state and runs the predictor on that one frame. It also removes history older than 16 frames. Without corrections, memory use and latency stay constant for any track length.&lt;/p&gt;
&lt;figure&gt;
&lt;img src=&quot;https://raw.githubusercontent.com/mraad/TrackAnything/main/docs/img/ui_multi.jpg&quot; alt=&quot;Live app with one albatross in blue and the other in orange, and two object chips in the selection panel&quot; width=&quot;600&quot; /&gt;
&lt;figcaption&gt;The live app with two objects from two boxes, EfficientTAM-S. The test camera shows a public-domain video. Video: &lt;a href=&quot;https://commons.wikimedia.org/wiki/File:Schwarzfu%C3%9Falbatros_(Phoebastria_nigripes),_Paarungstanz_(Balz)_im_Midway_Atoll_National_Wildlife_Refuge.webm&quot;&gt;&quot;Black-footed albatross mating dance&quot;&lt;/a&gt; by USFWS Pacific Region, video by volunteer Dan Rapp, public domain, via Wikimedia Commons.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;Try it&lt;/h2&gt;
&lt;p&gt;You need SSH access to a GPU host, with &lt;code&gt;uv&lt;/code&gt; installed. My host is &lt;code&gt;spark2&lt;/code&gt;. To use a different host, set &lt;code&gt;HOST&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To track one object in a video file, do this step:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;./run_spark2.sh data/albatross.mp4 --point 470,260 --out results/birds.mp4
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To use the live app, do these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;./live_spark2.sh --model etam-s&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Wait for the browser to open &lt;code&gt;http://localhost:8765&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Allow camera access.&lt;/li&gt;
&lt;li&gt;Click an object, or drag a box around it.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To stop the live app, run &lt;code&gt;pkill -f live_spark2.sh&lt;/code&gt;. This command also stops the server on the host.&lt;/p&gt;
&lt;h2&gt;What the numbers say&lt;/h2&gt;
&lt;p&gt;Offline, on the Spark, with one object on 300 frames at 960 × 540:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;FPS (3 runs)&lt;/th&gt;
&lt;th&gt;Peak GPU memory&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;EfficientTAM-S&lt;/td&gt;
&lt;td&gt;94.3 / 78.5 / 102.9&lt;/td&gt;
&lt;td&gt;1282 MiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EfficientTAM-Ti&lt;/td&gt;
&lt;td&gt;111.0 / 93.6 / 112.3&lt;/td&gt;
&lt;td&gt;1218 MiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SAM 3 tracker&lt;/td&gt;
&lt;td&gt;2.7 / 2.7 / 2.7&lt;/td&gt;
&lt;td&gt;9344 MiB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Live, over the WebSocket, on 640 × 360 frames. The test client ran on the Spark, so these values do not include the network:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Throughput&lt;/th&gt;
&lt;th&gt;Round trip (median)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;EfficientTAM-Ti&lt;/td&gt;
&lt;td&gt;93.0 FPS&lt;/td&gt;
&lt;td&gt;9.7 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EfficientTAM-S&lt;/td&gt;
&lt;td&gt;83.4 FPS&lt;/td&gt;
&lt;td&gt;10.9 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SAM 2.1 small&lt;/td&gt;
&lt;td&gt;19.2 FPS&lt;/td&gt;
&lt;td&gt;50.7 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SAM 3 tracker&lt;/td&gt;
&lt;td&gt;2.9 FPS&lt;/td&gt;
&lt;td&gt;341 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;In the browser, the camera frame rate is the limit, usually 30 FPS.&lt;/p&gt;
&lt;p&gt;SAM 3 runs at approximately 1/38 of the speed of EfficientTAM-S. But it gives a better mask on this clip. It keeps the spread wing of the bird, and EfficientTAM-S loses part of the wing in some frames. Speed is not free.&lt;/p&gt;
&lt;figure&gt;
&lt;img src=&quot;https://raw.githubusercontent.com/mraad/TrackAnything/main/docs/img/offline.jpg&quot; alt=&quot;Four frames of two albatrosses dancing, with the left bird marked in blue&quot; width=&quot;600&quot; /&gt;
&lt;figcaption&gt;One point on the left bird in frame 0, EfficientTAM-S. The mask follows the bird, but it does not include all of the dark wing in some frames.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;More objects cost more time. The image encoder runs one time for each frame, but memory attention and the mask decoder run for each object. EfficientTAM-S gives 102, 62 and 35 FPS for 1, 2 and 4 objects. This is why the live app stops at 8 objects.&lt;/p&gt;
&lt;h2&gt;Find objects by name&lt;/h2&gt;
&lt;p&gt;A click needs a person. A name does not. I type &lt;code&gt;dark bird&lt;/code&gt;, and a detector finds the boxes on one frame. Each box becomes a prompt, and the tracker follows the object after that. This is the Grounded-SAM-2 pattern: detect one time, then track.&lt;/p&gt;
&lt;p&gt;I compared detectors on the same clip, with three objects on three frames:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Detector&lt;/th&gt;
&lt;th&gt;Box IoU&lt;/th&gt;
&lt;th&gt;Time (bf16)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Grounding DINO tiny&lt;/td&gt;
&lt;td&gt;0.846&lt;/td&gt;
&lt;td&gt;207 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MM Grounding DINO tiny&lt;/td&gt;
&lt;td&gt;0.868&lt;/td&gt;
&lt;td&gt;207 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LLMDet tiny (used)&lt;/td&gt;
&lt;td&gt;0.866&lt;/td&gt;
&lt;td&gt;208 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LLMDet base&lt;/td&gt;
&lt;td&gt;0.878&lt;/td&gt;
&lt;td&gt;243 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OmDet-Turbo tiny&lt;/td&gt;
&lt;td&gt;0.540&lt;/td&gt;
&lt;td&gt;33 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SAM 3 image model&lt;/td&gt;
&lt;td&gt;0.894&lt;/td&gt;
&lt;td&gt;685 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;I use LLMDet tiny. It has an Apache 2.0 license, and it needs no new dependency. OmDet-Turbo is 6 times faster, but it did not find &lt;code&gt;rocks&lt;/code&gt;, and that gives it the low IoU. The detector runs one time for each query, so 0.2 seconds is acceptable. The first query takes 5.7 seconds, because it loads the detector. After that, the first mask comes in 232 to 243 ms, and two objects track at 57 to 58 FPS.&lt;/p&gt;
&lt;p&gt;I did not use YOLO or YOLOE. They are AGPL-3.0, and I have no Ultralytics license.&lt;/p&gt;
&lt;p&gt;The detector can be wrong. In one test, the query &lt;code&gt;rocks&lt;/code&gt; found the rock pile and also a white bird. Always look at the masks.&lt;/p&gt;
&lt;figure&gt;
&lt;img src=&quot;https://raw.githubusercontent.com/mraad/TrackAnything/main/docs/img/garbage_cans.gif&quot; alt=&quot;Two garbage cans tracked in blue and orange while the camera moves round them&quot; width=&quot;240&quot; /&gt;
&lt;figcaption&gt;The query &lt;code&gt;garbage can . trash can&lt;/code&gt; found both cans on frame 0. EfficientTAM-S tracked them at 61.9 FPS. This clip is a phone video. The personal data removal tool blurred the street and pixelated the house numbers on the cans.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;Correct a track&lt;/h2&gt;
&lt;p&gt;Tracks go wrong. In the live app, Shift+click adds an area and Alt+click removes one. My first version only added these points to the current frame, and it did not work. On a frame that the model already tracked, memory attention overrides the clicks. SAM 2.1 kept a mask of 1.8% of the frame with two add points on the object.&lt;/p&gt;
&lt;p&gt;The fix has three parts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The frame runs again as a new prompt frame, without memory attention.&lt;/li&gt;
&lt;li&gt;The current logits go into the mask decoder with the points. This is the interactive refinement that SAM is trained for.&lt;/li&gt;
&lt;li&gt;The older memory of that object goes away. If it stays, it cancels the correction after a few frames.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The same function does this for the live app and for &lt;code&gt;track.py&lt;/code&gt;. With &lt;code&gt;--fix-box&lt;/code&gt;, you set a new box on a later frame, and the tracker runs again from there:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;./run_spark2.sh data/albatross.mp4 --point 470,260 --fix-box 75:1:548,172,742,315
&lt;/code&gt;&lt;/pre&gt;
&lt;figure&gt;
&lt;img src=&quot;https://raw.githubusercontent.com/mraad/TrackAnything/main/docs/img/offline_fix.jpg&quot; alt=&quot;Six frames of two albatrosses: the top row tracks the left bird, the bottom row moves the track to the right bird at frame 75&quot; width=&quot;600&quot; /&gt;
&lt;figcaption&gt;Top: one point on the left bird. Bottom: the same point and a new box at frame 75. The frames before frame 75 do not change. This run gives 44.5 FPS for the two passes.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The models do not agree on correction points. Two add points on the other bird move the track to that bird on EfficientTAM-S. EfficientTAM-Ti and SAM 2.1 ignore them. Two remove points on a bird leave 40% of the bird on EfficientTAM-S, 64% on EfficientTAM-Ti and 6% on SAM 2.1. SAM selects one object here, so a remove point cuts the object. It does not separate two objects.&lt;/p&gt;
&lt;h2&gt;Objects that come in later&lt;/h2&gt;
&lt;p&gt;Detect one time, then track, has a clear problem. An object that comes into the frame later has no mask. On the motorway clip, cars come onto the right road from under the bridge. The cars that come after frame 0 had no mask.&lt;/p&gt;
&lt;p&gt;The option &lt;code&gt;--redetect 15&lt;/code&gt; runs the detector every 15 frames. The hard part is duplicates, because the detector finds the tracked objects again.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Known boxes.&lt;/strong&gt; The tool ignores a box that has a box IoU of 0.5 or more with the box of a tracked mask.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;New masks.&lt;/strong&gt; A new box becomes an object for one frame. If another mask covers 50% or more of the smaller mask, the tool removes the new object.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ended tracks.&lt;/strong&gt; The tool ends a track after 15 frames with an empty mask.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Background.&lt;/strong&gt; The tool also ends a track when its mask covers 25% or more of the frame. On one wide clip, a mask covered all of the ground.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My first rule was wrong. I treated a box that contained most of a mask as a known box. A test showed the error: when one object stands in front of another, its box contains the mask of the second object. The first object then gets no track. So now only the first mask decides.&lt;/p&gt;
&lt;figure&gt;
&lt;img src=&quot;https://raw.githubusercontent.com/mraad/TrackAnything/main/docs/img/redetect.jpg&quot; alt=&quot;Four frames of a motorway. Top row: cars on the right road have no mask. Bottom row: the same frames, and the cars on the right road have masks.&quot; width=&quot;600&quot; /&gt;
&lt;figcaption&gt;Top: one detection on frame 0. Bottom: &lt;code&gt;--redetect 15&lt;/code&gt;. Same video and credit as the first figure, cropped.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;On the motorway clip, this gives 52 objects at 2.0 FPS, against 19 objects at 3.8 FPS with one detection. The detector is not the cost. It uses 4.4 of the 149 seconds. Most of the time is memory attention for each object. It also removed 217 duplicates, so the check does real work.&lt;/p&gt;
&lt;h2&gt;Limits&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The server has one shared tracker, so it accepts one viewer at a time. A second tab shows &quot;Busy · retrying&quot;.&lt;/li&gt;
&lt;li&gt;The server has no password. It accepts pages from &lt;code&gt;localhost&lt;/code&gt; only. Programs on the Mac and on the host can connect.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--redetect&lt;/code&gt; is offline only. In the live app, the detector would stop the frame loop for 0.2 seconds each time.&lt;/li&gt;
&lt;li&gt;In a dense group, masks join. An object that goes away for more than 15 frames gets a new number.&lt;/li&gt;
&lt;li&gt;The detector took a road sign for a vehicle on the motorway clip.&lt;/li&gt;
&lt;li&gt;The personal data removal needs a check by a person. It can miss text.&lt;/li&gt;
&lt;li&gt;I judged duplicates from sample frames. I did not measure them on each frame.&lt;/li&gt;
&lt;li&gt;The test suite has 37 tests on EfficientTAM-S. On SAM 2.1 and EfficientTAM-Ti, I ran only part of it.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;What is next&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Tracking by detection without YOLO: an Apache or MIT detector on each frame, plus MIT ByteTrack, for crowds where speed is more important than identity.&lt;/li&gt;
&lt;li&gt;A way to use periodic detection in the live app without a stop in the frame loop.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The code is on GitHub at &lt;a href=&quot;https://github.com/mraad/TrackAnything&quot;&gt;mraad/TrackAnything&lt;/a&gt;, under Apache 2.0. The full manual is &lt;code&gt;docs/index.html&lt;/code&gt; in the repository. It has the procedures, the WebSocket messages and the test results.&lt;/p&gt;
&lt;p&gt;More to come.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/5039629953099359949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/5039629953099359949' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/5039629953099359949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/5039629953099359949'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/11/trackanything-click-object-and-dgx.html' title='TrackAnything: Click an Object, and a DGX Spark Follows It'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-7531013824790430565</id><published>2026-10-29T10:18:42.000-04:00</published><updated>2026-11-20T05:51:05.765-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS"/><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><title type='text'>Maps in the Claude Code Terminal</title><content type='html'>&lt;p style=&quot;border-left:4px solid #e4572e;padding:8px 12px;background:rgba(228,87,46,0.08)&quot;&gt;&lt;b&gt;Update, November 2026:&lt;/b&gt; This project is now part of map-pane. One skill drives the same live map from Claude Code, Codex and Pi. Read the current post: &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/11/map-pane-one-live-map-for-claude-code.html&quot;&gt;map-pane: one live map for Claude Code, Codex and Pi&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I use Claude Code for GIS work. When I ask it for a map, I get a URL or a file path. I want to see the map. So I built a plugin that draws it in the terminal.&lt;/p&gt;

&lt;p&gt;The idea came from &lt;a href=&quot;https://github.com/kbrianps/claude-inline-images&quot;&gt;claude-inline-images&lt;/a&gt; by kbrianps. It draws PNG files that Claude reads. I wanted the same result for map services. The plugin is &lt;a href=&quot;https://github.com/mraad/claude-inline-maps&quot;&gt;inline-maps&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://raw.githubusercontent.com/mraad/claude-inline-maps/main/docs/images/xyz-opentopo.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/claude-inline-maps/main/docs/images/xyz-opentopo.png&quot; alt=&quot;OpenTopoMap tiles of North America, stitched into one map image&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;What it is&lt;/h3&gt;

&lt;p&gt;Claude Code loads the plugin at session start. Claude Code calls this type of plugin a &quot;mod&quot;. The mod API is early access. You need Claude Code 2.1.287 or later.&lt;/p&gt;

&lt;p&gt;The plugin adds two things:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;A tool, &lt;code&gt;show_map&lt;/code&gt;. Claude calls it when you ask for a map.&lt;/li&gt;
  &lt;li&gt;A command, &lt;code&gt;/map&lt;/code&gt;. You type it at the prompt.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both use the same function. Only the way they return the result is different.&lt;/p&gt;

&lt;h3&gt;Which map services it reads&lt;/h3&gt;

&lt;p&gt;The plugin reads the URL and identifies the type of map service. Then it makes one request for a map image, or one request for each tile. It tests the patterns in the order of the table.&lt;/p&gt;

&lt;table border=&quot;1&quot; cellpadding=&quot;6&quot; cellspacing=&quot;0&quot;&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th&gt;Map service&lt;/th&gt;&lt;th&gt;URL pattern&lt;/th&gt;&lt;th&gt;Request&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td&gt;XYZ / WMTS RESTful tiles&lt;/td&gt;&lt;td&gt;&lt;code&gt;{z}&lt;/code&gt; or &lt;code&gt;{TileMatrix}&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Up to 4 × 4 tiles&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;ArcGIS MapServer&lt;/td&gt;&lt;td&gt;&lt;code&gt;…/MapServer&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;export&lt;/code&gt;, PNG32&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;ArcGIS ImageServer&lt;/td&gt;&lt;td&gt;&lt;code&gt;…/ImageServer&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;exportImage&lt;/code&gt;, PNG&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;OGC API - Maps&lt;/td&gt;&lt;td&gt;&lt;code&gt;…/collections/…&lt;/code&gt; or &lt;code&gt;…/map&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;…/map?f=png&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;OGC WMS 1.1.1 / 1.3.0&lt;/td&gt;&lt;td&gt;&lt;code&gt;service=wms&lt;/code&gt; or &lt;code&gt;/wms&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;GetCapabilities&lt;/code&gt;, then &lt;code&gt;GetMap&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;If no pattern matches, the plugin tries WMS first. If WMS fails, it tries OGC API - Maps.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://raw.githubusercontent.com/mraad/claude-inline-maps/main/docs/images/wms-europe.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/claude-inline-maps/main/docs/images/wms-europe.png&quot; alt=&quot;OpenStreetMap WMS map image of Europe with country labels and roads&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
OGC WMS 1.3.0 &lt;code&gt;GetMap&lt;/code&gt;, layer &lt;code&gt;OSM-WMS&lt;/code&gt;, &lt;code&gt;bbox=-10,35,30,60&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;How it works&lt;/h3&gt;

&lt;p&gt;One function, &lt;code&gt;show()&lt;/code&gt;, does these steps for the tool and for the command.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;b&gt;Plan.&lt;/b&gt; &lt;code&gt;plan()&lt;/code&gt; identifies the map service. It reads the service metadata as text. It returns one image URL or a list of tile URLs. It makes no host API calls, so the tests give it fixed responses.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Size.&lt;/b&gt; &lt;code&gt;plan()&lt;/code&gt; sets the image size from the ground distance. One degree of longitude is shorter than one degree of latitude, by the cosine of the latitude. Without this step, the map looks stretched.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Download.&lt;/b&gt; &lt;code&gt;curl&lt;/code&gt; gets each URL into a temporary directory. I use &lt;code&gt;curl&lt;/code&gt; because the host function &lt;code&gt;$.http.fetch&lt;/code&gt; returns text only.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Check.&lt;/b&gt; The plugin accepts a body only if the HTTP status is 2xx and the bytes are a PNG. Some tile servers send an error tile as a PNG, so the PNG check alone is not enough.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Stitch.&lt;/b&gt; For tiles, &lt;code&gt;magick montage&lt;/code&gt; joins them into one PNG.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Cache.&lt;/b&gt; The plugin keeps the last 12 images in memory as base64.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Draw.&lt;/b&gt; A &lt;code&gt;ui.render&lt;/code&gt; hook replaces the transcript row with the image, a caption and a file link. The terminal draws the image with the kitty graphics protocol.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Two details that cost me time&lt;/h3&gt;

&lt;p&gt;First, ArcGIS keeps square pixels. WMS and OGC API - Maps stretch the image to the size you request. ArcGIS does not. For an extent in degrees, I request &lt;code&gt;imageSR=3857&lt;/code&gt; (Web Mercator) and size the image with the Mercator aspect ratio. For WMS and OGC API, I keep EPSG:4326 and multiply the width by the cosine of the middle latitude.&lt;/p&gt;

&lt;p&gt;Second, WMS 1.3.0 changes the axis order. For EPSG:4326, version 1.3.0 uses latitude, longitude. Version 1.1.1 uses longitude, latitude. The plugin swaps the bounding box for 1.3.0.&lt;/p&gt;

&lt;h3&gt;Markers&lt;/h3&gt;

&lt;p&gt;You can put a red pin on the map. Give the point as &lt;code&gt;marker=lon,lat[,label]&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/map https://tile.openstreetmap.org/{z}/{x}/{y}.png bbox=2.22,48.81,2.47,48.91 marker=2.2945,48.8584,Eiffel Tower&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href=&quot;https://raw.githubusercontent.com/mraad/claude-inline-maps/main/docs/images/xyz-marker.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/claude-inline-maps/main/docs/images/xyz-marker.png&quot; alt=&quot;OpenStreetMap map of Paris with a red pin on the Eiffel Tower&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each plan carries a frame: the extent in degrees, and whether the image rows are in degrees or in Mercator. &lt;code&gt;markerPixel()&lt;/code&gt; uses the frame to convert the point to a pixel. Then &lt;code&gt;magick -draw&lt;/code&gt; draws the pin. The label goes in the caption, not on the image. ImageMagick has no default font on my machine, and &lt;code&gt;-annotate&lt;/code&gt; would read a label that starts with &lt;code&gt;@&lt;/code&gt; as a file name.&lt;/p&gt;

&lt;h3&gt;Terminals&lt;/h3&gt;

&lt;table border=&quot;1&quot; cellpadding=&quot;6&quot; cellspacing=&quot;0&quot;&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th&gt;Terminal&lt;/th&gt;&lt;th&gt;Result&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td&gt;Ghostty&lt;/td&gt;&lt;td&gt;Map image&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;kitty&lt;/td&gt;&lt;td&gt;Map image&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;tmux with passthrough&lt;/td&gt;&lt;td&gt;Map image&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;tmux without passthrough&lt;/td&gt;&lt;td&gt;Caption and file path&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Other terminals&lt;/td&gt;&lt;td&gt;Caption and file path&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;For tmux, add these lines to &lt;code&gt;~/.tmux.conf&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;set -g allow-passthrough on
set -g focus-events on&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Limits&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;PNG only. A JPEG tile server gives an error.&lt;/li&gt;
  &lt;li&gt;The plugin sends no tokens. A map service that needs authentication gives an error.&lt;/li&gt;
  &lt;li&gt;Each download stops at 4 MiB or 20 s.&lt;/li&gt;
  &lt;li&gt;A map image larger than 2 MiB draws from its file path. SSH and tmux do not show it.&lt;/li&gt;
  &lt;li&gt;The desktop app, VS Code and mobile show text.&lt;/li&gt;
  &lt;li&gt;The tests use fixed responses. They do not cover &lt;code&gt;curl&lt;/code&gt;, &lt;code&gt;magick&lt;/code&gt; or the terminal output.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Install&lt;/h3&gt;

&lt;p&gt;You need Claude Code 2.1.287 or later, and &lt;code&gt;curl&lt;/code&gt;. For tiles, you also need ImageMagick. Add the marketplace:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;claude plugin marketplace add mraad/claude-inline-maps&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Install the plugin:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;claude plugin install inline-maps@claude-inline-maps&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Start a new Claude Code session. Then type &lt;code&gt;/map&lt;/code&gt; and a map service URL.&lt;/p&gt;

&lt;p&gt;The code is on GitHub: &lt;a href=&quot;https://github.com/mraad/claude-inline-maps&quot;&gt;mraad/claude-inline-maps&lt;/a&gt;. Next, I want to test more WMS servers. Tell me which one breaks it.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/7531013824790430565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/7531013824790430565' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/7531013824790430565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/7531013824790430565'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/10/maps-in-claude-code-terminal.html' title='Maps in the Claude Code Terminal'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-2479808160340191342</id><published>2026-10-26T09:43:48.000-04:00</published><updated>2026-10-26T16:50:34.579-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Computer Vision"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><title type='text'>Clay Explorer: Point at One Tank, Find the Others</title><content type='html'>&lt;p&gt;In my last post, &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/10/where-is-jev-find-tile-then-detect-tank.html&quot;&gt;Where Is Jev?&lt;/a&gt;, I found storage tanks in an overhead image. I asked a vision-language model one fixed question about each tile, and SAM 3 found the tanks in the tiles that passed. This time, I want to try the opposite approach. I do not ask a question, and I do not write a prompt. I point at one tank, and the app finds the chips that look like it.&lt;/p&gt;

&lt;p&gt;The tool is &lt;a href=&quot;https://github.com/mraad/clay-explorer&quot;&gt;Clay Embedding Explorer&lt;/a&gt;, a small web app that I built around the &lt;a href=&quot;https://github.com/Clay-foundation/model&quot;&gt;Clay v1.5&lt;/a&gt; foundation model. It shows chip embeddings on a map, over the source image. In this post, I explain what an embedding is here, how the pipeline works, and what the tank numbers say. One of the numbers looked bad at first, and the reason was more interesting than the number.&lt;/p&gt;

&lt;h2&gt;The image and the labels&lt;/h2&gt;

&lt;p&gt;I use the same image as last time: one RGB GeoTIFF, 8,200 × 6,087 pixels at 0.5 m per pixel, in EPSG:3857. Web Mercator stretches distances, so the true ground size of one pixel at this latitude is 0.457 m. A FileGDB has 97 hand-drawn tank polygons. The labels are complete only inside one extent polygon, which covers 82% of the image. I use the labels to score the results. The pipeline never sees them.&lt;/p&gt;

&lt;h2&gt;What Clay gives me&lt;/h2&gt;

&lt;p&gt;Clay v1.5 is an open foundation model for Earth observation from the Clay Foundation, under Apache 2.0. Its encoder is a vision transformer (ViT-L, 24 blocks). It was pretrained as a masked autoencoder with a DINOv2 teacher, on chips of 256 pixels. The input is a chip plus sensor information: band wavelengths, ground sample distance, time and location. The output is one vector of 1,024 numbers per chip (the class token). I call this vector an embedding.&lt;/p&gt;

&lt;p&gt;Chips with similar ground should have embeddings that point in similar directions. Cosine similarity measures that direction. Nothing guarantees that a similar direction means the same object. That is what I want to test.&lt;/p&gt;

&lt;h2&gt;How it works&lt;/h2&gt;

&lt;p&gt;The pipeline is two Python scripts and a static web page.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Cut.&lt;/strong&gt; Divide the image into square chips of 128 pixels, about 58 m on the ground. The last row and column move inward to the image edge, so there is no padding. This image gives 3,120 chips.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Embed.&lt;/strong&gt; Run each chip through the Clay encoder. For 8-bit RGB aerial imagery, I use the &lt;code&gt;linz&lt;/code&gt; sensor profile, the closest sensor that Clay knows. The acquisition date is unknown, so I set the time and location inputs to zero. Clay training does the same for 20% of its chips. The 3,120 chips take 50 seconds on the GPU of an Apple M4 Max.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Centre.&lt;/strong&gt; Subtract the mean embedding of the scene, then scale each embedding to length 1. Without this step, all chips of one scene look alike. On this image, the median cosine between two chips is 0.79. After centring, the median is −0.03, and the values spread from −0.68 to almost 1. Cosine similarity then becomes a dot product.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Summarize.&lt;/strong&gt; Calculate a PCA colour for each chip and k-means clusters for k = 2 to 8. Then calculate DBSCAN clusters at five density settings, on a 10-dimension PCA projection.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Export.&lt;/strong&gt; Write four files: &lt;code&gt;chips.geojson&lt;/code&gt;, &lt;code&gt;embeddings.f32&lt;/code&gt; (raw float32, 3,120 × 1,024, 12.8 MB), &lt;code&gt;image.jpg&lt;/code&gt; and &lt;code&gt;meta.json&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Serve.&lt;/strong&gt; Use any static web server. The browser does the similarity search: a dot product of the query against all 3,120 embeddings, in plain JavaScript.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Only the embed step needs a GPU, and it also runs on a CPU at about a quarter of the speed. After the export, everything runs in the browser. There is no inference server and no vector database. At this size, a loop over a &lt;code&gt;Float32Array&lt;/code&gt; is fast enough.&lt;/p&gt;

&lt;h2&gt;The app&lt;/h2&gt;

&lt;p&gt;The app is VanillaJS on the &lt;a href=&quot;https://developers.arcgis.com/javascript/latest/&quot;&gt;ArcGIS Maps SDK for JavaScript&lt;/a&gt; 5.1, with Calcite components. Both load from the Esri CDN, so there is no build step and no API key. The image is a &lt;code&gt;MediaLayer&lt;/code&gt;, and the chips are graphics in one &lt;code&gt;GraphicsLayer&lt;/code&gt;. The app has three views:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Spectrum&lt;/strong&gt; shows the first three PCA components of each embedding as red, green and blue.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Similar&lt;/strong&gt; colours each chip by its cosine similarity to the selected chip, from red (least similar) to green (most similar). It also lists the six closest chips. A second mode takes two chips, A and B, and searches with A + B, A − B or the element-wise product A × B. These operations are exploratory. The model does not promise that A − B means anything visual.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Clusters&lt;/strong&gt; shows the k-means or DBSCAN clusters. Select a cluster to show only that cluster.&lt;/li&gt;
&lt;/ul&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/clay-explorer/main/docs/images/spectrum.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/clay-explorer/main/docs/images/spectrum.jpg&quot; alt=&quot;Spectrum view of the tank image: each chip coloured by the first three PCA components of its embedding.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;Spectrum on the tank image. The three components explain 21%, 11% and 8% of the variance. The tanks are lavender, the roads are purple, and the open ground is orange and pink.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;I like Spectrum as a first look. No label went into it, and the tanks still come out in a similar colour.&lt;/p&gt;

&lt;h2&gt;Point at one tank&lt;/h2&gt;

&lt;p&gt;I did not want to pick the chip that makes the best picture. So I picked it by a rule. 78 chips hold the centre of a labelled tank. Of these, chip 1313 has the median score for base Clay, and its tank is closest to the chip centre.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/clay-explorer/main/docs/images/similar-base.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/clay-explorer/main/docs/images/similar-base.jpg&quot; alt=&quot;Similar view with base Clay: chip 1313 selected, chips coloured from red to green by cosine similarity, and the six closest chips listed.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;Similar with base Clay. Chip 1313 has the white outline. Green chips are the most similar.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;I also fine-tuned the encoder on this image. I call the result M2. It uses a supervised contrastive loss: tank chips against 8 background classes that k-means finds in the base Clay embeddings. The image is split into 250 m cells for training, validation and test. Training takes 10.5 minutes on one NVIDIA RTX PRO 6000. On the held-out test cells, the Similar mAP goes from 0.647 to 0.948. On a different image from 2015 at 0.789 m, it goes from 0.567 to 0.639.&lt;/p&gt;

&lt;p&gt;Here is the same chip, zoomed in, with base Clay and then with M2:&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/clay-explorer/main/docs/images/zoom-base.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/clay-explorer/main/docs/images/zoom-base.jpg&quot; alt=&quot;Zoom on chip 1313 with base Clay: green chips on tanks and on some open ground.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;Base Clay, zoomed in on chip 1313.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/clay-explorer/main/docs/images/zoom-m2.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/clay-explorer/main/docs/images/zoom-m2.jpg&quot; alt=&quot;Zoom on chip 1313 with the M2 encoder: green chips mostly on tanks, the rest red.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;M2, zoomed in on chip 1313. The green chips are mostly on tanks.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;What counts as a miss?&lt;/h2&gt;

&lt;p&gt;I score with P@6: the fraction of the six closest chips that are tank chips. A chip is a tank chip when the centre of a labelled tank is in the chip. I rank only the chips inside the labelled extent. A random chip is a tank chip 3.1% of the time.&lt;/p&gt;

&lt;p&gt;For chip 1313, base Clay gets 3 of 6 and M2 gets 2 of 6. That surprised me, because the zoomed M2 picture looks cleaner. So I looked at the misses. All seven misses (five different chips) are chips with part of a tank, but not its centre. I call them partial chips. Each of the 12 matches touches a tank.&lt;/p&gt;

&lt;p&gt;The strict score counts a partial chip as a miss. The fine-tune test does not: it removes partial chips from the ranking. Here are both scores:&lt;/p&gt;

&lt;table style=&quot;border-collapse:collapse;margin:0 auto;&quot;&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;P@6&lt;/th&gt;&lt;th style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Base Clay&lt;/th&gt;&lt;th style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;M2&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Chip 1313, strict&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;0.50&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;0.33&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;Chip 1313, partial chips removed&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;1.00&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;1.00&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;78 tank chips at 128 px, strict mean&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;0.54&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;0.60&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;78 tank chips at 128 px, partial chips removed&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;0.77&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;0.91&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;84 tank chips at 64 px, strict mean&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;0.35&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;0.38&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;&quot;&gt;84 tank chips at 64 px, partial chips removed&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;0.68&lt;/td&gt;&lt;td style=&quot;border:1px solid #999;padding:4px 8px;text-align:right;&quot;&gt;0.84&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;So the answer to &quot;is M2 better?&quot; depends on what a miss is. If a partial chip counts as a miss, M2 gains a little (0.54 to 0.60). If you leave partial chips out, as the fine-tune test does, M2 gains a lot (0.77 to 0.91). Both models are far above 3.1%. I first scored this against the SAM 3 detections from my last post, not the hand labels. Those detections include false positives, and they made M2 look better on chip 1313 than it is. Lesson learned: score against the hand labels when they exist.&lt;/p&gt;

&lt;h2&gt;A bug on the way&lt;/h2&gt;

&lt;p&gt;While I reviewed the Clay code for this project, I found that a wrong checkpoint does not fail. The embedder printed one warning per encoder parameter (265 of them), continued with a random encoder, and exited with success. The segmentation and regression loaders printed nothing, and the random encoder stayed trainable. For an embedding app, that means random embeddings that look real.&lt;/p&gt;

&lt;p&gt;I fixed this and seven other errors in my fork, &lt;a href=&quot;https://github.com/mraad/model&quot;&gt;mraad/model&lt;/a&gt;. With the correct checkpoint, the embeddings are bit-identical to upstream. I also sent the weight-loading fix upstream as &lt;a href=&quot;https://github.com/Clay-foundation/model/pull/386&quot;&gt;pull request #386&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Limits&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;This is one image and one run for each setup.&lt;/li&gt;
  &lt;li&gt;M2 was trained on this image. The whole-image scores above are not a held-out test.&lt;/li&gt;
  &lt;li&gt;A 128-pixel chip mixes a tank with its surroundings. Clay was pretrained on 256-pixel chips, so a smaller chip gives the encoder less context.&lt;/li&gt;
  &lt;li&gt;Centring makes similarity relative to the scene. A new export of a different area changes the values.&lt;/li&gt;
  &lt;li&gt;The &lt;code&gt;linz&lt;/code&gt; sensor profile is a proxy. The statistics of this image differ from those of the LINZ imagery.&lt;/li&gt;
  &lt;li&gt;The browser holds all embeddings. At 64 pixels, this image gives 12,384 chips and about 50 MB of embeddings.&lt;/li&gt;
  &lt;li&gt;This image is 8,200 pixels wide. On a GPU with a texture limit of 8,192 pixels, such as a software renderer, the image does not draw, and there is no error.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;What is next&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Text queries. Clay has no text encoder, so &quot;find the tanks&quot; is not possible yet. A linear probe on the labels is the cheapest step. A text-capable aerial model is the larger one.&lt;/li&gt;
  &lt;li&gt;Score partial chips as a third class, between tank and background.&lt;/li&gt;
  &lt;li&gt;Downscale the exported image so that it draws on every GPU.&lt;/li&gt;
  &lt;li&gt;Use the same chip rule on the 2015 image.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Last time, I asked a question and got detections. This time, I pointed at a tank and got its neighbours in embedding space, without a prompt. With base Clay, it also works without a label. The app code is on GitHub at &lt;a href=&quot;https://github.com/mraad/clay-explorer&quot;&gt;mraad/clay-explorer&lt;/a&gt;, under Apache 2.0. The README has the pipeline commands. The Clay fork and the upstream fix are public too. More to come.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/2479808160340191342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/2479808160340191342' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/2479808160340191342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/2479808160340191342'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/10/clay-explorer-point-at-one-tank-find.html' title='Clay Explorer: Point at One Tank, Find the Others'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-832708370641577728</id><published>2026-10-21T05:13:18.374-04:00</published><updated>2026-10-21T05:13:18.374-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Computer Vision"/><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><title type='text'>Where Is Jev? Find the Tile, Then Detect the Tank</title><content type='html'>&lt;p&gt;Remember &lt;em&gt;Where&#39;s Waldo?&lt;/em&gt; You do not look at the whole page at once. You scan it left to right, top to bottom, one cell at a time. When you find the cell with Waldo in it, you look closely and spot him. I wanted to try that idea on an overhead image of an industrial site with a lot of storage tanks.&lt;/p&gt;

&lt;p&gt;In my &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/10/duckdb-jev-spatial-jev-style-sql.html&quot;&gt;last post&lt;/a&gt;, a Jev-style decision model answered a plain-English condition for each row of a table. Here, the rows are image tiles. I cut the image into tiles and ask a vision-language model one fixed question about each tile: does it contain a tank, part of a tank, or no tank? If the answer is no tank, I skip the tile. If not, the tile goes to &lt;a href=&quot;https://huggingface.co/facebook/sam3&quot;&gt;SAM 3&lt;/a&gt;, and SAM 3 finds the tanks. No model is trained for this task.&lt;/p&gt;

&lt;p&gt;The project is &lt;a href=&quot;https://github.com/mraad/where-is-jev&quot;&gt;where-is-jev&lt;/a&gt;. In this post, I show how the pieces fit together, what the numbers say, and where the method is wrong.&lt;/p&gt;

&lt;h2&gt;The data&lt;/h2&gt;

&lt;p&gt;The test image is one RGB GeoTIFF: 8,200 × 6,087 pixels at 0.5 m per pixel, in EPSG:3857. A FileGDB has 97 tank polygons (the labels) and one extent polygon that covers 82% of the image. 85 labels are inside the extent. I score only the labels and detections that have a centroid inside the extent. The labels are in the repository as &lt;code&gt;data/Tanks.gpkg&lt;/code&gt;. The image is not.&lt;/p&gt;

&lt;h2&gt;How it works&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Tile.&lt;/strong&gt; Cut the image into 512 × 512 pixel tiles with a stride of 256 pixels. The tiles overlap by 50%, so each point on the ground is in up to four tiles. This image gives 736 tiles.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Gate.&lt;/strong&gt; Ask the vision-language model the question for each tile. Keep the tiles with answer A or B.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Detect.&lt;/strong&gt; Run SAM 3 with the text prompt “round storage tanks” on the kept tiles. Each SAM 3 mask becomes a polygon. I call this polygon a detection.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Merge.&lt;/strong&gt; Collect the detections from all tiles and remove the duplicates.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Evaluate.&lt;/strong&gt; Match each detection to at most one label, in score order, at IoU 0.5 or more.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Package.&lt;/strong&gt; Write the tiles, detections and scores to one GeoPackage, and open it in ArcGIS Pro.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All model work runs on one Ubuntu machine with four NVIDIA RTX PRO 6000 Blackwell GPUs. Each stage starts one model copy on each GPU, and each copy takes every fourth tile. The merge checks that every tile was processed exactly once before it does anything else.&lt;/p&gt;

&lt;h2&gt;The gate: one question, one forward pass&lt;/h2&gt;

&lt;p&gt;The gate asks the same question for every tile:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Classify this RGB overhead satellite image patch for circular industrial storage tanks.
A: Contains at least one complete storage tank whose full circular footprint is visible inside the patch.
B: Contains part of one or more storage tanks cut off by a patch edge or gray missing-image area, but no complete tank.
C: Contains no visible storage tank, either complete or partial.
If both complete and partial tanks appear, choose A. There may be one tank or many.
Partial means spatially cut off, not uncertain. Roads, factory roofs, ships, ponds, and bare ground are not storage tanks.
Gray regions are missing image data. Judge visible evidence only.
Answer with exactly one letter: A, B, or C.&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I do not let the model write an answer. For Qwen3-VL, I run one forward pass and read the next-token scores of the letters A, B and C. The letter with the highest score is the decision. For Nemotron, vLLM generates exactly one token from those three letters. There is no classifier head and no fine-tuning. I froze the question before scoring, and I did not tune it on the labels.&lt;/p&gt;

&lt;p&gt;I tested four models at three tile sizes (256, 384 and 512 pixels). The reference for a tile comes from the labels: “contains” when a label is fully inside the tile, “partial” when a label only overlaps it. Presence counts both as positive. These are the 512-pixel results on the 513 tiles fully inside the extent:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Gate model&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;GPUs&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Presence precision&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Presence recall&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Presence F1&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Time, 736 tiles&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td&gt;Qwen3-VL 4B&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;83.2%&lt;/td&gt;&lt;td&gt;86.8%&lt;/td&gt;&lt;td&gt;0.849&lt;/td&gt;&lt;td&gt;11.3 s&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Qwen3-VL 32B&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;81.0%&lt;/td&gt;&lt;td&gt;91.2%&lt;/td&gt;&lt;td&gt;0.858&lt;/td&gt;&lt;td&gt;31.2 s&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Nemotron Nano VL 12B&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;59.2%&lt;/td&gt;&lt;td&gt;92.3%&lt;/td&gt;&lt;td&gt;0.721&lt;/td&gt;&lt;td&gt;45.2 s&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Nemotron 3 Nano Omni 30B-A3B&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;69.9%&lt;/td&gt;&lt;td&gt;94.5%&lt;/td&gt;&lt;td&gt;0.804&lt;/td&gt;&lt;td&gt;47.2 s&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The times include the model load. Nemotron ran on a second machine with two GPUs and a different runtime, so this is not a fair speed race. The two Qwen models ran on the same machine.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/where-is-jev/main/docs/images/gate_tiles.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/where-is-jev/main/docs/images/gate_tiles.jpg&quot; alt=&quot;Overhead image of the extent with the tiles that the Qwen3-VL 32B gate sends to SAM 3: green outlines for contains a tank, amber outlines for partially contains a tank, and a yellow extent boundary.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;Tiles that the Qwen3-VL 32B gate sends to SAM 3. Green: contains a tank. Amber: partially contains a tank. The tiles with no tank are not drawn.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;SAM 3 and the duplicate problem&lt;/h2&gt;

&lt;p&gt;With the Qwen3-VL 32B gate, 265 of the 736 tiles go to SAM 3. The gate skips the other 64%. SAM 3 (BF16, score threshold 0.3, batch 32) returns 850 detections in about 15 seconds, model load included.&lt;/p&gt;

&lt;p&gt;The 50% overlap has a cost. A tank near a tile edge appears in up to four tiles, and some of those copies are cut off by the tile edge. My first merge used box NMS at IoU 0.5. It kept 364 detections, and many of them were duplicates, because the box of a cut-off piece rarely reaches IoU 0.5 with the box of the full tank. Precision was 24.8%.&lt;/p&gt;

&lt;p&gt;So I changed the rule. The merge now sorts the detections: first the ones that do not touch their tile edge, then by score. Then it removes a detection when its intersection with a kept detection is more than half of the smaller area. I picked 0.5 before I looked at the scores. This keeps 251 detections. Precision goes up to 36.6%, and recall goes up from 95.3% to 96.5%.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/where-is-jev/main/docs/images/example_most_tp.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/where-is-jev/main/docs/images/example_most_tp.jpg&quot; alt=&quot;Two views of tile p50_0591. Left: 45 cyan SAM 3 detections from all overlapping tiles. Right: after the merge, 10 green true positives and 1 magenta false positive.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;The tile with the most true positives. Left: 45 detections from all overlapping tiles have a centroid in this tile. Right: 11 remain after the merge, and 10 of them match a label.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;The results&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Gate&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Merge&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Tiles to SAM 3&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Detections&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Precision&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Recall&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;F1&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td&gt;Qwen3-VL 4B&lt;/td&gt;&lt;td&gt;New&lt;/td&gt;&lt;td&gt;246&lt;/td&gt;&lt;td&gt;248&lt;/td&gt;&lt;td&gt;36.8%&lt;/td&gt;&lt;td&gt;95.3%&lt;/td&gt;&lt;td&gt;53.1%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Qwen3-VL 32B&lt;/td&gt;&lt;td&gt;New&lt;/td&gt;&lt;td&gt;265&lt;/td&gt;&lt;td&gt;251&lt;/td&gt;&lt;td&gt;36.6%&lt;/td&gt;&lt;td&gt;96.5%&lt;/td&gt;&lt;td&gt;53.1%&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Qwen3-VL 32B&lt;/td&gt;&lt;td&gt;Box NMS&lt;/td&gt;&lt;td&gt;265&lt;/td&gt;&lt;td&gt;364&lt;/td&gt;&lt;td&gt;24.8%&lt;/td&gt;&lt;td&gt;95.3%&lt;/td&gt;&lt;td&gt;39.3%&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;And guess what? The small 4B gate gives the same F1 as the 32B gate. The full run, from the first tile decision to the merged detections, takes about 25 seconds with the 4B gate and about 47 seconds with the 32B gate. In both runs, every one of the 85 labeled tanks touches a detection.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/where-is-jev/main/docs/images/detections.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/where-is-jev/main/docs/images/detections.jpg&quot; alt=&quot;Overhead image of the extent with the detections after the merge: green true positives, magenta false positives, and red outlines for missed labels.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;Detections after the merge, Qwen3-VL 32B gate. Green: true positive. Magenta: false positive. Red outline: label without a match.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;Where it is wrong&lt;/h2&gt;

&lt;p&gt;The false positives are not random. 132 of the 142 false positives do not touch any label. In the tile below, SAM 3 finds 40 small round objects in rows. The labels do not include them, and I did not check what they are. If some of them are tanks, the real precision is higher. On the two largest tanks, SAM 3 also splits the roof into parts, and the extra parts count as false positives.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/where-is-jev/main/docs/images/example_most_fp.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/where-is-jev/main/docs/images/example_most_fp.jpg&quot; alt=&quot;Two views of tile p50_0166 with two groups of small round objects in rows. All 40 detections after the merge are magenta false positives.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;The tile with the most false positives: 40 small round objects in rows that have no label.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Three labels do not reach IoU 0.5. For two of them, the view is oblique, so the image shows the side wall of the tank. The label covers the roof only. The SAM 3 detection covers the roof and the wall. For the third, the detection covers a smaller shape.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/where-is-jev/main/docs/images/missed_tanks.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/where-is-jev/main/docs/images/missed_tanks.jpg&quot; alt=&quot;Three close-ups of labels 83, 101 and 106 in red, with the best detection in magenta. Best IoU 0.48, 0.50 and 0.36.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;The three labels without a match at IoU 0.5. Red: label. Magenta: detection.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Some limits I want to be clear about:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;This is one image and one run for each setup. It does not rank the models in general.&lt;/li&gt;
  &lt;li&gt;The gate skips 64% of the tiles. I did not run SAM 3 on all tiles with the same prompt, so I do not have a measured time saving. On four GPUs, SAM 3 is fast on an image of this size.&lt;/li&gt;
  &lt;li&gt;The merge can remove a real tank that lies inside a larger false detection. That did not happen to any label here.&lt;/li&gt;
  &lt;li&gt;Precision assumes that the labels include every tank inside the extent.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Try it&lt;/h2&gt;

&lt;p&gt;The launchers have host paths and check the hash of my image, so change them for your machine first. The README lists the model checkpoints and Python environments. Then do these steps on a machine with four GPUs, inside tmux:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Clone the repository.
    &lt;pre&gt;&lt;code&gt;git clone https://github.com/mraad/where-is-jev.git&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Go to the project folder.
    &lt;pre&gt;&lt;code&gt;cd where-is-jev&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Run the gate decisions on all GPUs.
    &lt;pre&gt;&lt;code&gt;bash run_tiles.sh qwen32b&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Make the gate folder from the 512-pixel decisions.
    &lt;pre&gt;&lt;code&gt;.venv/bin/python patch_decisions.py gate --manifest results/tiles/512/manifest \
  --shards results/tiles/512/qwen32b --out results/gate512&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Run SAM 3 and the merge on all GPUs.
    &lt;pre&gt;&lt;code&gt;bash run_gc1.sh 32 results/sam3_512 results/gate512 &quot;round storage tanks&quot;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Evaluate the detections against the labels.
    &lt;pre&gt;&lt;code&gt;.venv/bin/python evaluate.py --gdb Tanks.gdb --image Tanks.tif \
  --detections results/sam3_512/merged/detections.geojson --out results/validation&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;a href=&quot;https://github.com/mraad/where-is-jev/blob/main/README.md&quot;&gt;README&lt;/a&gt; has the GeoPackage step, the field of every layer, and the full log of the experiments.&lt;/p&gt;

&lt;h2&gt;What is next&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Run SAM 3 on all 736 tiles with the same prompt, to measure what the gate saves.&lt;/li&gt;
  &lt;li&gt;Find out what the small round objects are.&lt;/li&gt;
  &lt;li&gt;Try the gate on more images, and on objects other than tanks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So far, the Waldo idea holds up: scan the tiles, skip the empty ones, and look closely only where something is there. The code is on &lt;a href=&quot;https://github.com/mraad/where-is-jev&quot;&gt;GitHub&lt;/a&gt; under Apache 2.0. More to come.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/832708370641577728/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/832708370641577728' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/832708370641577728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/832708370641577728'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/10/where-is-jev-find-tile-then-detect-tank.html' title='Where Is Jev? Find the Tile, Then Detect the Tank'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-8974985399392704856</id><published>2026-10-20T07:07:39.629-04:00</published><updated>2026-10-20T07:07:39.630-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DuckDB"/><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><title type='text'>DuckDB Jev Spatial: Jev-Style SQL Decisions with a Local Laya Model</title><content type='html'>&lt;p&gt;When DuckDB published &lt;a href=&quot;https://duckdb.org/2026/09/29/jev&quot;&gt;Jev and DuckDB: Plain-English Conditions in SQL&lt;/a&gt;, I wanted to try it on my North Sea wells and pipelines right away. The idea is simple and powerful. You write a plain-English condition inside a SQL query, and a decision model answers it for each row. But those Jev functions send the row data to the hosted TypeSafe API, and that needs an API key.&lt;/p&gt;

&lt;p&gt;I already had Laya, an open-weight decision model, running on my Mac from &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/lunar-laya-from-state-and-text-to.html&quot;&gt;Lunar Laya&lt;/a&gt;. So I asked a direct question: can the same SQL run on a local model, inside DuckDB, with no network at all?&lt;/p&gt;

&lt;p&gt;The result is &lt;a href=&quot;https://github.com/mraad/duckdb-jev-spatial&quot;&gt;duckdb-jev-spatial&lt;/a&gt;. It is a native DuckDB extension, written in Rust, that registers seven Jev functions. Laya Rust and ONNX Runtime run the model inside the DuckDB process. The DuckDB spatial extension does the geometry. In this post, I show how the pieces fit together, what the NorthSea data shows, and where the model is wrong.&lt;/p&gt;

&lt;h2&gt;Two kinds of conditions&lt;/h2&gt;

&lt;p&gt;A model that reads one well row cannot find the pipelines near that well. That question needs the pipeline table, a coordinate reference system, and distance units. DuckDB does that work very well. Thus the project uses two kinds of conditions:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Exact filter&lt;/strong&gt;: a SQL condition on stored attributes or geometry, for example &lt;code&gt;water_depth &amp;gt; 350&lt;/code&gt; or &lt;code&gt;ST_DWithin&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Semantic filter&lt;/strong&gt;: a condition that uses a Jev function on selected text fields, for example a well status or an inspection note.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The rows that pass the exact filter are the candidate rows. Only the selected text fields of those rows go to the model. Geometry never goes to the model.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/duckdb-jev-spatial/main/docs/images/architecture.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/duckdb-jev-spatial/main/docs/images/architecture.png&quot; alt=&quot;Diagram: SQL from a DuckDB client or the optional Python planner enters DuckDB 1.5.6 with the spatial extension, which applies the exact filter. Candidate rows go to the Jev functions in the native Rust extension, which send selected text fields to Laya Rust and ONNX Runtime. Answers return to SQL. Everything runs inside one DuckDB process with no network.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;The exact filter runs in DuckDB. The semantic filter runs in the native extension. Both run in one process.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;Exact first: 106 wells, zero model evaluations&lt;/h2&gt;

&lt;p&gt;Here is the question that started it: “Show all wells with water depth greater than 350 meters and an in-service pipeline within 5 km.” Each part maps to a stored fact. Water depth is a column. In service is the code &lt;code&gt;IN SERVICE&lt;/code&gt;. Distance is a spatial function. And guess what? DuckDB answers it alone, with zero model evaluations.&lt;/p&gt;

&lt;p&gt;The NorthSea data stores geometry in EPSG:4326 degrees. The query transforms both geometries to EPSG:3035, so the 5 km limit is in projected meters. Of 9,299 wells, 600 are deeper than 350 meters. Of those, 106 have one of the 63 in-service pipelines within 5 km. An independent minimum-distance query returns the same 106 IDs.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SELECT w.OBJECTID
FROM wells_m w
WHERE w.water_depth &amp;gt; 350
  AND EXISTS (
    SELECT 1 FROM service_pipelines_m p
    WHERE ST_DWithin(w.geom_m, p.geom_m, 5000)
  )
ORDER BY w.OBJECTID;&lt;/code&gt;&lt;/pre&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/duckdb-jev-spatial/main/docs/images/deep-wells-near-pipelines.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/duckdb-jev-spatial/main/docs/images/deep-wells-near-pipelines.png&quot; alt=&quot;Map of the NorthSea sample data in EPSG:3035: 106 deep wells near an in-service pipeline in blue, 494 other deep wells in gray, 63 in-service pipelines in orange, and discovery areas as light outlines, with a 200 km scale bar.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;The 106 deep wells within 5 km of an in-service pipeline (blue), the other 494 deep wells (gray), and the 63 in-service pipelines (orange).&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;Semantic filters inside spatial queries&lt;/h2&gt;

&lt;p&gt;Now the best part. A semantic filter can work inside a spatial relation. This query asks for deep wells near a pipeline that the model classifies as in service. The same pipeline must pass both conditions:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;SELECT w.OBJECTID
FROM deep_wells_m w
WHERE EXISTS (
  SELECT 1 FROM pipelines_m p
  WHERE ST_DWithin(w.geom_m, p.geom_m, 5000)
    AND jev({&#39;current_phase&#39;: p.current_phase},
            &#39;Is this pipeline currently in service?&#39;)
)
ORDER BY w.OBJECTID;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It returns 106 wells, and the IDs match the exact &lt;code&gt;IN SERVICE&lt;/code&gt; filter. I wrote four mixed examples, one for each spatial pattern:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;&lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Spatial operation&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Semantic filter&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;NorthSea result&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td&gt;&lt;code&gt;ST_DWithin&lt;/code&gt; inside &lt;code&gt;EXISTS&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;jev&lt;/code&gt; accepts the pipeline state&lt;/td&gt;&lt;td&gt;106 wells; IDs match the exact filter&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;code&gt;ST_Intersects&lt;/code&gt; inside &lt;code&gt;EXISTS&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;jev_choice&lt;/code&gt; selects the pipeline lifecycle&lt;/td&gt;&lt;td&gt;52 pipelines; IDs match the exact filter&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;code&gt;ST_Contains&lt;/code&gt; inside &lt;code&gt;EXISTS&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;jev_prob&lt;/code&gt; accepts the well status&lt;/td&gt;&lt;td&gt;4 areas; 1 correct and 3 false positives&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Lateral query ordered by &lt;code&gt;ST_Distance&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;jev&lt;/code&gt; selects the eligible pipelines&lt;/td&gt;&lt;td&gt;600 pairs; pipeline IDs and distances match&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The containment example is the honest one. &lt;code&gt;jev_prob&lt;/code&gt; accepts four discovery areas. Only one area contains a well with an operating status. The other three are false positives.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/duckdb-jev-spatial/main/docs/images/containment-false-positives.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/duckdb-jev-spatial/main/docs/images/containment-false-positives.png&quot; alt=&quot;Four map panels of discovery areas returned by jev_prob inside ST_Contains. Area 832 (Schiehallion) is correct with a COMPLETED (OPERATING) well at P = 0.843. Areas 687 (Foinaven), 1197, and 1341 are false positives, accepted for COMPLETED (SHUT IN) at P = 0.603 and DRILLING at P = 0.727.&quot; style=&quot;width:100%;max-width:640px;height:auto;display:block;margin:0 auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;One correct area and three false positives. &lt;code&gt;DRILLING&lt;/code&gt; and &lt;code&gt;COMPLETED (SHUT IN)&lt;/code&gt; score above 0.5.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;There is one more trap. In one &lt;code&gt;WHERE&lt;/code&gt; clause, predicate order does not control evaluation order. DuckDB can send a row to the model before that row passes the spatial condition. When the model must receive only candidate rows, I store them in a temporary table first. Then a second statement applies the semantic filter:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;CREATE TEMP TABLE exact_wells AS
SELECT w.OBJECTID, w.status
FROM wells_m w
WHERE w.water_depth &amp;gt; 350
  AND EXISTS (
    SELECT 1 FROM service_pipelines_m p
    WHERE ST_DWithin(w.geom_m, p.geom_m, 5000)
  );

SELECT OBJECTID, status
FROM exact_wells
WHERE jev({&#39;status&#39;: status},
          &#39;Does the well status explicitly say that it is operating?&#39;)
ORDER BY OBJECTID;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The 106 candidate rows contain seven distinct statuses. The model accepts wells 4918 and 5026 as operating. Both have &lt;code&gt;DRILLING&lt;/code&gt; status, so both are false positives. My rule is simple: for a known status code, I use exact SQL. The model is for text that has no code.&lt;/p&gt;

&lt;h2&gt;Inside the native extension&lt;/h2&gt;

&lt;p&gt;The extension targets DuckDB 1.5.6 exactly. Its Rust bindings use the unstable DuckDB C extension API. These design choices matter most:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;One answer cache.&lt;/strong&gt; The cache key contains the state, the question, the kind, and the ordered options. All seven Jev functions share one validated answer. Thus a threshold change or a confidence request needs no new model evaluation.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;A budget.&lt;/strong&gt; A query cannot start more than 1,000 model evaluations before an explicit reset with &lt;code&gt;jev_laya_reset()&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Validation before the cache.&lt;/strong&gt; Each answer must have the correct kind, valid labels, finite probabilities, and a complete distribution. A truncated state or an input larger than 1 MiB causes a query error.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Diagnostics.&lt;/strong&gt; &lt;code&gt;jev_eval&lt;/code&gt; returns the full answer as JSON, with probabilities and confidence fields. &lt;code&gt;jev_confidence&lt;/code&gt; and &lt;code&gt;jev_score_norm&lt;/code&gt; read the same cached answer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also reviewed the source of the upstream C++ duckdb-jev extension. Its cache key omits the configured model and endpoint. Its option delimiters can make two different option lists share one key. The local key is a full JSON tuple, and the tests cover delimiters inside options.&lt;/p&gt;

&lt;h2&gt;What the checks show&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;&lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Check&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Result&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Python tests, with native model checks&lt;/th&gt;&lt;td&gt;93 passed&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Native Rust unit tests&lt;/th&gt;&lt;td&gt;4 passed&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;tev1 outputs&lt;/th&gt;&lt;td&gt;256/256 valid; 250/256 correct&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;tev1 spatial membership cases&lt;/th&gt;&lt;td&gt;212/212 correct&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;tev1 semantic cases&lt;/th&gt;&lt;td&gt;38/44 correct&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Model evaluations in the tev1 run&lt;/th&gt;&lt;td&gt;25&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The six semantic failures are three well statuses, each under two answer-letter mappings: &lt;code&gt;BLOWOUT&lt;/code&gt;, &lt;code&gt;COMPLETED (SHUT IN)&lt;/code&gt;, and &lt;code&gt;DRILLING&lt;/code&gt;. The model probabilities are not calibrated for NorthSea. A valid typed answer is not a correct answer, so the harness keeps each failure visible.&lt;/p&gt;

&lt;p&gt;The cache also pays off. With the answers already in the cache, probability queries ran 2.36× faster and choice queries 2.65× faster than the previous build. That benchmark used 30,000 rows and four distinct states. It does not measure cold inference.&lt;/p&gt;

&lt;h2&gt;Limits&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;I tested only DuckDB 1.5.6 on macOS arm64. The native extension is an unsigned development build.&lt;/li&gt;
  &lt;li&gt;The native extension runs one model evaluation for each distinct state. It has no multi-state batching yet.&lt;/li&gt;
  &lt;li&gt;The optional English planner accepts a fixed grammar. It accepted none of 3,000 sample corpus questions.&lt;/li&gt;
  &lt;li&gt;Distances are projected meters. They are not geodesic distances.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Try it&lt;/h2&gt;

&lt;p&gt;The full native setup is in the &lt;a href=&quot;https://github.com/mraad/duckdb-jev-spatial#set-up-the-native-extension&quot;&gt;README&lt;/a&gt;. It needs the DuckDB 1.5.6 shell, a Rust toolchain, &lt;code&gt;uv&lt;/code&gt; with Python 3.12, and the Laya checkout. Do these steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Clone the repository.
    &lt;pre&gt;&lt;code&gt;git clone https://github.com/mraad/duckdb-jev-spatial.git&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Go to the project directory.
    &lt;pre&gt;&lt;code&gt;cd duckdb-jev-spatial&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Extract the sample dataset.
    &lt;pre&gt;&lt;code&gt;tar -xzf data/NorthSea.tar.gz -C data&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;Do the &lt;a href=&quot;https://github.com/mraad/duckdb-jev-spatial#set-up-the-native-extension&quot;&gt;native setup&lt;/a&gt; in the README.&lt;/li&gt;
  &lt;li&gt;Run the eight exact spatial examples.
    &lt;pre&gt;&lt;code&gt;duckdb -readonly -unsigned data/NorthSea/NorthSea.ddb &amp;lt; native/spatial-examples.sql&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;a href=&quot;https://github.com/mraad/duckdb-jev-spatial/blob/main/docs/sql-reference.md&quot;&gt;SQL reference&lt;/a&gt; describes every Jev function. The &lt;a href=&quot;https://github.com/mraad/duckdb-jev-spatial/blob/main/docs/validation.md&quot;&gt;validation document&lt;/a&gt; shows how to run each check.&lt;/p&gt;

&lt;p&gt;Thank you to &lt;a href=&quot;https://www.geodata.no/&quot;&gt;Geodata&lt;/a&gt; for the NorthSea sample data. For more context, read the &lt;a href=&quot;https://duckdb.org/2026/09/29/jev&quot;&gt;DuckDB Jev post&lt;/a&gt; and the Respan comparison &lt;a href=&quot;https://www.respan.ai/articles/jev-alternatives&quot;&gt;10 Best Jev Alternatives&lt;/a&gt;, which lists Laya as free to self-host.&lt;/p&gt;

&lt;p&gt;Next, I want to batch distinct states and build for more platforms. The code, the SQL examples, and the validation records are on GitHub in &lt;a href=&quot;https://github.com/mraad/duckdb-jev-spatial&quot;&gt;duckdb-jev-spatial&lt;/a&gt;. More to come!&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/8974985399392704856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/8974985399392704856' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/8974985399392704856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/8974985399392704856'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/10/duckdb-jev-spatial-jev-style-sql.html' title='DuckDB Jev Spatial: Jev-Style SQL Decisions with a Local Laya Model'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-7549870899939312929</id><published>2026-10-15T05:10:03.000-04:00</published><updated>2026-10-15T05:38:13.278-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3D"/><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Apollo Spatial VLM: From One Photo and One Sentence to 3D</title><content type='html'>&lt;p&gt;
  &lt;a href=&quot;https://github.com/mraad/Apollo-Spatial-VLM&quot;&gt;
    &lt;img src=&quot;https://raw.githubusercontent.com/mraad/Apollo-Spatial-VLM/main/media/apollo-demo.png&quot;
         alt=&quot;Apollo Spatial VLM in the browser: a photo of the Sydney Opera House is uploaded, the prompt &#39;locate the Sydney Opera House&#39; is typed and run, and the scene appears in 3D as Gaussian splats that tilt left and right&quot;
         style=&quot;max-width:100%; height:auto;&quot;&gt;
  &lt;/a&gt;
  &lt;br&gt;
  &lt;em&gt;One photo, one sentence. “Locate the Sydney Opera House”, and a few seconds later the
  scene is in 3D, as Gaussian splats you can tilt around.&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt;
  Recently I came across a small project called
  &lt;a href=&quot;https://github.com/MercuriusTech/Odyseus-Spatial-VLM&quot;&gt;Odyseus Spatial VLM&lt;/a&gt; by
  Mercurius Technologies. Two things grabbed me right away. The first was the name. I grew
  up on Greek mythology, and seeing Odysseus on a GitHub page brought back a lot of
  childhood memories. The second was the idea: take a vision language model (VLM), the
  kind of model that can look at a picture and answer questions about it, and ask it not
  just &lt;em&gt;what&lt;/em&gt; is in the photo, but &lt;em&gt;where&lt;/em&gt; it is, in 3D, in meters.
&lt;/p&gt;

&lt;p&gt;
  I liked it so much that I forked it, played with it for a while, and kept adding things.
  It grew into its own project, which I named
  &lt;a href=&quot;https://github.com/mraad/Apollo-Spatial-VLM&quot;&gt;Apollo Spatial VLM&lt;/a&gt;. (Why Apollo?
  Mercury and Apollo have a lovely story together. I tell it at the end of the README.)
&lt;/p&gt;

&lt;h2&gt;How it works&lt;/h2&gt;

&lt;p&gt;
  You upload a photo and type what you are looking for, something like “select the chair
  near the desk and the closest door”. Then three things happen:
&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;A &lt;strong&gt;VLM&lt;/strong&gt; looks at the image and points at each thing you asked for. It
    answers with an x/y position for every target.&lt;/li&gt;
  &lt;li&gt;A &lt;strong&gt;depth model&lt;/strong&gt; estimates how far away every pixel is, in meters, from
    that single photo. No stereo camera, no LiDAR.&lt;/li&gt;
  &lt;li&gt;The two are combined: each target&#39;s pixel gets its depth, and a simple camera model
    lifts it into 3D. The browser then shows the whole scene as a point cloud with labeled
    markers at the targets.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
  That last step is the whole point. A language model that says “the chair is on the
  left” is nice. A model that says “the chair is 3.1 meters away, slightly to the left
  and below the camera” is something a robot or a drone can act on.
&lt;/p&gt;

&lt;h2&gt;What I added&lt;/h2&gt;

&lt;p&gt;
  The part I had the most fun with is &lt;strong&gt;Gaussian splats&lt;/strong&gt;. Instead of drawing
  each depth pixel as a tiny dot, the browser builds a small, flat, soft disc for every
  pixel, oriented along the surface it sits on. About 92,000 of them for the Opera House
  photo, built in roughly 20 ms with
  &lt;a href=&quot;https://sparkjs.dev/&quot;&gt;Spark&lt;/a&gt; on top of
  &lt;a href=&quot;https://threejs.org/&quot;&gt;Three.js&lt;/a&gt;. All on the client side, no extra server
  work. The result looks a lot more like a solid scene than a cloud of dots, as you can
  see in the animation above.
&lt;/p&gt;

&lt;p&gt;The other additions are more practical:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;A choice of models in the page.&lt;/strong&gt; Depth Anything 3 or
    &lt;a href=&quot;https://github.com/microsoft/MoGe&quot;&gt;MoGe-3&lt;/a&gt; for depth; Qwen3.6-27B,
    Qwen3-VL-32B or Molmo2-8B for picking the targets.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;The camera&#39;s own focal length.&lt;/strong&gt; If the photo carries EXIF data, the
    demo uses the real field of view instead of guessing 60°. This matters more than I
    expected (more on that below).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;A lighter response.&lt;/strong&gt; The server now sends the depth as half floats and
    lets the browser build the point cloud, which took each response from 2.4 MB down to
    0.47 MB.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Testing the models&lt;/h2&gt;

&lt;p&gt;
  I had access to a machine with four NVIDIA RTX PRO 6000 Blackwell GPUs, so I put all
  four to work and ran a small evaluation against public ground truth: 200 referring
  expressions from RefCOCO for the VLMs, and the 771 laser-scanned DIODE validation images
  for the depth models.
&lt;/p&gt;

&lt;p&gt;
  And guess what? Once you can read their answers, the VLMs all point about equally well,
  landing inside the right box 88 to 91% of the time. The real difference was whether a
  model followed the demo&#39;s answer format. Qwen3-VL-32B kept wanting to answer with a box
  instead of a point, and broke the format in about 15% of its answers. Qwen3.6-27B
  followed it much better, and Molmo2-8B matched the best accuracy at almost three times
  the speed.
&lt;/p&gt;

&lt;p&gt;
  On depth, MoGe-3 was clearly better at getting distances right in meters. But the
  bigger lesson was about the camera. When I fed Depth Anything 3 a narrower view than the
  60° it assumes, its distances collapsed. Given the real focal length, it recovered, and
  even did a little better than MoGe-3 on that test. That is why the EXIF focal length is now used whenever a photo has it.
&lt;/p&gt;

&lt;p&gt;
  Speed-wise, almost all of the time (about 95%) is the VLM thinking. Turning on CUDA graphs
  in &lt;a href=&quot;https://github.com/vllm-project/vllm&quot;&gt;vLLM&lt;/a&gt; and switching to FP8 weights
  brought a full request with Qwen3.6-27B from 3.9 seconds down to about 2 seconds, which
  is what you see in the animation.
&lt;/p&gt;

&lt;h2&gt;It runs at the edge too&lt;/h2&gt;

&lt;p&gt;
  I also executed the whole pipeline on an NVIDIA Jetson AGX Orin (64 GB), the kind of
  board that sits on a robot or a drone. Everything runs on the device itself: the
  vision language model, the depth model and the web app. With Molmo2-8B and Depth
  Anything 3, a full request takes about 5 seconds and uses under half of the Orin&#39;s
  shared memory. MoGe-3 runs there too, at about 9 seconds per request. The bigger
  Qwen3.6-27B also fits, but at about 16 seconds per request it is better suited to the
  data center.
&lt;/p&gt;

&lt;h2&gt;A word of honesty&lt;/h2&gt;

&lt;p&gt;
  “Metric depth from a single photo” is an estimate, not a measurement. In the Opera House
  example the depth model puts the building about 5 meters from the camera, which is
  clearly not true for a photo taken from that far away (unless the Opera House shrank).
  The model has no idea how big things are in that scene, and it has no focal length to
  work with since that image carries no EXIF. Indoor shots of rooms and furniture behave
  much better. Also, 200 samples and one depth dataset are a good sanity check, not a
  benchmark. And the splats are flat discs built from one view, not a trained 3D Gaussian
  Splatting model, so walk too far around the scene and you will see the holes behind
  things.
&lt;/p&gt;

&lt;h2&gt;What is next&lt;/h2&gt;

&lt;p&gt;
  The idea I am most excited about: many phone photos also carry a GPS position and a
  compass heading. Combined with the focal length and the depth, every point in the cloud
  could get a real latitude and longitude, with an error estimate. That would turn “the
  chair is 3 meters away” into “the chair is &lt;em&gt;here&lt;/em&gt;, on the map”. I wrote up the
  idea in the repository, and that is where I am heading next.
&lt;/p&gt;

&lt;p&gt;
  The source code, the setup scripts for Linux, macOS and Jetson, and the full evaluation
  are all in the
  &lt;a href=&quot;https://github.com/mraad/Apollo-Spatial-VLM&quot;&gt;Apollo Spatial VLM repository&lt;/a&gt;.
  A big thank you to Mercurius Technologies for the original Odyseus project. It was the
  spark that started all of this.
&lt;/p&gt;

&lt;p&gt;More to come :-)&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/7549870899939312929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/7549870899939312929' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/7549870899939312929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/7549870899939312929'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/10/apollo-spatial-vlm-from-one-photo-and.html' title='Apollo Spatial VLM: From One Photo and One Sentence to 3D'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-7368944872125247011</id><published>2026-10-09T10:59:45.000-04:00</published><updated>2026-10-09T11:17:46.980-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><category scheme="http://www.blogger.com/atom/ns#" term="Unsloth"/><title type='text'>FELN Decisions: Teaching a Small Model Which Layers a Question Needs</title><content type='html'>&lt;p&gt;When Unsloth published its guide on how to &lt;a href=&quot;https://unsloth.ai/docs/basics/train-your-own-decision-model-with-unsloth&quot;&gt;train your own decision model&lt;/a&gt;, I immediately thought of the North Sea. In &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/lunar-laya-from-state-and-text-to.html&quot;&gt;Lunar Laya&lt;/a&gt;, I argued that a model should take a state and some text, and return a structured, measurable answer. Here was a way to turn any small LLM into exactly that kind of model, with a probability attached to every answer. So I had to try it on FELN.&lt;/p&gt;

&lt;p&gt;A quick recap for new readers. FELN (Find Existing Location with N layers) is the little query language behind my &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/feln-rag-five-examples-and-spatial-query.html&quot;&gt;RAG&lt;/a&gt;, &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/feln-lora-teaching-small-model-to-query.html&quot;&gt;LoRA&lt;/a&gt;, &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/feln-liquid-fine-tuning-gis-model-on-mac.html&quot;&gt;Liquid&lt;/a&gt; and &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/feln-webgpu-language-model-database-and.html&quot;&gt;WebGPU&lt;/a&gt; experiments. A question such as “Find gas wells within 5 km of oil pipelines” becomes a plan with three parallel lists: &lt;code&gt;layers&lt;/code&gt;, &lt;code&gt;where&lt;/code&gt; and &lt;code&gt;relations&lt;/code&gt;. The first layer is the one returned; any other layer only filters it through a spatial relation.&lt;/p&gt;

&lt;p&gt;All those projects generate the whole plan in one go. This time, I wanted to pull out the very first decision and give it to a model that does nothing else: &lt;strong&gt;which layers does this question need, and which one is primary?&lt;/strong&gt; One, two or three of Wells, Pipelines and Discoveries. If that decision is wrong, nothing downstream can save the query. And if the model is unsure, I would much rather know it before generating SQL.&lt;/p&gt;

&lt;h2&gt;A decision model does not write text&lt;/h2&gt;

&lt;p&gt;This is the part that caught my attention. Unsloth&#39;s decision models do not generate tokens. The LLM reads the input and the list of options once, and a small head (the same design as Cloudflare&#39;s Clef) scores every option. After training, Unsloth fits a temperature on held-out data so that the probabilities match how often the model is actually right. The request shape is the same &lt;code&gt;state&lt;/code&gt; plus &lt;code&gt;questions&lt;/code&gt; used by Laya and the System One API, so a FELN question becomes:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{
  &quot;state&quot;: &quot;Locate injection pipelines that cross any gas discoveries.&quot;,
  &quot;questions&quot;: {
    &quot;layers&quot;: {
      &quot;type&quot;: &quot;choice&quot;,
      &quot;instructions&quot;: &quot;Which North Sea layers does this map query need? ...&quot;,
      &quot;criteria&quot;: {
        &quot;Wells&quot;: &quot;Return wells only; no other layer is involved.&quot;,
        &quot;Wells+Pipelines&quot;: &quot;Return wells, constrained by pipelines.&quot;,
        &quot;Pipelines+Discoveries&quot;: &quot;Return pipelines, constrained by discoveries.&quot;,
        &quot;...&quot;: &quot;12 options in total&quot;
      }
    }
  },
  &quot;gold&quot;: {&quot;layers&quot;: &quot;Pipelines+Discoveries&quot;}
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Why 12 options? Each option is the primary layer plus the &lt;em&gt;unordered&lt;/em&gt; set of secondary layers: 3 single-layer options, 6 pairs and 3 triples. I considered asking separate questions (how many layers, which one is primary, and a yes/no per layer), but those answers can contradict each other: “two layers” plus three layers marked present. One choice is always consistent. The order of the secondary layers is deliberately not part of the label, because the FELN comparator already matches secondaries by name.&lt;/p&gt;

&lt;h2&gt;Why this is harder than it looks&lt;/h2&gt;

&lt;p&gt;My first instinct was that a keyword search would handle most of it. I wrote the baseline anyway: find the layer names in the text and call the first one mentioned primary. It gets the primary layer right 93% of the time, but the exact combination only &lt;strong&gt;47%&lt;/strong&gt; of the time.&lt;/p&gt;

&lt;p&gt;The reason is subtype words. People say “Find shows within 3 kilometers of condensate,” not “Find wells whose content type is shows within 3 kilometers of discoveries whose type is condensate.” And the vocabularies overlap. Wells, Pipelines and Discoveries all have a &lt;em&gt;gas&lt;/em&gt; type. Condensate exists in both Pipelines and Discoveries. Is that “condensate” a pipeline or a discovery? Sometimes the text simply does not say. I listed each layer&#39;s subtype words in the question&#39;s instructions, since the head reads them along with the input.&lt;/p&gt;

&lt;h2&gt;The data and the machine&lt;/h2&gt;

&lt;p&gt;The training data is the same &lt;code&gt;FELN.json&lt;/code&gt; I generated from the NorthSea project&#39;s &lt;code&gt;Layers.json&lt;/code&gt; catalog and humanized with a local model: 3,000 questions, of which 498 use one layer, 1,659 use two and 843 use three. I split it 80/10/10, stratified by label: 2,400 for training, 300 for validation and calibration, and 300 for a test that nothing else touches.&lt;/p&gt;

&lt;p&gt;Training ran on a cloud box with four NVIDIA RTX PRO 6000 Blackwell GPUs (96 GB each). I installed Unsloth into a fresh environment and launched every job inside tmux, so a dropped connection never killed a run. The recipe follows the guide: 4-bit LoRA at rank 16, learning rate 2e-4, batch 8 with gradient accumulation 4, and 3 epochs instead of 2 because the dataset is small. That is 225 steps. A 20-step smoke test on Qwen3.5-4B already jumped from 5.7% to 76% in about 99 seconds, which told me the setup was sound.&lt;/p&gt;

&lt;p&gt;And guess what? Once the first full run worked, I had four GPUs sitting there. So instead of splitting one small job across them, I ran one model per GPU in parallel: Qwen3.5 at 0.8B, 2B and 4B, Gemma 4 E2B and E4B, Llama 3.2 3B, and Laya itself, which trains in 16-bit on its ModernBERT encoder.&lt;/p&gt;

&lt;h2&gt;Results&lt;/h2&gt;

&lt;p&gt;All numbers are on the same 300 held-out test questions. “Exact” means the primary layer and the full layer set are both right. ECE is the calibration error after calibrating on the validation split. The last column keeps only answers with a confidence of at least 0.7.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Model&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Exact&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;ECE&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Confidence &amp;ge; 0.7: kept / right&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Training&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Merged size&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Keyword baseline&lt;/th&gt;&lt;td&gt;47.3%&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Gemma 4 E4B&lt;/th&gt;&lt;td&gt;95.3%&lt;/td&gt;&lt;td&gt;0.030&lt;/td&gt;&lt;td&gt;93% / 98.2%&lt;/td&gt;&lt;td&gt;10.7 min&lt;/td&gt;&lt;td&gt;15 GB&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Qwen3.5-0.8B, rank 64&lt;/th&gt;&lt;td&gt;95.3%&lt;/td&gt;&lt;td&gt;0.025&lt;/td&gt;&lt;td&gt;88% / 98.9%&lt;/td&gt;&lt;td&gt;4.5 min&lt;/td&gt;&lt;td&gt;1.7 GB&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Qwen3.5-2B&lt;/th&gt;&lt;td&gt;95.0%&lt;/td&gt;&lt;td&gt;0.032&lt;/td&gt;&lt;td&gt;90% / 98.5%&lt;/td&gt;&lt;td&gt;5.2 min&lt;/td&gt;&lt;td&gt;4.4 GB&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Qwen3.5-4B&lt;/th&gt;&lt;td&gt;94.3%&lt;/td&gt;&lt;td&gt;0.021&lt;/td&gt;&lt;td&gt;89% / 98.5%&lt;/td&gt;&lt;td&gt;8.2 min&lt;/td&gt;&lt;td&gt;8.8 GB&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Qwen3.5-0.8B, rank 16&lt;/th&gt;&lt;td&gt;94.3%&lt;/td&gt;&lt;td&gt;0.018&lt;/td&gt;&lt;td&gt;89% / 98.5%&lt;/td&gt;&lt;td&gt;4.9 min&lt;/td&gt;&lt;td&gt;1.7 GB&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Llama 3.2 3B&lt;/th&gt;&lt;td&gt;94.3%&lt;/td&gt;&lt;td&gt;0.034&lt;/td&gt;&lt;td&gt;89% / 98.5%&lt;/td&gt;&lt;td&gt;5.6 min&lt;/td&gt;&lt;td&gt;6.3 GB&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Gemma 4 E2B&lt;/th&gt;&lt;td&gt;91.7%&lt;/td&gt;&lt;td&gt;0.037&lt;/td&gt;&lt;td&gt;91% / 97.1%&lt;/td&gt;&lt;td&gt;7.6 min&lt;/td&gt;&lt;td&gt;9.7 GB&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Laya (ModernBERT, 16-bit)&lt;/th&gt;&lt;td&gt;90.3&amp;ndash;92.0%&lt;/td&gt;&lt;td&gt;0.020&amp;ndash;0.041&lt;/td&gt;&lt;td&gt;85% / 96.5%&lt;/td&gt;&lt;td&gt;2 min&lt;/td&gt;&lt;td&gt;808 MB&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Now the best part: the tiny Qwen3.5-0.8B scores exactly the same as the 4B, trains in under five minutes, and has the best calibration of the bunch. The best runs get the number of layers right on every test question. Every remaining mistake is a two-layer question where the model picks the wrong second layer. Laya, used as-is, scores at chance on this task (8.3%) and is very overconfident. Two minutes of training take it past 90%, which is impressive for an 808 MB model.&lt;/p&gt;

&lt;p&gt;The confidence is the feature I care about most. With the 0.8B model, if I only accept answers at 0.7 or above, it answers 89% of the questions and gets 98.5% of those right. The remaining 11% can go to a fallback: ask the user, or hand the question to a bigger model. A text generator gives me a plan whether it is sure or not. This gives me a number I can route on.&lt;/p&gt;

&lt;p&gt;But I have to be honest about what the table does and does not show. With 300 test questions, one question is worth a third of a point. Changing only the random seed moved the 0.8B by 0.6 points, and two identical Laya runs differed by 1.7 points. So everything between 93.7% and 95.3% is a tie, and I am not crowning Gemma, Qwen or Llama the winner here. More epochs did not help either: five epochs made the 0.8B more confident without making it more accurate.&lt;/p&gt;

&lt;h2&gt;Where the errors come from&lt;/h2&gt;

&lt;p&gt;Across all the runs, only four test questions are missed by every model. Three of them look like “List all oil/gas wells within 15 kilometers of gas.” Is that second “gas” a pipeline or a discovery? The label says discovery; the text could support either. The 0.8B model is unsure about all three, at 0.62, 0.64 and 0.76 confidence. Two of them fall below my 0.7 gate and would go back to the user. The third slips through, a reminder that a gate reduces mistakes but does not remove them.&lt;/p&gt;

&lt;p&gt;The fourth one surprised me. The text reads “Show oil wells ... within 1 kilometer of salt pipelines,” but the label says oil &lt;em&gt;pipelines&lt;/em&gt; near salt &lt;em&gt;wells&lt;/em&gt;. Salt is a well type, so the original generator sentence was right, and the paraphrasing step swapped the two layers. Every model answered what the text actually says. I found another row where the paraphrase dropped the only word naming a layer. So part of the 95% ceiling comes from my own humanized data, not from the models. I left those rows in the numbers, and fixing the humanizer to always keep layer nouns is now on my list.&lt;/p&gt;

&lt;h2&gt;A page to play with it&lt;/h2&gt;

&lt;p&gt;Of course, I wanted to type my own questions. I added a small FastAPI service that loads any trained run on demand and calls &lt;code&gt;FastDecisionModel.predict&lt;/code&gt;, with a single-file vanilla JavaScript page on top. Pick a model, type a question, and you see the primary layer, the layers filtering it, the confidence, and the probability of all 12 options. After the first request loads the model, an answer comes back in about 85 milliseconds.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/feln-unsloth/main/docs/screenshot.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/feln-unsloth/main/docs/screenshot.png&quot; alt=&quot;FELN Layer Decider web page: the question “List gas within 5 km of oil.” is answered Wells filtered by Discoveries at 30.8% confidence and flagged as uncertain, with bars for all 12 layer combinations.&quot; style=&quot;max-width:100%;height:auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;“List gas within 5 km of oil.” Every layer has gas and oil, and the model says so: 30.8% for the top answer, flagged as uncertain.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;That screenshot is my favorite result of the whole experiment. A clear question such as “Find oil discoveries within 10 km of gas pipelines” comes back as Discoveries filtered by Pipelines at 0.94. A genuinely ambiguous one spreads its probability across several answers instead of pretending. I did not have to write a single rule for that.&lt;/p&gt;

&lt;p&gt;And here is the other end of the spectrum. A question that names all three layers, with a subtype for each, comes back with no doubt at all:&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/feln-unsloth/main/docs/screenshot-confident.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/feln-unsloth/main/docs/screenshot-confident.png&quot; alt=&quot;FELN Layer Decider web page: “Which injection pipelines cross condensate discoveries and are within 2 km of salt wells?” is answered Pipelines filtered by Discoveries and Wells at 99.6% confidence, marked Confident, 3 layers, in 89 milliseconds.&quot; style=&quot;max-width:100%;height:auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;Pipelines returned, filtered by Discoveries and Wells: 99.6% confidence, 3 layers, 89 ms.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2&gt;Try it yourself&lt;/h2&gt;

&lt;p&gt;You need a machine with an NVIDIA GPU for training and for the web page&#39;s backend. The 0.8B model is small: its training runs used a few GB of GPU memory. Unsloth&#39;s guide also lists a desktop app for macOS, Windows and Linux, but I used the Python route. Everything below runs from a clone of the repository.&lt;/p&gt;

&lt;p&gt;First, the environment and the data. &lt;code&gt;prepare.py&lt;/code&gt; uses only the standard library. It turns a &lt;code&gt;FELN.json&lt;/code&gt; file into the training, validation and test rows, and prints the two baselines. The repository already includes the exact splits I used under &lt;code&gt;data/&lt;/code&gt;, so you can skip that step.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git clone https://github.com/mraad/feln-unsloth.git
cd feln-unsloth
uv venv -p 3.12 .venv
uv pip install -p .venv/bin/python unsloth datasets fastapi uvicorn

# optional: rebuild data/ from your own FELN.json
python3 prepare.py path/to/FELN.json data&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then train a model. I run this inside tmux, so a dropped SSH connection does not end the run. It takes about five minutes for the 0.8B model and writes the adapter, a merged model, the metrics and every test prediction under &lt;code&gt;runs/q08-r16&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;tmux new -s feln-unsloth
CUDA_VISIBLE_DEVICES=0 .venv/bin/python train.py \
  --model unsloth/Qwen3.5-0.8B --out runs/q08-r16

# a quick question from the command line
.venv/bin/python predict.py runs/q08-r16/adapter \
  &quot;Find oil discoveries within 10 km of gas pipelines.&quot;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Finally, start the web page. &lt;code&gt;app.py&lt;/code&gt; is a small FastAPI service, and it serves the single-page application (&lt;code&gt;index.html&lt;/code&gt;, plain JavaScript with no build step) from the same port. Every trained run under &lt;code&gt;runs/&lt;/code&gt; shows up in the model picker.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;CUDA_VISIBLE_DEVICES=0 .venv/bin/python -m uvicorn app:app \
  --host 127.0.0.1 --port 8095&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Open &lt;code&gt;http://localhost:8095&lt;/code&gt; on the same machine. My GPU box is in the cloud, so I keep the service on localhost and reach it from my Mac through an SSH tunnel instead of opening a port. There is no authentication on this little tester.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ssh -fN -L 8095:127.0.0.1:8095 my-gpu-box
open http://localhost:8095&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The first question takes about 14 seconds while the model loads. After that, each answer takes well under a second. The page also exposes a tiny JSON API if you want to call it from your own code:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;curl -s -X POST http://localhost:8095/api/decide \
  -H &quot;Content-Type: application/json&quot; \
  -d &#39;{&quot;text&quot;: &quot;Show me all dry wells.&quot;, &quot;model&quot;: &quot;q08-r16&quot;}&#39;&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;What this does and does not show&lt;/h2&gt;

&lt;p&gt;The test questions come from the same generator and humanizer as the training questions, so these numbers describe synthetic North Sea wording. I have not measured accuracy on questions from real users, and those will be messier. I also did not benchmark inference speed or memory beyond the web tester, and I have not tried serving it through Unsloth Studio&#39;s Decision API. One last detail for the curious: Unsloth&#39;s built-in &lt;code&gt;evaluate&lt;/code&gt; and the per-question &lt;code&gt;predict&lt;/code&gt; disagreed by one to three questions on a few runs. It is not batching. I report the &lt;code&gt;predict&lt;/code&gt; numbers, since that is the serving path.&lt;/p&gt;

&lt;h2&gt;What is next&lt;/h2&gt;

&lt;p&gt;I see this decision model as a router in front of the FELN generators rather than a replacement for them:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Decide the layers first with a calibrated probability, then let the LoRA or WebGPU model generate a plan constrained to those layers.&lt;/li&gt;
  &lt;li&gt;Send low-confidence questions back to the user with the two top candidates, such as “Did you mean condensate pipelines or condensate discoveries?”&lt;/li&gt;
  &lt;li&gt;Fix the humanizer so a paraphrase can never drop or swap a layer noun, then retrain.&lt;/li&gt;
  &lt;li&gt;Try the 0.8B or Laya locally on the Mac, next to the rest of the FELN pipeline.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The code, data splits, per-question predictions for every run, and a &lt;a href=&quot;https://github.com/mraad/feln-unsloth/blob/main/docs/REPORT.md&quot;&gt;detailed report&lt;/a&gt; are on GitHub in &lt;a href=&quot;https://github.com/mraad/feln-unsloth&quot;&gt;feln-unsloth&lt;/a&gt;. Big thanks to the Unsloth team for making this so approachable. The &lt;a href=&quot;https://unsloth.ai/docs/basics/train-your-own-decision-model-with-unsloth&quot;&gt;guide&lt;/a&gt; got me from zero to a calibrated model in an afternoon. If you have a GIS task with a fixed set of answers, I would love to hear where you would plug in a model like this. More to come!&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/7368944872125247011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/7368944872125247011' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/7368944872125247011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/7368944872125247011'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/10/feln-decisions-teaching-small-model.html' title='FELN Decisions: Teaching a Small Model Which Layers a Question Needs'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-1941350238738311641</id><published>2026-10-08T14:17:31.918-04:00</published><updated>2026-10-08T14:17:31.919-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS"/><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="MCP"/><title type='text'>arcpi: Not Everything Needs an MCP to Be Agentic</title><content type='html'>&lt;p&gt;Every time I open my feed these days, somebody has wrapped an API in an MCP server. Weather? MCP. Calendar? MCP. I fully expect my toaster to ship one next week. Don&#39;t get me wrong, I like MCP and I use it. But I kept staring at the ArcGIS REST API, with years of well-documented endpoints for search, geocoding, routing, demographics and maps, and asking myself a simple question: does an agent really need another server in front of all of that to be agentic?&lt;/p&gt;

&lt;p&gt;So I built &lt;a href=&quot;https://github.com/mraad/arcpi&quot;&gt;arcpi&lt;/a&gt; to find out.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://raw.githubusercontent.com/mraad/arcpi/main/docs/overview/images/side-by-side.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/arcpi/main/docs/overview/images/side-by-side.jpg&quot; alt=&quot;The pi conversation in the terminal on the left, and the live map with two drive-time areas and their hatched yellow overlap on the right&quot; width=&quot;100%&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;The old way and the new way, in one script&lt;/h3&gt;

&lt;p&gt;arcpi runs on &lt;a href=&quot;https://pi.dev/docs/latest&quot;&gt;pi&lt;/a&gt;, a minimalist agent harness that lives in the terminal. I gave it four small Markdown skills, written from the Esri REST documentation, that tell the model which endpoint to call and with which parameters. And one TypeScript extension that makes the HTTP call as the signed-in user. That&#39;s it. No ArcGIS MCP server, no build step, no dependencies.&lt;/p&gt;

&lt;p&gt;The magic is code mode. Instead of calling one tool, waiting, thinking, and calling the next, the agent writes one small JavaScript program and runs it in a locked-down sandbox. In that same program it can call plain ArcGIS REST endpoints through &lt;code&gt;tools.arcgis_request&lt;/code&gt; (the old way) and an MCP tool through &lt;code&gt;tools.mcp__mappi__run_map_code&lt;/code&gt; (the new way). The program chains the calls, filters the results, and hands only the answer back to the model. This idea isn&#39;t mine: Cloudflare&#39;s &lt;a href=&quot;https://blog.cloudflare.com/code-mode/&quot;&gt;Code Mode&lt;/a&gt; post and Armin Ronacher&#39;s &lt;a href=&quot;https://lucumr.pocoo.org/2026/10/6/codemode/&quot;&gt;What is Codemode&lt;/a&gt; got me thinking. I just pointed it at REST and MCP at the same time.&lt;/p&gt;

&lt;p&gt;And that is the point I want to make. MCP is not going away. The live map in arcpi, mappi, is an MCP server, because it is a running browser page and that is exactly what MCP is good at. But the ArcGIS services already have a documented interface, so I let the agent use it directly. Use MCP where it earns its keep, use the existing API where it already exists, and let code mode glue them together.&lt;/p&gt;

&lt;h3&gt;A real run&lt;/h3&gt;

&lt;p&gt;Here is what I asked it: &lt;em&gt;locate the Empire State Building and the World Trade Center, create a 10-minute drive-time polygon around each, and if they intersect, show the intersection with hashed yellow markers. Make sure the map shows everything.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The agent read the ArcGIS skill and the three references it needed, then wrote one program. That program geocoded both landmarks, solved both drive-time areas in a single routing request, asked the geometry service for the overlap, and drew all of it on the live map. The ArcGIS part took 5.3 seconds. The whole answer took about three minutes, and most of that was the model thinking.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://raw.githubusercontent.com/mraad/arcpi/main/docs/overview/images/map.jpg&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/arcpi/main/docs/overview/images/map.jpg&quot; alt=&quot;Map of Manhattan with a blue 10-minute drive-time area around the Empire State Building, a red one around the World Trade Center, and two small yellow hatched overlap areas&quot; width=&quot;100%&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice what the model never saw: coordinates. Shapes are saved to files and passed around by reference, so the model reads &quot;a polygon with 42 vertices in this file&quot;, not the 42 vertices. The chat gets the explanation, the map gets the geometry. I like keeping those two apart.&lt;/p&gt;

&lt;p&gt;And guess what? When I looked at the first recording, the model had spent more than three minutes reasoning, mostly second-guessing how to call the geometry service&#39;s intersect operation and what an empty result would look like. The skill had no example for it. I added one, re-recorded, and the reasoning dropped from about 11,500 characters to about 7,000 and the answer came back faster. Skills are documentation, and better documentation makes a faster agent. These are single runs, not benchmarks, but it was fun to watch.&lt;/p&gt;

&lt;h3&gt;p(døøm) = 0&lt;/h3&gt;

&lt;p&gt;Now, the important part: making sure the agent does not kill us all. I wrote up how to run arcpi inside NVIDIA&#39;s &lt;a href=&quot;https://github.com/NVIDIA/OpenShell&quot;&gt;OpenShell&lt;/a&gt;, where everything is denied unless a policy explicitly allows it. The network is closed except for the model API and ArcGIS, the credentials stay outside the sandbox as placeholders, and anything the agent tries that isn&#39;t allowed shows up in the logs. By my math:&lt;/p&gt;

&lt;pre&gt;p(døøm) = p(agent goes rogue) × p(OpenShell lets it out)
        = p(agent goes rogue) × 0
        = 0&lt;/pre&gt;

&lt;p&gt;Airtight. Well, almost. The OpenShell recipe is written but I have not run it yet, so for now the honest error bar is 0 ± &quot;I&#39;ll let you know&quot; :-)&lt;/p&gt;

&lt;h3&gt;Try it&lt;/h3&gt;

&lt;p&gt;The code is on &lt;a href=&quot;https://github.com/mraad/arcpi&quot;&gt;GitHub&lt;/a&gt;, and there is a short, plain-language walkthrough with screenshots &lt;a href=&quot;https://claude.ai/artifact/HpyuGwA4cgNMCwhZiSpxJS&quot;&gt;here&lt;/a&gt;. Before you write your next MCP server, check whether the API documentation plus code mode already gets you there. Sometimes it does, and sometimes you want both. More to come.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/1941350238738311641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/1941350238738311641' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/1941350238738311641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/1941350238738311641'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/10/arcpi-not-everything-needs-mcp-to-be.html' title='arcpi: Not Everything Needs an MCP to Be Agentic'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-873560247105354372</id><published>2026-09-30T14:49:31.000-04:00</published><updated>2026-09-30T16:27:45.242-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArcGIS"/><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><category scheme="http://www.blogger.com/atom/ns#" term="Talks"/><title type='text'>ProCowork: Letting Claude Drive ArcGIS Pro</title><content type='html'>&lt;p&gt;
  This past July, I had the pleasure of presenting ProCowork at the
  &lt;a href=&quot;https://www.esri.com/en-us/about/events/uc/overview&quot;&gt;Esri User Conference&lt;/a&gt;
  in San Diego. For those who could not make it (or were busy chasing the next session
  across the convention center), here is the short version of what I showed, and why I
  built it.
&lt;/p&gt;

&lt;p&gt;
  I have been playing with GenAI and GIS for a while now. Asking a language model to
  &lt;em&gt;write&lt;/em&gt; ArcPy is old news. What I really wanted was a model that could
  &lt;em&gt;do&lt;/em&gt; the work, on my open project, inside my running
  &lt;a href=&quot;https://www.esri.com/en-us/arcgis/products/arcgis-pro/overview&quot;&gt;ArcGIS Pro&lt;/a&gt;
  session, while I watch.
&lt;/p&gt;

&lt;p&gt;
  &lt;a href=&quot;https://github.com/mraad/ProCowork&quot;&gt;ProCowork&lt;/a&gt; is an experimental ArcGIS
  Pro add-in that puts the
  &lt;a href=&quot;https://www.claude.com/product/claude-code&quot;&gt;Claude Code&lt;/a&gt; engine in a
  dockable chat panel. You type a request, Claude writes the Python, the add-in runs it
  against the live map, and the code and the results come back into the same panel. So I
  can type things like:
&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;“List the layers in the current map.”&lt;/li&gt;
  &lt;li&gt;“Add a DOUBLE field POP_DEN to Parcels and set it to POP / AREASQMI.”&lt;/li&gt;
  &lt;li&gt;“Select parcels where POP_DEN &amp;gt; 5000 and zoom to them.”&lt;/li&gt;
  &lt;li&gt;“Buffer Roads by 100 meters and add the result to the map.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
  And it just does it. No copy and paste into the Python window. It even knows about my
  current selection, so “calculate this for the selected parcels” touches only the
  selected parcels :-)
&lt;/p&gt;

&lt;p&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/ProCowork/main/docs/screenshot.png&quot;&gt;
    &lt;img src=&quot;https://raw.githubusercontent.com/mraad/ProCowork/main/docs/screenshot.png&quot;
         alt=&quot;ProCowork docked in ArcGIS Pro: a prompt asking to summarize water mains by material, Claude&#39;s answer with a summary table, and the Water_Main layer symbolized by material on the live map&quot;
         style=&quot;max-width:100%; height:auto;&quot;&gt;
  &lt;/a&gt;
  &lt;br&gt;
  &lt;em&gt;Summarize the water mains by material, then symbolize them. Claude noticed Web
  Mercator inflates &lt;code&gt;SHAPE_Length&lt;/code&gt; by about 34% at this latitude and used
  true ground length instead.&lt;/em&gt;
&lt;/p&gt;

&lt;h2&gt;The one tricky part&lt;/h2&gt;

&lt;p&gt;
  Here is the catch. &lt;code&gt;arcpy.mp.ArcGISProject(&quot;CURRENT&quot;)&lt;/code&gt;, the thing that
  gives you the open project, only works inside Pro&#39;s own Python, on Pro&#39;s own thread.
  Claude Code runs outside of Pro, as a separate process. From out there it can see
  files on disk, but not your open map.
&lt;/p&gt;

&lt;p&gt;
  My first try kept a long-running Python process inside Pro. It worked, until it went
  stale. So I flipped it around. A small C# bridge now lives inside Pro for the whole
  session and listens only on the local machine. Claude talks to it using the
  &lt;a href=&quot;https://modelcontextprotocol.io/&quot;&gt;Model Context Protocol (MCP)&lt;/a&gt;. Quick
  questions, like “what layers do I have?”, are answered right away by the .NET SDK.
  Anything that changes data runs as one fresh ArcPy geoprocessing tool that does its
  job and goes away. Nothing is left behind to go stale.
&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Chat panel (inside ArcGIS Pro)
  -&amp;gt; Claude Code (headless, on my machine)
    -&amp;gt; MCP over http://127.0.0.1:&amp;lt;random-port&amp;gt;
      -&amp;gt; C# bridge (inside ArcGIS Pro)
        -&amp;gt; .NET SDK for reads, or one fresh ArcPy tool for writes
          -&amp;gt; the live map&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
  The bridge offers 14 tools. Most are simple ones like &lt;code&gt;list_layers&lt;/code&gt;,
  &lt;code&gt;add_field&lt;/code&gt;, and &lt;code&gt;run_geoprocessing&lt;/code&gt;. The star of the show is
  &lt;code&gt;run_python_current&lt;/code&gt;, which lets Claude run any ArcPy it needs when the
  simple tools are not enough. And it uses your existing Claude Code login, so there is
  no API key baked into the add-in.
&lt;/p&gt;

&lt;h2&gt;A word of caution&lt;/h2&gt;

&lt;p&gt;
  By default, ProCowork runs in what I call YOLO mode. The generated code runs on your
  open project right away, with no approval prompt. That is what makes it fun, and it
  is also exactly as dangerous as it sounds. ArcPy can edit and delete real data. Keep
  backups, and please do not point it at the only copy of anything you care about.
&lt;/p&gt;

&lt;p&gt;
  This is my personal experiment, not an Esri product, and it is not supported by Esri.
  It needs Windows, ArcGIS Pro 3.7, and Claude Code.
&lt;/p&gt;

&lt;p&gt;
  The source code and build steps are in the
  &lt;a href=&quot;https://github.com/mraad/ProCowork&quot;&gt;ProCowork repository&lt;/a&gt;. Next on my
  list is a proper review-and-approve step, so you can see what Claude is about to do
  before it touches your data. Thanks to everyone who came to the session in San Diego.
&lt;/p&gt;

&lt;p&gt;More to come :-)&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/873560247105354372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/873560247105354372' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/873560247105354372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/873560247105354372'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/09/procowork-letting-claude-drive-arcgis.html' title='ProCowork: Letting Claude Drive ArcGIS Pro'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-3683155687055416715</id><published>2026-09-28T11:41:36.000-04:00</published><updated>2026-09-28T11:51:54.908-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="MLX"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Lunar CLM: From 869 ms to 20 ms per Decision on a Mac</title><content type='html'>&lt;p&gt;In &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/the-trainee-got-better-it-still-cannot.html&quot;&gt;my last lander post&lt;/a&gt; I spent a few paragraphs on &lt;a href=&quot;https://typesafe.ai/blog/introducing-system-one-models-and-jev&quot;&gt;Jev&lt;/a&gt;, the System One decision model TypeSafe AI opened to early access this month. You hand it a block of state and typed questions, and it returns a probability for every choice. No text to parse. I also made a claim I had not tested: my lander talks to its model through one call, &lt;code&gt;agent.predict(prompt, QUESTIONS)&lt;/code&gt;, so swapping in a different decision model should be an adapter, not a redesign.&lt;/p&gt;

&lt;p&gt;Then I read about &lt;a href=&quot;https://contrastive-lm.notion.site&quot;&gt;Contrastive Language Models&lt;/a&gt; (CLM). It takes the same contract and builds it in the open: a block of state in, typed questions, a probability per choice out, with &lt;a href=&quot;https://github.com/Contrastive-LM/CLM&quot;&gt;source code&lt;/a&gt; and released 8B heads you can run yourself. Its server even answers on an endpoint called &lt;code&gt;/v1/systemone&lt;/code&gt;. Jev I can only read about. CLM I could actually test. I had to find out.&lt;/p&gt;

&lt;p&gt;The adapter part turned out to be true. It was everything after that which kept me busy.&lt;/p&gt;

&lt;p style=&quot;text-align:center&quot;&gt;&lt;a href=&quot;https://github.com/mraad/lunar-clm&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/lunar-clm/main/docs/landing.gif&quot; alt=&quot;A small trained CLM rights an upside-down lunar lander, crosses two hills and lands on the tallest pad&quot; width=&quot;760&quot; style=&quot;max-width:100%;height:auto&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center&quot;&gt;&lt;em&gt;The small CLM I trained on my Mac, with no overrides. The lander starts upside down and at rest over the left hill, rights itself, crosses two hills and lands on the tallest and narrowest pad. That is 639 decisions over 128 simulated seconds, shown at about 8&amp;times; speed. Every decision matched the guidance request.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;Why I keep asking for structured decisions&lt;/h2&gt;

&lt;p&gt;This is not a new drum for me. Since &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/lunar-laya-from-state-and-text-to.html&quot;&gt;Lunar Laya&lt;/a&gt; I have argued that a model making decisions should take &lt;strong&gt;state&lt;/strong&gt; as input, maybe with some structured text, and return a &lt;strong&gt;structured&lt;/strong&gt; answer: a fixed set of choices, a probability for each, and a deterministic rule for picking one. Jev and CLM arrive at that same contract from two different directions, one as a hosted product and one as open research. Seeing two separate teams converge on it is a big part of why this experiment happened.&lt;/p&gt;

&lt;p&gt;The reason I keep pushing is measurement. When every decision is a typed choice made from a known state, I can log it next to what should have happened, count the agreement, time it, replay it and point at the exact frame where a flight went wrong. A free-form answer gives me prose to interpret. A structured answer gives me a number I can compare across runs, models and hardware.&lt;/p&gt;

&lt;p&gt;And once a decision can be quantified, it can be improved on purpose. Find the states where it was wrong, relabel them, retrain, and measure again. That loop is how a system gets better by itself, and it only closes because the output is structured. &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/the-engineer-and-trainee-adaptive-mpc.html&quot;&gt;The trainee posts&lt;/a&gt; are one turn of that loop, and this post is another. Every number below comes from comparing a typed decision against a reference.&lt;/p&gt;

&lt;h2&gt;The real thing was slow&lt;/h2&gt;

&lt;p&gt;CLM works differently from Laya. It embeds the flight state once per question, embeds every candidate action description separately, runs both through trained projection heads and picks the closest match. The action side never changes, so the official server caches it. I installed the official &lt;code&gt;contrastive-lm&lt;/code&gt; 0.1.0 engine with its released heads on my Apple M4 Max, had llama.cpp serve the Qwen3-8B embeddings on Metal, and pointed the same lander at it.&lt;/p&gt;

&lt;p&gt;The median decision took &lt;strong&gt;869 ms&lt;/strong&gt;. The lander asks for a decision every 0.2 seconds of simulated time, and CLM met that deadline on none of the 96 states I sampled. It also agreed with both guidance requests on only 15 of them. On one complete flight, raw CLM left the engine off and hit the pad too fast after 93 decisions. Those 18 simulated seconds took 74 seconds of wall time.&lt;/p&gt;

&lt;p&gt;Is that fair to CLM? Not entirely. I ran a Q8 quantized encoder through llama.cpp, not the official BF16 setup on vLLM and a GPU. The model had also never seen this task, while the Laya checkpoint I compare against was trained for exactly this job. But the time is not a mystery. Every decision pushes two question-conditioned states, 250&amp;ndash;266 tokens in total, through an 8B encoder. Skipping text generation does not skip the encoder.&lt;/p&gt;

&lt;h2&gt;Keep the idea, shrink everything else&lt;/h2&gt;

&lt;p&gt;What I like about CLM is the shape of it: the state goes on one side, the possible actions on the other, and a decision is a similarity score between them. So I kept that shape and rebuilt everything around it for this one task:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A frozen &lt;strong&gt;Qwen3-Embedding-0.6B&lt;/strong&gt; encoder, using a pinned 8-bit MLX conversion.&lt;/li&gt;
&lt;li&gt;Two new projection heads, 1024 &amp;rarr; 128 &amp;rarr; 64, with &lt;strong&gt;278,912 trainable parameters&lt;/strong&gt; in total. Nothing else is trained.&lt;/li&gt;
&lt;li&gt;One question over nine combined rotation and thrust actions, instead of two questions. The nine action embeddings are computed once, when the model loads.&lt;/li&gt;
&lt;li&gt;A shorter observation of 63&amp;ndash;69 tokens.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The training data comes from guidance flights on seeds 1000&amp;ndash;1031, with validation on 2000&amp;ndash;2007. Embedding 3,159 examples and training the heads took &lt;strong&gt;42 seconds&lt;/strong&gt; on the Mac. Before training, I measured the untouched encoder: raw similarity picked the right action 80.4% of the time. After training the heads, it got every validation example right. That is the loop from above in miniature: measure, train, measure again.&lt;/p&gt;

&lt;p&gt;One bench note, because it was not obvious: batching with left padding produced non-finite values in the MLX runtime&#39;s attention. Switching to right padding and pooling the last real token fixed it. Batched and single embeddings now agree to a cosine similarity of 0.99996.&lt;/p&gt;

&lt;p&gt;Now the best part. Here is the same set of 96 flight states across every deployment I have tried:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;th&gt;Median ms&lt;/th&gt;&lt;th&gt;p95 ms&lt;/th&gt;&lt;th&gt;Agrees with guidance&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;CLM, released heads + Qwen3-8B Q8&lt;/td&gt;&lt;td&gt;869.00&lt;/td&gt;&lt;td&gt;1,378.07&lt;/td&gt;&lt;td&gt;15 / 96&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Public Laya, MLX FP16&lt;/td&gt;&lt;td&gt;18.50&lt;/td&gt;&lt;td&gt;37.39&lt;/td&gt;&lt;td&gt;53 / 96&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Lunar-trained Laya, MLX Q6&lt;/td&gt;&lt;td&gt;26.56&lt;/td&gt;&lt;td&gt;39.47&lt;/td&gt;&lt;td&gt;96 / 96&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Small CLM, MLX 8-bit&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&lt;strong&gt;19.79&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&lt;strong&gt;23.95&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&lt;strong&gt;96 / 96&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;That is a &lt;strong&gt;43.9&amp;times;&lt;/strong&gt; lower median than the 8B deployment, and every decision fits inside the 200 ms control interval. On nine flights it had never seen, it landed all nine without a single override, and all 3,351 decisions matched guidance.&lt;/p&gt;

&lt;p&gt;I want to be careful about why it got faster, because it is tempting to credit the training. Training made the decisions accurate. It did not make the encoder do less work. The speed came from a smaller encoder, a shorter prompt, one question instead of two, and running in-process with no HTTP. I did not measure how much each one contributed.&lt;/p&gt;

&lt;h2&gt;Then I put the pads on hills&lt;/h2&gt;

&lt;p&gt;Replays are nice, but I wanted to poke at it. So the pads moved onto three separate hilltops at 70, 140 and 210 meters, and the replay page became a small interactive app. You click the sky to place the lander, turn a tilt slider all the way around (upside down included), pick a pad and press Launch. A small Python server flies the chosen pilot and streams each decision to the browser as it happens, so playback starts right away.&lt;/p&gt;

&lt;p&gt;The hills broke my guidance controller first. It used to hold a fixed height above the target pad, which is a fine rule until a 210-meter hill sits between you and a 70-meter pad. Now it holds 120 meters above the &lt;em&gt;highest&lt;/em&gt; terrain between the lander and the pad, climbs before moving sideways when it starts below a ridge, and refuses to fire the engine past 60&amp;deg; of tilt, where thrust pushes sideways or down. It rights itself first. I checked it on a grid of 3,348 valid starts across every pad and tilt, and all of them landed.&lt;/p&gt;

&lt;p&gt;And guess what? The small CLM needed no retraining for any of this. Unchanged, it landed nine held-out seeds and 18 custom starts on the new terrain, including the inverted and far-away ones. Every decision matched guidance.&lt;/p&gt;

&lt;h2&gt;What this does and does not show&lt;/h2&gt;

&lt;p&gt;Same caveat as the Laya posts, and it matters just as much here. The prompt contains the guidance controller&#39;s requested rotation and thrust. The model reads &amp;ldquo;Requested rotation: left. Requested thrust: half.&amp;rdquo; and picks the matching action out of nine. Those perfect scores measure how reliably and quickly it follows a request, which is exactly the property I want from a bounded decision, but it is not the model flying on its own.&lt;/p&gt;

&lt;p&gt;The comparison table is not a controlled architecture test either. The prompts, the number of questions and the runtimes all differ, and the table says nothing about CLM at data-center scale, where its authors make their speed claims against Jev. The measurements in the repository were taken on the original terrain, where the pads sat in valleys. They are kept as a record of that setup.&lt;/p&gt;

&lt;h2&gt;Try it&lt;/h2&gt;

&lt;p&gt;The baseline pilot needs nothing but Python, so you can place the lander yourself in about a minute:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git clone https://github.com/mraad/lunar-clm
cd lunar-clm
python3 -m lunar_clm.serve --pilot baseline&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then open &lt;code&gt;http://127.0.0.1:8000/&lt;/code&gt;. The small CLM pilot needs the MLX setup described in the README, and it runs in-process with no servers of its own.&lt;/p&gt;

&lt;p&gt;Next, I want to take the requested labels out of the prompt and see what is left. The measurement will tell me exactly which states it gets wrong, and those states become the next training set. That is the self-improvement loop I keep talking about, closed on a model that is finally fast enough to fly inside it. It is future work, not something this post demonstrates. The &lt;a href=&quot;https://github.com/mraad/lunar-clm&quot;&gt;source code&lt;/a&gt;, &lt;a href=&quot;https://github.com/mraad/lunar-clm/blob/main/results/SMALL-CLM.md&quot;&gt;training details&lt;/a&gt; and &lt;a href=&quot;https://github.com/mraad/lunar-clm/blob/main/results/COMPARISON.md&quot;&gt;the full 8B comparison&lt;/a&gt; are on GitHub under Apache 2.0. Put the lander upside down over the tallest hill and tell me where it breaks. More to come. :-)&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/3683155687055416715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/3683155687055416715' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/3683155687055416715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/3683155687055416715'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/09/lunar-clm-from-869-ms-to-20-ms-per.html' title='Lunar CLM: From 869 ms to 20 ms per Decision on a Mac'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-8089864158300877921</id><published>2026-09-22T14:06:52.359-04:00</published><updated>2026-09-22T14:06:52.359-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="MLX"/><category scheme="http://www.blogger.com/atom/ns#" term="MPC"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>The Trainee Got Better. It Still Cannot Fly Alone.</title><content type='html'>&lt;p&gt;I ended &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/the-engineer-and-trainee-adaptive-mpc.html&quot;&gt;The Engineer and the Trainee&lt;/a&gt; with a plan: roll out the shielded pilot, relabel every visited state with MPC, retrain, and see whether the trainee could finally fly on its own. That is still the plan. But before getting there I did something lazier, and the result was more interesting than I expected. I also fixed something that had been bothering me every time I watched a flight.&lt;/p&gt;

&lt;p style=&quot;text-align:center&quot;&gt;&lt;a href=&quot;https://github.com/mraad/lunar-mpc-laya&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/lunar-mpc-laya/main/docs/assets/distilled-shield.gif&quot; alt=&quot;Distilled Laya proposing commands from telemetry while adaptive MPC vetoes unsafe ones, landing through a 60% engine loss&quot; width=&quot;1000&quot; style=&quot;max-width:100%;height:auto&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center&quot;&gt;&lt;em&gt;The same recorded flight as last time, re-run with a smoother controller and a retrained model. The engine loses 60% of its thrust at ten seconds, the estimate falls to 40%, and the shield now steps in on about one command in eight instead of one in three.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;The lander had the shakes&lt;/h2&gt;

&lt;p&gt;Watching a descent, the ship twitched. Not a rendering artifact &amp;mdash; the controller really was changing its mind. I measured it: over 30 flights the beam search picked a different command on &lt;strong&gt;77.7%&lt;/strong&gt; of decisions. Every fifth of a second it re-derived the whole plan from scratch, and when two commands were nearly tied it would happily alternate between them. The tank chattered between throttle settings and the attitude jets flipped sign.&lt;/p&gt;

&lt;p&gt;The fix is one term in the cost function: charge a candidate for differing from the command actually being flown. One knob, normalized so it covers tilt and throttle together. Here is what it bought, measured over seeds 3000&amp;ndash;3009 on all three pads:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;th&gt;No penalty&lt;/th&gt;&lt;th&gt;With penalty&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Decisions that change command (nominal)&lt;/td&gt;&lt;td&gt;77.7%&lt;/td&gt;&lt;td&gt;20.6%&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Stage-to-stage tilt jerk&lt;/td&gt;&lt;td&gt;5.37&amp;deg; RMS&lt;/td&gt;&lt;td&gt;1.69&amp;deg; RMS&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Landings, all three scenarios&lt;/td&gt;&lt;td&gt;30/30&lt;/td&gt;&lt;td&gt;30/30&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Fuel remaining at &amp;times;0.4 thrust&lt;/td&gt;&lt;td&gt;62.6&lt;/td&gt;&lt;td&gt;65.6&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Not a trade at all, which surprised me. Smoother, and it landed the same flights using &lt;em&gt;less&lt;/em&gt; fuel and slightly fewer decisions. The commands it stopped issuing were mostly ones it would have undone on the next stage anyway.&lt;/p&gt;

&lt;h2&gt;The same fix broke the sibling project&lt;/h2&gt;

&lt;p&gt;Naturally I tried the identical change in &lt;a href=&quot;https://github.com/mraad/lunar-mpc&quot;&gt;lunar-mpc&lt;/a&gt;, the Box2D controller this one descends from. On nominal flights it looked like a win: 49 of 50 strict landing checks went to 50 of 50. I nearly kept it.&lt;/p&gt;

&lt;p&gt;Then I measured the engine-fault scenario &amp;mdash; the one that repository exists to demonstrate &amp;mdash; and it fell from 49/50 to &lt;strong&gt;41/50&lt;/strong&gt;. The fixed-model controller went from 42/50 to 24/50. The reason is obvious in hindsight: that lander&#39;s main engine is binary, on or off, so rapid pulsing is precisely how it holds a thrust level between the two. Charging for the pulses removes its only means of modulating thrust. Here, with three throttle settings, holding one is a real option.&lt;/p&gt;

&lt;p&gt;So I reverted it there and wrote the numbers into that repository&#39;s research limits, because a rule that only holds in one of two codebases is worth recording where someone will trip over it. The broader lesson I have now written into my own notes: sweep a control-cost change over &lt;em&gt;every&lt;/em&gt; published scenario before adopting it, not the one that runs quickest.&lt;/p&gt;

&lt;h2&gt;A consequence I did not plan for&lt;/h2&gt;

&lt;p&gt;Once the controller penalizes changing command, its next choice depends on what it is currently doing. Roughly four decisions in five are now &amp;ldquo;hold what you are doing.&amp;rdquo; That makes the flown command the single most predictive feature of the teacher&#39;s answer &amp;mdash; and the trainee could not see it.&lt;/p&gt;

&lt;p&gt;So the prompt gained one sentence: &lt;em&gt;&amp;ldquo;Current command: tilt hold, engine half.&amp;rdquo;&lt;/em&gt; I want to be precise about why that is not a relapse into the hint-giving of the first experiment. MPC&#39;s &lt;strong&gt;requested&lt;/strong&gt; command is the teacher&#39;s answer, and the earlier post showed Laya simply copies it. The &lt;strong&gt;flown&lt;/strong&gt; command is actuator state, the kind any onboard controller reads from its own vehicle. The trainee still has to decide what to do next.&lt;/p&gt;

&lt;h2&gt;Retraining, on four GPUs this time&lt;/h2&gt;

&lt;p&gt;Same recipe as before, except the data came from the smoothed teacher and the run used all four RTX PRO 4500 Blackwell cards instead of three. Eight epochs in 235 seconds. Per-question validation accuracy went from &lt;strong&gt;80.0% to 90.2%&lt;/strong&gt;, and it passed 85% after the first epoch, better than anything the previous run reached in eight. A genuinely better student.&lt;/p&gt;

&lt;p&gt;Then I flew it on the same 90 held-out flights, and this is the part worth the post:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;th&gt;Previous checkpoint&lt;/th&gt;&lt;th&gt;Retrained&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Validation accuracy&lt;/td&gt;&lt;td&gt;80.0%&lt;/td&gt;&lt;td&gt;90.2%&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Landings, unshielded&lt;/td&gt;&lt;td&gt;0 / 90&lt;/td&gt;&lt;td&gt;1 / 90&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Landings, with the MPC shield&lt;/td&gt;&lt;td&gt;90 / 90&lt;/td&gt;&lt;td&gt;90 / 90&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Laya&#39;s own choice kept&lt;/td&gt;&lt;td&gt;55&amp;ndash;62%&lt;/td&gt;&lt;td&gt;80&amp;ndash;87%&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Shield overrides&lt;/td&gt;&lt;td&gt;30&amp;ndash;37%&lt;/td&gt;&lt;td&gt;12&amp;ndash;17%&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Ten points of accuracy bought exactly one landing out of ninety. The trainee is still not a pilot. One wrong command puts the ship slightly off the teacher&#39;s trajectory, the next state is less familiar, agreement collapses to about 17%, and the flight diverges. That is behaviour cloning without a corrective signal, and making the student more accurate on the teacher&#39;s own path does not fix it &amp;mdash; which is a sharper argument for DAgger than I had before, because it says the missing signal is off-trajectory states rather than label quality.&lt;/p&gt;

&lt;p&gt;What the better student &lt;em&gt;did&lt;/em&gt; buy is a shield that works less. Overrides roughly halved. Four commands in five that fly the ship are now the model&#39;s own. The fused pilot leans further toward the trainee while physics still holds the veto.&lt;/p&gt;

&lt;h2&gt;About Jev, since everyone is asking&lt;/h2&gt;

&lt;p&gt;TypeSafe AI put &lt;a href=&quot;https://typesafe.ai/blog/introducing-system-one-models-and-jev&quot;&gt;Jev&lt;/a&gt; into limited early access on 15 September, and the reaction has been loud. It is not a language model: you hand it a block of state and typed questions, and it returns a probability distribution per question plus a confidence score. No text, nothing to parse.&lt;/p&gt;

&lt;p&gt;Look at what my lander actually asks its model. A sentence of telemetry, two choice questions &amp;mdash; tilt {left, hold, right} and engine {off, half, full} &amp;mdash; and a probability per option. That &lt;em&gt;is&lt;/em&gt; Jev&#39;s contract. Laya sits behind a single call, &lt;code&gt;agent.predict(prompt, QUESTIONS)&lt;/code&gt;, and nothing below it knows what produced the answer. Swapping in a decision model would be an adapter, not a redesign.&lt;/p&gt;

&lt;p&gt;I have not measured Jev, and its speed, price and &amp;ldquo;cannot hallucinate&amp;rdquo; claims are the vendor&#39;s, not mine. But my results already answer some of what people are excited about, because those parts belong to the architecture rather than the model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A faster, better proposer is not a pilot.&lt;/strong&gt; I just moved a proposer from 80% to 90% and got one extra solo landing in ninety. Cheaper proposals do not change that.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Well-typed is not feasible.&lt;/strong&gt; Every command Laya emits is already well-formed &amp;mdash; &lt;code&gt;left&lt;/code&gt;/&lt;code&gt;hold&lt;/code&gt;/&lt;code&gt;right&lt;/code&gt; is always in range &amp;mdash; and 12&amp;ndash;17% of them were still overridden because simulating them forward cost more than the plan. A type system rules out unparseable answers, not physically bad ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The usual objection has a runtime answer.&lt;/strong&gt; People worry that a model returning bare numbers hides its reasoning. My shield never asks the model to explain itself; it rolls the proposal forward under learned physics and compares. Verification beats explanation when you can afford to simulate.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Calibration is the part I actually want&lt;/strong&gt;, and it is not free. My shield margin is a cost delta on a scale where a plan costs 0 to about 33, with a 1000-unit crash penalty on top. Confidence is a probability. Nothing converts one into the other, and a well-calibrated probability does not supply the conversion. The real step is calibrating the event the shield decides: the chance that a proposal&#39;s best rollout exceeds the plan by more than a given gap.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two things I would check before assuming a fit. My prompt is almost entirely numbers, and weakness on numbers is a reported limitation of this model class, so interface fit and content fit are separate questions. And a hosted API gives up the offline, on-device property that this project currently has, with roughly 14 ms per decision on a Mac and no network at all.&lt;/p&gt;

&lt;h2&gt;The usual caveats&lt;/h2&gt;

&lt;p&gt;The beam search is incomplete and the cost weights are hand-picked. The evaluation is ten held-out seeds per pad. One honest wrinkle: the original cost weights were tuned on seeds 0&amp;ndash;9, but the new switching weight was swept on seeds 3000&amp;ndash;3005, which sit inside the evaluation set. Every weight in that sweep landed every flight, so the choice turned on jerk and fuel rather than landings, and the landing counts are unchanged from before the penalty existed &amp;mdash; but it is tuned on that set, and the results page says so rather than leaving it implicit. None of this is flight software.&lt;/p&gt;

&lt;p&gt;Next up is still DAgger, and now calibration has a concrete definition to aim at. The browser lab, the measured results, the training recipe and the full write-up are at &lt;a href=&quot;https://github.com/mraad/lunar-mpc-laya&quot;&gt;github.com/mraad/lunar-mpc-laya&lt;/a&gt;. Go fly it and tell me where it breaks.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/8089864158300877921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/8089864158300877921' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/8089864158300877921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/8089864158300877921'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/09/the-trainee-got-better-it-still-cannot.html' title='The Trainee Got Better. It Still Cannot Fly Alone.'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-3912667290088102041</id><published>2026-09-21T16:41:20.166-04:00</published><updated>2026-09-21T16:41:20.166-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="MLX"/><category scheme="http://www.blogger.com/atom/ns#" term="MPC"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>The Engineer and the Trainee: Adaptive MPC Guiding and Shielding Laya</title><content type='html'>&lt;p&gt;Two of my recent lander experiments kept nagging at me. In &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/one-lander-three-controllers.html&quot;&gt;One Lander, Three Controllers&lt;/a&gt;, an adaptive MPC learned its engine during the flight and landed through a power loss with no training data at all. In &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/lunar-laya-from-state-and-text-to.html&quot;&gt;Lunar Laya&lt;/a&gt;, a small decision model on Apple MLX turned a text description of the flight into structured choices, but the text carried hints from a fixed feedback law that assumed a healthy engine. Cut the engine power and that model crashed every time, faithfully following bad advice. So I asked the obvious question: what happens if the engineer writes the hints for the trainee? The result is &lt;a href=&quot;https://github.com/mraad/lunar-mpc-laya&quot;&gt;Lunar MPC + Laya&lt;/a&gt;.&lt;/p&gt;

&lt;p style=&quot;text-align:center&quot;&gt;&lt;a href=&quot;https://github.com/mraad/lunar-mpc-laya&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/lunar-mpc-laya/main/docs/assets/distilled-shield.gif&quot; alt=&quot;Distilled Laya proposing commands from telemetry while adaptive MPC vetoes unsafe ones, landing through a 60% engine loss&quot; width=&quot;1000&quot; style=&quot;max-width:100%;height:auto&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center&quot;&gt;&lt;em&gt;An actual recorded flight. Laya proposes every command from telemetry alone; adaptive MPC vetoes about one in three. The engine loses 60% of its thrust at ten seconds, the estimate drops to 40%, and the lander touches down at seventy.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;The engineer and the trainee&lt;/h2&gt;

&lt;p&gt;The game is the same arcade-style lander from Lunar Laya: three pads on bumpy terrain, a tilt control, an engine with off, half and full, and one decision every fifth of a second. Land upright, slowly, inside a pad, before the fuel runs out. The twist is an unannounced fault: partway through the flight the main engine loses 30% or 60% of its power, and the pilot is never told.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MPC is the engineer.&lt;/strong&gt; It has the physics written down. Before every move it simulates thousands of command sequences three seconds ahead, picks the cheapest, executes only the first command, and replans. It also compares what it predicted with what actually happened and updates its estimate of engine strength by recursive least squares. Nobody trained it; I wrote its cost function by hand, and I ported it from the Box2D world of the earlier post to the arcade physics here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Laya is the trainee.&lt;/strong&gt; It reads a sentence like &amp;ldquo;Altitude 200 m, vertical velocity &amp;minus;8 m/s, tilt 3 degrees&amp;rdquo; and answers two multiple-choice questions: which way to tilt, how much engine. It learned from examples. It has no idea what gravity is.&lt;/p&gt;

&lt;h2&gt;Three ways they work together&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. The engineer whispers to the trainee.&lt;/strong&gt; Laya&#39;s prompt already ended with a requested rotation and power. I swapped the source of that request from the fixed feedback law to MPC&#39;s first planned command, and changed nothing else: same weights, same prompt template, byte for byte. With the old requests, Laya landed 17 of 30 flights through a 30% power loss and 0 of 30 through a 60% loss. With MPC&#39;s requests, 30 of 30 in both. Same brain, better advice. The interesting detail is that MPC&#39;s adaptation now reaches the language model through the words in the prompt. Laya never sees the fault; it sees requests that already account for it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The engineer checks the trainee&#39;s work.&lt;/strong&gt; The original Lunar Laya overrode the model every time it disagreed with guidance. That is safe but leaves the model no room. Here the shield is predictive: MPC forces Laya&#39;s proposal as the first command of a second beam search and compares the best achievable cost with its own plan. Only a proposal that is predicted to be worse gets replaced. Laya keeps its independence; physics keeps a veto.&lt;/p&gt;

&lt;p&gt;And here is the honest part. With the original checkpoint the shield never fired. Not once in 28,026 decisions. That model was fine-tuned to follow its prompt&#39;s request, and it follows it perfectly, so its flights are identical to MPC&#39;s own. Worse, when I appended a single sentence to the prompt with the engine estimate, request following collapsed to zero and every flight was lost. The checkpoint is welded to its training template. Useful to know before anyone puts a language model in a control loop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The trainee learns from the engineer, then flies with a safety net.&lt;/strong&gt; So I trained a second checkpoint. Same base model, same recipe as the first post, three RTX PRO 6000 GPUs, about seven minutes. This time the teacher was adaptive MPC, the rollouts included both fault levels, and the requested labels were removed from the prompt entirely. Laya has to decide from telemetry.&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pilot&lt;/th&gt;&lt;th&gt;Nominal&lt;/th&gt;&lt;th&gt;Thrust &amp;times;0.7&lt;/th&gt;&lt;th&gt;Thrust &amp;times;0.4&lt;/th&gt;&lt;th&gt;Laya&#39;s choice kept&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Distilled Laya, alone&lt;/td&gt;&lt;td&gt;0/30&lt;/td&gt;&lt;td&gt;0/30&lt;/td&gt;&lt;td&gt;0/30&lt;/td&gt;&lt;td&gt;&amp;mdash;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Distilled Laya + MPC shield&lt;/td&gt;&lt;td&gt;30/30&lt;/td&gt;&lt;td&gt;30/30&lt;/td&gt;&lt;td&gt;30/30&lt;/td&gt;&lt;td&gt;about two thirds&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Alone, it cannot land a single flight. Validation accuracy was 80% per question, which sounds fine until you remember that one wrong command moves the ship slightly off the teacher&#39;s trajectory, the next state is less familiar, and agreement with MPC falls to 10&amp;ndash;18%. That is the textbook behaviour-cloning failure, reproduced on my desk. With the shield on, the same weights land 90 of 90, and roughly two thirds of the commands that actually fly the ship are Laya&#39;s own. That is the first configuration where the fused pilot is neither controller alone.&lt;/p&gt;

&lt;h2&gt;Why bother, if the engineer alone can land?&lt;/h2&gt;

&lt;p&gt;Because the engineer can only do what its rules say. Its preferences are numbers in a cost function. It cannot be taught from examples, cannot take an instruction in plain language, and cannot tell you how confident it is. The trainee can do all three. What I want is a pilot with the trainee&#39;s flexibility and the engineer&#39;s guarantee that physics gets the last word. That pilot now exists and lands. It just needs the engineer to step in less often.&lt;/p&gt;

&lt;h2&gt;Try it in the browser&lt;/h2&gt;

&lt;p&gt;I ported the physics and the MPC to VanillaJS so you can fly it: click anywhere in the sky to place the lander, pick a pad, add a fault, and launch. A Node check verifies that the JavaScript reproduces every command of six Python-recorded flights. With the local Python server running, the same page flies both Laya checkpoints live on MLX and replays every recorded decision with the model&#39;s probabilities, MPC&#39;s request, Laya&#39;s proposal, and whether the shield fired.&lt;/p&gt;

&lt;p&gt;The usual caveats apply. The beam search is incomplete, the cost weights were hand-tuned on ten development seeds, the evaluation is ten held-out seeds per pad, and some starts are unrecoverable for every pilot, including MPC. The shield can only be as good as MPC&#39;s own plan.&lt;/p&gt;

&lt;p&gt;Next is the obvious one: roll out the shielded pilot, relabel every visited state with MPC, and retrain, so the trainee learns from the neighbourhood of its own mistakes. If that raises the raw landing count above zero and cuts the override rate, the loop is working. Source, docs, measured results and the browser lab are all at &lt;a href=&quot;https://github.com/mraad/lunar-mpc-laya&quot;&gt;github.com/mraad/lunar-mpc-laya&lt;/a&gt;. More to come.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/3912667290088102041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/3912667290088102041' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/3912667290088102041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/3912667290088102041'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/09/the-engineer-and-trainee-adaptive-mpc.html' title='The Engineer and the Trainee: Adaptive MPC Guiding and Shielding Laya'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-2665077756717008666</id><published>2026-09-21T10:54:53.632-04:00</published><updated>2026-09-21T10:54:53.632-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="MLX"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Lunar Laya: From State and Text to Decisions on a Mac</title><content type='html'>&lt;p&gt;I keep coming back to Lunar Lander. It gives me a very visible way to ask a simple question: what does a model actually decide? Turn too much, burn too late, or miss the pad, and the result is right there on the screen.&lt;/p&gt;

&lt;p&gt;After exploring learning and control approaches to this problem, I wanted to try another angle: give a small model the current state and a text instruction, then ask it for a decision that the application can execute and measure. That experiment is now public as &lt;a href=&quot;https://github.com/mraad/lunar-laya&quot;&gt;Lunar Laya&lt;/a&gt;, an Atari-inspired lander using Laya with local inference on Apple MLX.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I believe the input should be a state and a text, even a structured text. The output should always be structured and very deterministic, so it can be controlled and measured.&lt;/strong&gt; This implementation is a representation of that idea. The fact that the model can be small enough to run locally in an MLX environment is proof that it can be done for this kind of bounded decision task.&lt;/p&gt;

&lt;p style=&quot;text-align:center&quot;&gt;&lt;a href=&quot;https://github.com/mraad/lunar-laya&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/lunar-laya/main/docs/assets/trained-laya.gif&quot; alt=&quot;Trained Laya model controlling a lunar lander through a successful local MLX landing&quot; width=&quot;1000&quot; style=&quot;max-width:100%;height:auto&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center&quot;&gt;&lt;em&gt;An actual trained-model flight using FP16 MLX inference, shown at 4&amp;times; simulation speed. The input includes explicit guidance requests; no post-inference overrides were applied. The smaller Q6 version was evaluated separately.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;A small decision with a clear contract&lt;/h2&gt;

&lt;p&gt;The simulation exposes position, velocity, tilt, fuel and the landing target. A feedback controller calculates the requested correction. Those values and requests are serialized into text, and Laya answers two choice questions: rotate left, hold or right; and set the engine to off, half or full. Here, Laya is the decision model, not the LayaAir game engine.&lt;/p&gt;

&lt;p&gt;The model scores the allowed choices. The runtime selects the highest-scoring option and returns a structured answer with probabilities. For example, the choices inside an answer can look like this, with probabilities omitted for readability:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{
  &quot;rotation&quot;: {&quot;choice&quot;: &quot;hold&quot;},
  &quot;engine&quot;: {&quot;choice&quot;: &quot;half&quot;}
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The application maps those choices to a fixed command: zero rotation and 50% thrust. I can record the proposed command, what was executed, the next state and how long the decision took. That gives me something to inspect when a landing fails, and something precise to compare after changing the model.&lt;/p&gt;

&lt;p&gt;That is what I mean by a deterministic interface: a fixed set of outputs, an explicit selection rule and a predictable mapping into application behavior. Neural scores can still change with precision or hardware. A well-defined output contract makes those changes testable; it does not make every prediction correct.&lt;/p&gt;

&lt;h2&gt;Training it, then making it smaller&lt;/h2&gt;

&lt;p&gt;I added supervised training on three CUDA GPUs, keeping the original checkpoint available. Local inference uses MLX on the Mac; Python runs the simulator and guidance. A VanillaJS application lets us replay the recorded flights, inspect probabilities and compare controllers. It displays the experiments rather than running the model in the browser.&lt;/p&gt;

&lt;p&gt;Now the best part: the compact 6-bit version passed all 1,928 held-out validation examples and landed all 30 evaluated flights across three pads. Its 11,147 decisions agreed with the guidance requests, and its recorded state transitions matched the trained FP16 evaluation exactly.&lt;/p&gt;

&lt;p&gt;On an Apple M4 Max, peak active MLX inference memory dropped from about &lt;strong&gt;872 MiB to 370 MiB&lt;/strong&gt;, a 57.6% reduction. The weight file went from 614 MiB to 249 MiB. Those are model-runtime measurements: total process peak memory was about 709 MiB for Q6, including the surrounding software.&lt;/p&gt;

&lt;p&gt;The compact runtime loads packed MLX weights, removes an unused classifier and evaluates the two control questions sequentially. It also disables retained allocator caching to favor memory use. There is a tradeoff: median decision time increased from about 10.1 ms to 13.5 ms in this comparison.&lt;/p&gt;

&lt;p&gt;I tried smaller precisions too. Four-bit missed 215 validation answers; five-bit missed two. Six-bit was the smallest configuration tested that passed every validation answer. A smaller file is only useful if the behavior survives the change! The &lt;a href=&quot;https://github.com/mraad/lunar-laya/blob/main/docs/mlx-optimization.md&quot;&gt;optimization notes&lt;/a&gt; include the measurements and reproduction commands.&lt;/p&gt;

&lt;h2&gt;What this experiment demonstrates&lt;/h2&gt;

&lt;p&gt;The requested rotation and engine labels are already in the input. The trained model is learning to follow those requests. The feedback controller supplies the navigation knowledge, so the successful landings demonstrate guidance following, not independent discovery of a flight policy. The repository also includes a baseline that executes guidance directly, which is sufficient for this simulator.&lt;/p&gt;

&lt;p&gt;For me, the interesting result is the working connection between state, text and a bounded action. I want that same discipline when a model selects a GIS operation or chooses the next step in a data workflow: define what it can return, validate the result, and measure what happens. The lander makes that idea easy to watch.&lt;/p&gt;

&lt;p&gt;The next experiment I would like to try is varying the instruction while keeping the output contract fixed, then measuring where the behavior holds and where it breaks. For now, the &lt;a href=&quot;https://github.com/mraad/lunar-laya&quot;&gt;source code&lt;/a&gt;, &lt;a href=&quot;https://github.com/mraad/lunar-laya/blob/main/docs/training.md&quot;&gt;training details&lt;/a&gt; and &lt;a href=&quot;https://github.com/mraad/lunar-laya/blob/main/docs/media.md&quot;&gt;animation instructions&lt;/a&gt; are available. Take a look, try it on your Mac, and let me know where you would use a state-plus-text decision interface. More to come. :-)&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/2665077756717008666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/2665077756717008666' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/2665077756717008666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/2665077756717008666'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/09/lunar-laya-from-state-and-text-to.html' title='Lunar Laya: From State and Text to Decisions on a Mac'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-4250535266415240014</id><published>2026-09-21T10:19:15.079-04:00</published><updated>2026-09-21T10:19:15.079-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Nano FEL: GPT-2 and nanoGPT on the North Sea</title><content type='html'>&lt;p&gt;After &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/feln-lora-teaching-small-model-to-query.html&quot;&gt;LoRA on a 4B model&lt;/a&gt; and &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/feln-liquid-fine-tuning-gis-model-on-mac.html&quot;&gt;a 1.2B model on the Mac&lt;/a&gt;, I kept asking myself a simpler question. How small can the model be, and how plain can the training loop be, before this North Sea task stops working? So I went back to the basics: GPT-2 medium, 355 million parameters, fully fine-tuned with Andrej Karpathy&#39;s &lt;a href=&quot;https://github.com/karpathy/nanoGPT&quot;&gt;nanoGPT&lt;/a&gt;. No adapters, no chat template, no grammar, no catalog in the prompt. Just a question in, a JSON query out. That is &lt;a href=&quot;https://github.com/mraad/nanofel&quot;&gt;nanofel&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The task is the same FELN translation: a question about wells, pipelines, and discoveries becomes a plan with &lt;code&gt;layers&lt;/code&gt;, &lt;code&gt;where&lt;/code&gt;, and &lt;code&gt;relations&lt;/code&gt;. The twist here is the data format. nanoGPT trains on one flat stream of tokens and samples random windows from it, so each training pair is simply:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Q: Which gas wells in Norway are within 2 kilometers of an oil pipeline?
A: {&quot;layers&quot;:[&quot;Wells&quot;,&quot;Pipelines&quot;],
    &quot;where&quot;:[&quot;content_type = cast(2 as SMALLINT) and (country = &#39;NO&#39;)&quot;,&quot;PipelinesType = cast(4 as SMALLINT)&quot;],
    &quot;relations&quot;:[&quot;withinDistance 2 kilometers&quot;]}&amp;lt;|endoftext|&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Pairs are written one after another, and the training script from nanoGPT runs unchanged. The whole project is three vendored files from nanoGPT, a 100-line data preparation script, a normalizer that rewrites generated SQL into the gold surface style, and a 100-line inference script that decodes greedily and stops at the end-of-text token. At inference time the model has no idea a catalog exists; everything it knows about &lt;code&gt;content_type = 2&lt;/code&gt; meaning gas was absorbed during training.&lt;/p&gt;

&lt;p&gt;The gold data is 3,000 records from the regenerated NorthSea project, each with a casual phrasing and a canonical phrasing of the same query. I hold out 300 records, which gives 600 evaluation questions, and keep both phrasings of a record on the same side of the split. On top of the gold, about 12,900 generated pairs from the &lt;code&gt;feln-dsl&lt;/code&gt; grammar sampler go into training only, after the normalizer puts them in gold style. Without that normalization step the model would learn two competing ways to write the same clause and lose exact match on gold.&lt;/p&gt;

&lt;p&gt;Training is short. Block size 256, 32 sequences per iteration, learning rate 3e-5 with cosine decay, dropout 0.1, and 3,000 iterations while keeping the checkpoint with the best validation loss. On two RTX PRO 6000 GPUs that is about five minutes including compile and checkpoint writes. The stripped checkpoint is 1.4 GB and runs on my Mac through MPS.&lt;/p&gt;

&lt;p&gt;Here is how the runs went, all scored by exact JSON match on the held-out questions:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Run&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Training pairs&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Evaluation split&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Exact match&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;v1, gold only&lt;/th&gt;&lt;td&gt;1,800&lt;/td&gt;&lt;td&gt;old gold, 200 questions&lt;/td&gt;&lt;td&gt;158/200 (79.0%)&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;v1, gpt2-large&lt;/th&gt;&lt;td&gt;1,800&lt;/td&gt;&lt;td&gt;old gold, 200 questions&lt;/td&gt;&lt;td&gt;158/200 (79.0%)&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;v2, gold + generated&lt;/th&gt;&lt;td&gt;17,372&lt;/td&gt;&lt;td&gt;old gold, 200 questions&lt;/td&gt;&lt;td&gt;194/200 (97.0%)&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;v3, new gold only&lt;/th&gt;&lt;td&gt;5,400&lt;/td&gt;&lt;td&gt;new gold, 600 questions&lt;/td&gt;&lt;td&gt;529/600 (88.2%)&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;v4, new gold + generated (shipped)&lt;/th&gt;&lt;td&gt;18,297&lt;/td&gt;&lt;td&gt;new gold, 600 questions&lt;/td&gt;&lt;td&gt;534/600 (89.0%)&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;v5, same as v4, twice the steps on three GPUs&lt;/th&gt;&lt;td&gt;18,297&lt;/td&gt;&lt;td&gt;new gold, 600 questions&lt;/td&gt;&lt;td&gt;532/600 (88.7%)&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Two things jumped out at me. First, going from gpt2-medium to gpt2-large on the same 1,800 pairs changed nothing, while adding generated coverage for the sparse patterns took the same small model from 79% to 97%. This task is data-limited, not capacity-limited, and a 355M model has plenty of room for it. Second, the drop from 97% to 89% is not the model getting worse. The gold set was regenerated with three times more records, and the new catalog hints dropped the layer noun from the subtype descriptions. So “List gas/condensate. The returned wells must be within 15 kilometers of oil.” is now gold for wells near oil &lt;em&gt;pipelines&lt;/em&gt;, with nothing in the sentence saying pipelines. 40 of the 66 misses in v4 are that exact situation: the secondary layer is never named, and the model picks discoveries instead of pipelines or the other way around. When every layer is named in the question, v4 scores 95%.&lt;/p&gt;

&lt;p&gt;The v5 run was my attempt to squeeze more out of the same data, since the v4 validation loss looked like it was still falling at the last step. Three GPUs, 1.5 times the batch, twice the iterations. The validation loss bottomed out at step 1,800, drifted up while the training loss kept falling, and the best checkpoint landed two questions below v4. Same data, same result. The “still falling” signal was smaller than the evaluation noise, and I should have looked at the eval jitter before spending the compute. The remaining misses are the catalog&#39;s ambiguity, and the fix is in the data generation, not in the training loop.&lt;/p&gt;

&lt;p&gt;A few caveats. The 89% and the 99.7% from the LoRA post are on different gold sets with different SQL conventions, so there is no head-to-head here. Exact match is strict, and a style-normalized comparison gives the same numbers, so none of the misses are formatting. But the model has no grammar and no output validation. It will happily copy an unfamiliar word into a column name, so a downstream allowlist against the catalog is still needed before anything runs.&lt;/p&gt;

&lt;p&gt;What I like about this experiment is how little there is to it. A few hundred lines you can read in one sitting, a five-minute training run, and a model that answers on a laptop. The &lt;a href=&quot;https://github.com/mraad/nanofel&quot;&gt;code, training notes, and the full miss breakdown&lt;/a&gt; are on GitHub. Next is regenerating the gold with the layer nouns restored in the hints, and masking the question tokens so the loss is spent on the answer only. More to come!&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/4250535266415240014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/4250535266415240014' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/4250535266415240014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/4250535266415240014'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/09/nano-fel-gpt-2-and-nanogpt-on-north-sea.html' title='Nano FEL: GPT-2 and nanoGPT on the North Sea'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-6263359062102713831</id><published>2026-09-17T14:13:00.632-04:00</published><updated>2026-09-17T14:13:00.632-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>FELN Qwen: Train on RTX, Run on Jetson Orin</title><content type='html'>&lt;p&gt;After &lt;a href=&quot;https://thunderheadxpler.blogspot.com/2026/09/feln-lora-teaching-small-model-to-query.html&quot;&gt;teaching a small model to query the North Sea&lt;/a&gt;, I wanted to take the experiment onto a Jetson. Could I train on a powerful workstation, then move the model, application, and spatial database onto an NVIDIA Jetson Orin? And could it produce the expected FELN JSON accurately enough to be useful?&lt;/p&gt;

&lt;p&gt;That is the experiment behind &lt;a href=&quot;https://github.com/mraad/feln-qwen&quot;&gt;feln-qwen&lt;/a&gt;. The job is specific: translate a question about wells, pipelines, and discoveries into FELN. The JSON identifies the layers, their attribute filters, and the spatial relationships between them. Layer order matters. Finding pipelines near discoveries is a different request from finding discoveries near pipelines!&lt;/p&gt;

&lt;p&gt;A huge thank you to &lt;strong&gt;&lt;a href=&quot;https://www.geodata.no/&quot;&gt;Geodata&lt;/a&gt;&lt;/strong&gt; for the beautiful &lt;strong&gt;NorthSea data&lt;/strong&gt;. It gave this experiment a rich geospatial vocabulary and meaningful relationships to work with. I deeply appreciate the work and care behind this dataset.&lt;/p&gt;

&lt;p&gt;I chose &lt;strong&gt;Qwen3.5-9B&lt;/strong&gt; and first verified stock-model inference on the Orin. The target machine had to support the model before committing to a full training run. Training then used two RTX PRO 6000 Blackwell GPUs, while inference and spatial execution stayed entirely on the Orin. The Mac was the browser and SSH connection; the workstation was not an inference dependency.&lt;/p&gt;

&lt;p&gt;The data builder reads &lt;code&gt;FELN.json&lt;/code&gt;, &lt;code&gt;Layers.json&lt;/code&gt;, and the Open Knowledge Format files. It validates the catalog, removes duplicates, and retains provenance. The final split contains &lt;strong&gt;4,790 training, 673 validation, and 534 test examples&lt;/strong&gt;. Related query families stay together, including literal substitutions and reordered secondary layers, so a close variant cannot slip across the split boundary.&lt;/p&gt;

&lt;p&gt;I used BF16 LoRA with rank-32 adapters, keeping the base weights frozen and applying loss to the expected answer tokens. There was enough measured GPU memory to use this recipe without quantizing the training base. A smoke run preceded the two-epoch run, which took about &lt;strong&gt;58 minutes&lt;/strong&gt; of measured wall time. Validation selected the checkpoint. The &lt;a href=&quot;https://github.com/mraad/feln-qwen/blob/main/docs/TRAINING_AND_DEPLOYMENT.md&quot;&gt;training and deployment walkthrough&lt;/a&gt; records the settings and commands.&lt;/p&gt;

&lt;p&gt;For deployment, the adapter was merged into the base model and exported to a text-only &lt;strong&gt;GGUF Q4_K_M&lt;/strong&gt; file. The resulting file is about &lt;strong&gt;5.63 GB&lt;/strong&gt;, served by llama.cpp with a 4,096-token context and one request at a time. Quantization is a separate deployment decision, so I evaluated the actual exported file as well as the training checkpoint.&lt;/p&gt;

&lt;p&gt;Now the part I was most interested in: the untuned Q4 model on Orin matched &lt;strong&gt;96 of 534&lt;/strong&gt; expected FELNs, or &lt;strong&gt;17.98%&lt;/strong&gt;. The tuned Q4 model matched &lt;strong&gt;530 of 534&lt;/strong&gt;, or &lt;strong&gt;99.25%&lt;/strong&gt;, on the same held-out set and application prompt/grammar path. These results come from the exported GGUF tested on the Orin.&lt;/p&gt;

&lt;p&gt;Here is the matched RTX–Orin comparison using the same tuned Q4 file and all 534 questions. These are measured model-endpoint timings, with requests sent sequentially. RTX inference used &lt;strong&gt;one GPU&lt;/strong&gt;; training used both. Runtime build revisions differ and are recorded with the results.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Measurement&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;RTX&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Orin&lt;/th&gt;&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Strict FELN matches&lt;/th&gt;&lt;td&gt;530/534 (99.25%)&lt;/td&gt;&lt;td&gt;530/534 (99.25%)&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Warm median latency&lt;/th&gt;&lt;td&gt;0.402 seconds&lt;/td&gt;&lt;td&gt;3.221 seconds&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Warm p95 latency&lt;/th&gt;&lt;td&gt;0.644 seconds&lt;/td&gt;&lt;td&gt;5.168 seconds&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Requests per second&lt;/th&gt;&lt;td&gt;2.426&lt;/td&gt;&lt;td&gt;0.303&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;RTX was about eight times faster in this workload, but the Orin retained the same accuracy. The strict comparison uses &lt;code&gt;FELN.same&lt;/code&gt; after schema validation: equivalent SQL formatting is acceptable; a wrong field, enum value, or spatial relationship is not. The &lt;a href=&quot;https://github.com/mraad/feln-qwen/blob/main/README.md#rtx-versus-orin&quot;&gt;comparison and underlying reports&lt;/a&gt; are in the repository.&lt;/p&gt;

&lt;p&gt;The application adds schema compilation and read-only DuckDB spatial execution. A separate 18-question sample covering the nine primary-layer/layer-count strata passed 18 of 18 end-to-end checks, with a warm median of &lt;strong&gt;3.97 seconds&lt;/strong&gt;. Sampled peak system-wide shared RAM usage was about &lt;strong&gt;10.1 GiB&lt;/strong&gt;. That is an application/database measurement and a system-memory reading, distinct from the model-only table above.&lt;/p&gt;

&lt;p&gt;I also deployed FELN Studio on the Orin. Here it is generating the expected JSON for pipelines with a dimension over 20.0 that are within two miles of a condensate discovery. The screenshot was captured from the real application, with an exact-match verdict.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/feln-qwen/5e0836a2c826169ce4a1890fb2111b810e27097c/docs/images/feln-studio-orin.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/feln-qwen/5e0836a2c826169ce4a1890fb2111b810e27097c/docs/images/feln-studio-orin.png&quot; alt=&quot;FELN Studio using Qwen3.5-9B on Orin to generate a pipelines-to-discoveries spatial query, with an exact-match verdict&quot; width=&quot;720&quot; style=&quot;max-width:100%;height:auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;FELN Studio on Orin, viewed through the Mac browser. The legacy “on this Mac” helper text is inaccurate for this deployment: model computation runs on Orin.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;There are limits. These are held-out synthetic and source query families from one static catalog, not a production user study. Four test answers are still wrong, and complete Orin responses exceed one second. Studio provides generation and inspection; spatial GeoJSON comes from the separate application API. The services were restart-tested and subsequently stopped at my request, so the screenshot documents the verified deployment rather than a live public demo.&lt;/p&gt;

&lt;p&gt;The code is now public under Apache 2.0 in &lt;a href=&quot;https://github.com/mraad/feln-qwen&quot;&gt;feln-qwen&lt;/a&gt;, with data preparation, training, evaluation, serving, and measured results. Third-party models and data retain their own terms. I would like to test broader catalogs and more natural questions next. Fork the repository, explore the workflow, and let me know where you would take this in your GIS work. More to come!&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/6263359062102713831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/6263359062102713831' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/6263359062102713831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/6263359062102713831'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/09/feln-qwen-train-on-rtx-run-on-jetson.html' title='FELN Qwen: Train on RTX, Run on Jetson Orin'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-4630572326466380269</id><published>2026-09-16T16:23:29.775-04:00</published><updated>2026-09-16T16:23:29.775-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="MLX"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>FELN Liquid: Fine-Tuning a GIS Model on a Mac</title><content type='html'>&lt;p&gt;I have been experimenting with small language models that translate everyday questions into structured GIS queries. With &lt;a href=&quot;https://github.com/mraad/feln-liquid&quot;&gt;FELN Liquid&lt;/a&gt;, I wanted to explore the training side on the Mac itself. Could I take a compact model, teach it the conventions of a North Sea catalog, and complete the experiment locally?&lt;/p&gt;

&lt;p&gt;The first complete run used LiquidAI&#39;s &lt;a href=&quot;https://huggingface.co/LiquidAI/LFM2.5-1.2B-Instruct&quot;&gt;LFM2.5-1.2B-Instruct&lt;/a&gt; with LoRA through MLX on an Apple M4 Max. Training took 48 minutes and 37 seconds. Including checkpoint evaluation and the final test, the workflow finished in just under an hour. That is a practical turnaround for trying an idea and inspecting what it learned.&lt;/p&gt;

&lt;p&gt;The task is familiar from the other FELN projects: turn a request into a JSON plan containing &lt;code&gt;layers&lt;/code&gt;, &lt;code&gt;where&lt;/code&gt;, and &lt;code&gt;relations&lt;/code&gt;. A compact &lt;code&gt;Layers.json&lt;/code&gt; catalog accompanies each request, supplying the names, types, aliases, codes, and hints that make the data meaningful.&lt;/p&gt;

&lt;p&gt;For example, “Show all wells with water depth &amp;gt; 350 meters” should produce:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{
  &quot;layers&quot;: [&quot;Wells&quot;],
  &quot;where&quot;: [&quot;\&quot;water_depth\&quot; &amp;gt; 350&quot;],
  &quot;relations&quot;: []
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The measurement belongs to the &lt;code&gt;water_depth&lt;/code&gt; field, and its unit is already understood from the catalog. The SQL predicate needs the numeric threshold. There is no spatial join in this example, so the relations array is empty.&lt;/p&gt;

&lt;p&gt;The completed experiment used 1,000 synthetic examples, split into 796 for training, 100 for validation, and 104 for testing. Related query families stayed together across those splits. I also froze the source files, prompt, split identifiers, and hashes for the run. As the catalog and generated questions evolve, those copies let us identify exactly what produced a result.&lt;/p&gt;

&lt;p&gt;LoRA updated about 11.1 million parameters, roughly 0.95% of the base model, using rank-16 adapters. MLX runs this work on the Mac&#39;s Metal GPU. Peak reported MLX memory was about 30.7 GB, so the memory requirement matters even with a relatively small model. The selected adapter is about 44.5 MB and still needs the base weights to run.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://github.com/mraad/feln-liquid/blob/main/LOCAL_TUNING.md&quot;&gt;recorded results&lt;/a&gt; selected epoch two:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;&lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Measurement&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Selected adapter&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Canonical plan matches, validation&lt;/th&gt;&lt;td&gt;98/100&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Canonical plan matches, test&lt;/th&gt;&lt;td&gt;99/104 (95.2%)&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Strict FELN schema validity, test&lt;/th&gt;&lt;td&gt;104/104&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Identifier and SQL compilation checks, test&lt;/th&gt;&lt;td&gt;104/104&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Observed median generation time, test&lt;/th&gt;&lt;td&gt;0.784 seconds&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Epoch three matched 97 of the 100 validation plans, so the final checkpoint was not the selected one. The test split was evaluated after selection. Canonical comparison normalizes the SQL representation before comparing plans; the stricter raw-output score was 96/104 on the test set. The timing is an observation from this Mac run, not a controlled, repeated inference benchmark.&lt;/p&gt;

&lt;p&gt;Then a short human question exposed a useful problem: “Show all wells with depth &amp;gt; 350 meters.” The original adapter invented a &lt;code&gt;depth&lt;/code&gt; column and left &lt;code&gt;meters&lt;/code&gt; in the SQL expression. The available field describes water depth. A person&#39;s word “depth” could also mean drilled-well depth, which this catalog does not provide.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://github.com/mraad/feln-liquid/blob/main/predict_feln.py&quot;&gt;guarded inference command&lt;/a&gt; now asks for clarification on that wording. For an explicit request, it supplies additional instructions and one example, validates the complete response against the catalog and permitted SQL expressions, and allows one retry with feedback. Its result can be &lt;code&gt;clarification_required&lt;/code&gt;, &lt;code&gt;validated&lt;/code&gt;, or &lt;code&gt;rejected&lt;/code&gt;. It does not execute the query.&lt;/p&gt;

&lt;p&gt;That distinction matters. All five errors in the original tuned test set passed the schema and SQL checks. A wrong stored code or an extra condition can still be valid SQL. Likewise, the six targeted checks that passed after adding the guard are development checks, not a new accuracy benchmark. The original scores describe synthetic query families, and execution-result accuracy has not been measured.&lt;/p&gt;

&lt;p&gt;I am excited by how much of the training and inspection cycle can happen locally. The next step is to add more human phrasing while reserving independently written questions for evaluation. A matched RTX training comparison is still future work for this project.&lt;/p&gt;

&lt;p&gt;The scripts, &lt;a href=&quot;https://github.com/mraad/feln-liquid/blob/main/LOCAL_TUNING.md&quot;&gt;run notes&lt;/a&gt;, and &lt;a href=&quot;https://github.com/mraad/feln-liquid/blob/main/DATA_SYNC.md&quot;&gt;data preparation details&lt;/a&gt; are available in &lt;a href=&quot;https://github.com/mraad/feln-liquid&quot;&gt;feln-liquid&lt;/a&gt;. The setup currently uses workspace-specific paths, and the model weights and run artifacts are not included in a clone, so start with the README before reproducing it. Feedback on the questions your own GIS users actually ask would be especially useful. More to come!&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/4630572326466380269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/4630572326466380269' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/4630572326466380269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/4630572326466380269'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/09/feln-liquid-fine-tuning-gis-model-on-mac.html' title='FELN Liquid: Fine-Tuning a GIS Model on a Mac'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4442573390356643522.post-8485272760864896242</id><published>2026-09-16T16:00:28.000-04:00</published><updated>2026-09-16T16:23:18.047-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DuckDB"/><category scheme="http://www.blogger.com/atom/ns#" term="GenAI"/><category scheme="http://www.blogger.com/atom/ns#" term="GIS"/><category scheme="http://www.blogger.com/atom/ns#" term="Machine Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="WebGPU"/><title type='text'>FELN WebGPU: A Language Model, a Database, and a Map in One Browser Tab</title><content type='html'>&lt;p&gt;I have been exploring how small language models can turn a plain-English question into a useful GIS query. With FELN LoRA, that meant training a model on a GPU and running it locally on my Mac. For &lt;a href=&quot;https://github.com/mraad/feln-webgpu&quot;&gt;feln-webgpu&lt;/a&gt;, I wanted to bring the language model, the database, and the map into the web application itself.&lt;/p&gt;

&lt;p&gt;Type “Give me all oil discoveries,” and the browser generates a query plan, compiles it to SQL, executes it, and draws the results. The example in the repository finds 562 discoveries, with 200 displayed. We can inspect the plan and SQL beside the map. I like being able to see what the model actually asked the database!&lt;/p&gt;

&lt;figure&gt;
  &lt;a href=&quot;https://raw.githubusercontent.com/mraad/feln-webgpu/main/docs/screenshot.png&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/mraad/feln-webgpu/main/docs/screenshot.png&quot; alt=&quot;North Sea Query showing oil discoveries on a map, the generated FELN plan and DuckDB SQL, and a table reporting 562 matches with 200 displayed.&quot; style=&quot;max-width:100%;height:auto;&quot; loading=&quot;lazy&quot; /&gt;&lt;/a&gt;
  &lt;figcaption&gt;The question, query plan, SQL, and resulting features in one browser tab.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The pieces are a fine-tuned &lt;a href=&quot;https://huggingface.co/LiquidAI/LFM2-350M&quot;&gt;LiquidAI LFM2-350M&lt;/a&gt; model, Transformers.js running on WebGPU, DuckDB-Wasm with its spatial extension, and the ArcGIS Maps SDK for JavaScript. Once the assets have loaded, query generation and database execution happen on the user&#39;s machine. There is no inference server or database server behind the interaction.&lt;/p&gt;

&lt;p&gt;There is an initial download: 443 MB for the exported model weights and 5.9 MB of Parquet data for wells, discoveries, and pipelines. The application also fetches libraries, the spatial extension, and basemap tiles from external services. Local query processing is useful, but this version still has network dependencies.&lt;/p&gt;

&lt;p&gt;For the oil-discoveries example, the model produces:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{
  &quot;layers&quot;: [&quot;Discoveries&quot;],
  &quot;where&quot;: [&quot;discovery_type = cast(3 as INTEGER)&quot;],
  &quot;relations&quot;: []
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A JavaScript port of the FELN compiler turns that plan into DuckDB SQL. DuckDB reads the geometry from the Parquet tables, and the application sends the returned features to an ArcGIS graphics layer. The model&#39;s responsibility is translating the request into FELN. The database performs the selection.&lt;/p&gt;

&lt;p&gt;Getting a 350-million-parameter model to do that required attention to the examples. An early version saw “water depth” during training, but a question using just “depth” could make it invent a column. Adding paraphrases addressed that gap. The current preparation also includes more natural wording and combined constraints, while keeping a query plan and all its wordings on the same side of the training/validation split.&lt;/p&gt;

&lt;p&gt;This project uses full fine-tuning. The latest 350M run took about 31 minutes on one RTX PRO 6000. Its system prompt includes the OKF catalog documentation, roughly 10,900 tokens describing the data. That is a substantial amount of context for a short question.&lt;/p&gt;

&lt;p&gt;The useful trick is to process that common prompt once. At startup, the application spends about seven seconds building a prefix cache, then reuses the model state for subsequent questions. In the recorded comparison, this brought generation from about seven seconds per question to 0.7–1.3 seconds. A separate 210-question browser holdout run averaged 0.46 seconds for generation. Those measurements exclude downloading the model and drawing the result.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://github.com/mraad/feln-webgpu#export-to-the-browser&quot;&gt;export experiments&lt;/a&gt; also helped choose the download size. On the earlier 81-question browser evaluation, FP16 and the 8-bit export both matched 74 expected plans. The 8-bit version reduced the weights from 692 MB to 443 MB. The smaller 4-bit exports lost accuracy, so the application stayed with 8-bit weights.&lt;/p&gt;

&lt;p&gt;For the current v4 model, the recorded browser results are:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;&lt;tr&gt;&lt;th scope=&quot;col&quot;&gt;Measurement&lt;/th&gt;&lt;th scope=&quot;col&quot;&gt;Result&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Exact FELN plans&lt;/th&gt;&lt;td&gt;203/210 (96.7%)&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Matching result sets&lt;/th&gt;&lt;td&gt;208/210 (99.0%)&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;th scope=&quot;row&quot;&gt;Mean generation time&lt;/th&gt;&lt;td&gt;0.46 seconds&lt;/td&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Matching rows and matching plans answer different questions. Two different filters can happen to select the same records in this dataset. I want to keep both measurements visible. A larger 1.2B model reached 204/210 exact plans in the Python evaluation, one more than the 350M model, and was not exported into the application.&lt;/p&gt;

&lt;p&gt;There is a spatial issue to fix before relying on distance queries: the current compiler passes metre-valued thresholds to &lt;code&gt;ST_DWithin&lt;/code&gt; while the geometry is stored in WGS84 degrees. Those units do not match. The browser reproduces the Python implementation, so agreement between them does not establish correct distances. The correction belongs in the shared compiler and then in the browser port.&lt;/p&gt;

&lt;p&gt;What interests me here is how much of this workflow fits in a browser tab: language, structured queries, a spatial database, and a map. The dataset is small, the model still makes mistakes, and the initial load matters. Even with those limits, this is an exciting direction for focused GIS applications.&lt;/p&gt;

&lt;p&gt;The code and evaluation tables are available on GitHub in &lt;a href=&quot;https://github.com/mraad/feln-webgpu&quot;&gt;feln-webgpu&lt;/a&gt;. I would like to keep pushing on natural wording and spatial correctness as this develops. More to come!&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thunderheadxpler.blogspot.com/feeds/8485272760864896242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4442573390356643522/8485272760864896242' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/8485272760864896242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4442573390356643522/posts/default/8485272760864896242'/><link rel='alternate' type='text/html' href='http://thunderheadxpler.blogspot.com/2026/09/feln-webgpu-language-model-database-and.html' title='FELN WebGPU: A Language Model, a Database, and a Map in One Browser Tab'/><author><name>thunderhead</name><uri>http://www.blogger.com/profile/09200852299600047243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>