{"version": "https://jsonfeed.org/version/1.1", "title": "IKANGAI AI Engineering", "home_page_url": "https://ai-engineering.ikangai.com/", "feed_url": "https://ai-engineering.ikangai.com/feed.json", "language": "en", "description": "AI wrote this piece from the sources listed, and nobody reviewed it individually before publication. It explains other people's work, so check the source before you rely on a detail.", "items": [{"id": "https://ai-engineering.ikangai.com/articles/molt-a-looped-transformer-that-generates-each-token-in-one-pass/", "url": "https://ai-engineering.ikangai.com/articles/molt-a-looped-transformer-that-generates-each-token-in-one-pass/", "title": "MoLT: a looped Transformer that generates each token in one pass", "summary": "Looped Transformers run the same layers several times to get more depth from fewer weights, and pay for it at generation time. A paper from Huazhong University of Science & Technology, ByteDance Seed and the University of Toronto changes what one loop hands to the next. With that change a new token goes through the stack once, and in the authors' small-model test the looped model is as fast as a plain one. The code for the small models is public. The large training recipes are not.", "content_text": "# MoLT: a looped Transformer that generates each token in one pass\n\n> Looped Transformers run the same layers several times to get more depth from fewer weights, and pay for it at generation time. A paper from Huazhong University of Science & Technology, ByteDance Seed and the University of Toronto changes what one loop hands to the next. With that change a new token goes through the stack once, and in the authors' small-model test the looped model is as fast as a plain one. The code for the small models is public. The large training recipes are not.\n\n- Kind: research (Research explained)\n- Published: 2026-12-06T08:03:00+00:00\n- Web page: https://ai-engineering.ikangai.com/articles/molt-a-looped-transformer-that-generates-each-token-in-one-pass/\n\n## The cost of looping\n\nA looped Transformer applies one stack of layers N times. The output of loop 1 at a token position becomes the input of loop 2 at the same position. Training a model like this gives more computation per parameter. Generating with it is slow, because every new token has to go through all N loops in order, and each loop keeps its own attention cache.\n\nThe paper asks what a loop should pass on. In the standard design the answer is the residual stream, the running hidden state of each token. The authors' answer is keys and values: the same objects an attention layer already caches for earlier tokens.\n\n## Three variants\n\n| Variant | What a loop receives from the one before | Passes per new token |\n|---|---|---|\n| MoLT-R | The hidden state, plus the keys and values of all layers of the earlier loop at the same position | N |\n| MoLT-KV | Only keys and values, projected from the earlier loop's output at earlier positions. Each loop starts again from the token embedding. | 1 |\n| U-MoLT | As MoLT-KV, but only the lower part of the stack loops. The upper part reads the result and predicts. | 1 |\n\nAll three read these extra keys and values in the same attention step as the normal ones, under a single softmax. The paper calls this Mixture-of-Loops Attention. No separate gate decides how much each loop contributes. The query does.\n\n## Why one pass is enough\n\nThe step that buys the speed is in MoLT-KV, and it consists of two restrictions.\n\nEvery loop starts from the token's embedding, so no hidden state crosses from loop to loop. And when position t reads the memory of the earlier loop, it may only read positions before t, never its own.\n\nTogether these mean that a token never depends on its own result from the loop before. It depends on that loop's results for the tokens in front of it. During generation those tokens are finished and their memory is in the cache. So the new token runs through the stack once, reads the cached memory of everything before it, and its output is projected into memory for the tokens that follow.\n\nThe paper states that this single pass still carries multi-loop computation over the prefix, because each cached entry was itself built from earlier cached entries. The proofs are in its Appendix B, which we have not worked through.\n\nTraining has to prepare the model for this. The authors put a loss on the prediction of every loop, and train each loop in parallel across all positions from the memory of the loop before. They call it loop forcing, by analogy with teacher forcing. The models in the paper were trained with two loops.\n\n## The prompt is the remaining problem\n\nBuilding the memory token by token is fine for the tokens being generated. For a long prompt it is sequential work. The paper's timing shows the size of it: with a 4,096-token prompt, pure single-pass decoding took 73.8 seconds on MoLT-KV.\n\nThe fix is a hybrid. The prompt goes through one or two ordinary loops, all positions in parallel, which fills the memory. Generation then continues with one pass per token. With that schedule the same request took about one second. The authors note that the hybrid is no longer exactly equivalent to building the memory from an empty cache. Measured against ordinary two-loop decoding, the difference in perplexity stayed between -0.012 and +0.039.\n\n## What U-MoLT adds\n\nIn MoLT-KV the top of the stack has two jobs that pull against each other. Its output has to collapse toward a prediction of the next token, and the same output is the memory that later tokens read.\n\nU-MoLT splits the stack. The lower layers form a looped encoder that builds memory. The upper layers form a decoder that reads the encoder's output through its own projections and predicts. The decoder never writes back. Since nothing later depends on the decoder's state, it can be skipped wherever its prediction is not needed: in every loop except the last, and at every prompt position except the final one.\n\nWith the layers split in half and a two-loop prefill, the paper's cost analysis puts U-MoLT level with a non-looped model of the same number of layers in prefill depth, passes per token and cache size.\n\n## The numbers\n\nAll results are the authors' own.\n\n- Trained from scratch on 400 billion tokens against OLMo3, U-MoLT at 700M parameters reached the baseline's final validation loss after 232.8 billion tokens, which the paper counts as 1.7 times the token efficiency. MoLT-R and U-MoLT raised accuracy across ten tasks by 2.6 and 2.5 percentage points.\n- On a 3B mixture-of-experts model, U-MoLT lowered perplexity across ten domains by 0.75 and raised ten-task accuracy by 2.1 points.\n- Continued pretraining of Qwen3.5-0.8B-Base for 100 billion tokens lowered loss on all 11 domains against a matched baseline.\n- Speed, on models of about 113M parameters with a 4,096-token prompt and 64 generated tokens: U-MoLT with the two-loop hybrid took 996.6 ms, non-looped OLMo3 1,000.6 ms. Against ordinary two-loop decoding the hybrid took 32 to 50 percent less time.\n\n## What you can run\n\nThe hustvl/MoLT repository marks four items as released: the paper, a minimal U-MoLT implementation with the configuration behind one of the paper's ablation rows, a fused attention kernel in Triton with unit tests, and implementations of MoLT-R, MoLT-KV and the hybrid decoding. The large pretraining recipes and the Qwen3.5 code are listed as still to come. We have not run any of it.\n\n## One early outside use\n\nFour days after the paper appeared on arXiv, a single-author robotics paper, VeloLoop, used a MoLT-style looped encoder in a manipulation policy trained on 1,116 demonstrations. It reports that looping helped during training, where a non-looped version of the same size overfitted, and that at inference one loop did as well as three. That is a small study in a different field, but it points the same way as the main paper: train with loops, run with fewer.\n\n## What to keep in mind\n\nToken efficiency is not compute efficiency, and the abstract only gives the first. In Appendix A the authors report that two-loop training of the 700M model used 2.01 times the theoretical FLOPs and 1.99 times the wall-clock time of the baseline. U-MoLT matched the baseline's final loss after 232.8 billion tokens, but it had spent the baseline's entire compute budget by 198.9 billion. The authors say an exact comparison at equal compute would need a run of its own. As it stands, the paper shows a model that learns more from each token of data and is as fast to run. It does not show one that is cheaper to train.\n\nThe speed comparison uses 12-layer models of about 113M parameters, on one H20 GPU at batch size 1. Nothing in the paper shows the latency match at the sizes people deploy, or under batched serving.\n\nThe quality results stop at 1.5B dense and 3B mixture-of-experts. The authors give limited compute as the reason.\n\nRetrofitting an existing model is less clean than building one. Qwen3.5-0.8B-Base has 24 layers, of which only 6 are full attention. In the two adaptations the paper tried, the decoder still depends on its own earlier states, so the exact prefill saving is lost. The gain was small: mean validation loss went from 2.496 to 2.480, for 0.42 percent more parameters and a second loop of compute.\n\n## Sources\n\n- [Lianghui Zhu, Shijie Wang, Xinggang Wang, Jinze Bai, Bo Wang, Xiang Bai, Mixture-of-Loops Transformer, arXiv, 25 November 2026](https://arxiv.org/abs/2611.34923)\n- [hustvl/MoLT, README](https://github.com/hustvl/MoLT)\n- [A Adith, VeloLoop: Mixture-of-Loops Observation Encoders for Flow-Matching Manipulation Policies, arXiv, 29 November 2026](https://arxiv.org/abs/2611.39287)\n- [Turing Post, AI 101: What is Mixture-of-Loops Transformer (MoLT)?, 5 December 2026, where we first saw the paper. Most of that explainer is for subscribers.](https://www.turingpost.com/p/what-is-mixture-of-loops-transformer-molt-a-non-trivial-looped-architecture)\n\n## How this was checked\n\nWritten from the paper's main text, the compute study in its Appendix A and the repository's README. Every number was read against the paper. We did not work through the proofs in Appendix B, did not run the code and did not reproduce any result.\n\n---\n\nAI wrote this piece from the sources listed, and nobody reviewed it individually before publication. It explains other people's work, so check the source before you rely on a detail.\n\nCite as: IKANGAI AI Engineering, \"MoLT: a looped Transformer that generates each token in one pass\", 2026-12-06, https://ai-engineering.ikangai.com/articles/molt-a-looped-transformer-that-generates-each-token-in-one-pass/\n", "date_published": "2026-12-06T08:03:00+00:00", "tags": ["research"], "external_url": "https://arxiv.org/abs/2611.34923"}, {"id": "https://ai-engineering.ikangai.com/articles/put-the-agent-s-map-of-your-database-in-the-database/", "url": "https://ai-engineering.ikangai.com/articles/put-the-agent-s-map-of-your-database-in-the-database/", "title": "Put the agent's map of your database in the database", "summary": "In a talk at AI Engineer, George Fraser of Fivetran argues that an agent answering questions about a business should read the modelled data warehouse and not the source systems, and that the description of that warehouse belongs in a table inside it. The idea fits in one table and one sentence of system prompt. We tried the smallest version.", "content_text": "# Put the agent's map of your database in the database\n\n> In a talk at AI Engineer, George Fraser of Fivetran argues that an agent answering questions about a business should read the modelled data warehouse and not the source systems, and that the description of that warehouse belongs in a table inside it. The idea fits in one table and one sentence of system prompt. We tried the smallest version.\n\n- Kind: technique (Technique)\n- Published: 2026-12-06T08:02:00+00:00\n- Web page: https://ai-engineering.ikangai.com/articles/put-the-agent-s-map-of-your-database-in-the-database/\n\n## The argument\n\nFraser's talk runs 27 minutes and was published on the AI Engineer channel on 5 December. His starting point is that agents now write SQL and build charts well, so the data team's work moves from building dashboards to giving agents context.\n\nHe says Ramp, Stripe, DoorDash, OpenAI and Anthropic have each built an in-house data agent, and that all of them point it at the data stack they had already built for business intelligence. Source systems are replicated into one warehouse, the data is modelled there, and the agent queries the modelled tables. He says these companies have described their agents on their blogs. The talk links none of those posts, and we have not read them.\n\n## Why he would not wire the agent to every system over MCP\n\nThe obvious design gives the agent one MCP connection per system: one for the CRM, one for the ticket tracker, one for chat. Fraser says this fails for analytical questions, for three reasons.\n\nThe data in source systems is messy, and the cleaning that makes it usable happened in the warehouse. Each system has its own query language, some of them weak, and for chat there is only a search box. And no join can cross two systems, although most business questions need one.\n\nHe is careful about the scope of the claim. MCP itself is fine, and at Fivetran the agents reach the warehouse through an MCP server. MCP tools on source systems are still the right thing for taking an action or fetching one record that just changed. They are the wrong way to answer a question about the business.\n\n## The map\n\nAn agent connected to a warehouse and told to look around gives poor answers. Fraser says Fivetran tried it. Models have got better at it over the past six months, but he still does not recommend it. The agent needs a description of what is there.\n\nHis proposal: create a schema called `agents`, and in it a table called `root` whose rows hold Markdown that describes the other tables. The agent's system prompt then needs one instruction, which is to read `agents.root` first. When the data changes, the description changes with it, and the prompt stays the same.\n\nIn his demo, built on Formula 1 data, the `agents` schema held three tables: one describing the tables, one the columns and one the joins. They covered about 30 modelled tables. Asked for the most improved driver of the season, the agent read those three tables, ran a small query to see what the data looked like, asked which measure of \"improved\" was meant, and then wrote a longer query with several joins.\n\nHe says the whole demo took about five hours to build, and that how much to put in the map is still an open question at Fivetran.\n\n## The smallest version\n\nThis is our own example, not Fivetran's. It uses SQLite from Python's standard library, where an attached database stands in for a schema. It runs as shown.\n\n```python\nimport sqlite3\n\ndb = sqlite3.connect(\":memory:\")\ndb.execute(\"ATTACH ':memory:' AS agents\")  # SQLite's stand-in for a schema\ndb.executescript(\"\"\"\nCREATE TABLE orders (order_id INTEGER PRIMARY KEY, customer_id INTEGER,\n                     placed_on TEXT, total_cents INTEGER, status TEXT);\nCREATE TABLE customers (customer_id INTEGER PRIMARY KEY, name TEXT, country TEXT);\nINSERT INTO customers VALUES (1, 'Alpenrad', 'AT'), (2, 'Nordlicht', 'DE');\nINSERT INTO orders VALUES (1, 1, '2026-11-03', 12000, 'paid'),\n                          (2, 1, '2026-11-20', 4000, 'refunded'),\n                          (3, 2, '2026-11-21', 9000, 'paid');\n\nCREATE TABLE agents.root (provider TEXT, key TEXT, content TEXT);\nINSERT INTO agents.root VALUES ('handwritten', 'start-here',\n'## Tables\n- orders: one row per order. total_cents is in euro cents.\n- customers: one row per customer.\n## Joins\n- orders.customer_id = customers.customer_id\n## Definitions\n- Revenue counts only orders with status = ''paid''. Refunded orders are not revenue.');\n\"\"\")\n\n# What the agent runs first, because its system prompt tells it to:\nfor provider, key, content in db.execute(\"SELECT provider, key, content FROM agents.root\"):\n    print(f\"[{provider}/{key}]\\n{content}\\n\")\n\n# A query written with that map in hand:\nprint(db.execute(\"\"\"\n    SELECT c.name, SUM(o.total_cents) / 100.0 AS revenue_eur\n    FROM orders o JOIN customers c ON o.customer_id = c.customer_id\n    WHERE o.status = 'paid' GROUP BY c.name ORDER BY revenue_eur DESC\n\"\"\").fetchall())\n```\n\nThe last line prints `[('Alpenrad', 120.0), ('Nordlicht', 90.0)]`.\n\nThe definition of revenue is the part that matters. Nothing in the column names says that a refunded order does not count. Without that line in `root`, a model would have to guess, and Alpenrad's 160 euros would be a reasonable wrong answer.\n\n## What exists beyond the talk\n\nThe talk shows the hand-made version. The published version is larger. The specification and tooling live in the open dbt-labs/agents_schema repository. There, `AGENTS.ROOT` has the columns `provider`, `key` and `content`, and each provider of metadata explains its own tables in it. The repository has GitHub Actions workflows that fill the schema from dbt, Looker, Omni, Open Semantic Interchange files and Sigma, for Snowflake, Databricks, BigQuery and ClickHouse, and a plugin for Codex and Claude Code that teaches the agent to start at `AGENTS.ROOT`.\n\nFivetran's own product builds on this and adds search indexes and a graph of concepts, entities and relationships.\n\n## Two more points from the talk\n\nFraser advises against a separate vector database. The large warehouses now have vector indexes built in, and with text and embeddings in the same database, one query can combine a semantic search with an ordinary filter. His example searched press conference transcripts for tyre problems and restricted the result to one season.\n\nHe also tests the agent. His evals are a list of questions with known answers, set up as multiple choice with ten options, run in CI.\n\n## What to keep in mind\n\nFivetran and dbt Labs, which Fraser says merged this year, sell the pipeline this pattern runs on, and the pattern makes the warehouse the centre of the agent's world. That does not make the argument wrong, but nobody on that stage argued the other side.\n\nThe talk gives no numbers on answer quality with and without the map. The demo is one question answered live.\n\nMultiple-choice evals show whether the agent can find a known answer. They do not show how it behaves on the open questions Fraser says people should be encouraged to ask.\n\n## Sources\n\n- [George Fraser, The New Job of the Data Team Is Providing Context to AI, AI Engineer, 5 December 2026. The map starts at 10:38, the demo at 21:50.](https://www.youtube.com/watch?v=jluFLznjXSo)\n- [Fivetran, Agents Schema documentation](https://fivetran.com/docs/context-layer/agents-schema)\n- [dbt-labs/agents_schema, README](https://github.com/dbt-labs/agents_schema)\n\n## How this was checked\n\nThe account of the talk was written from its automatic captions, which misspell names, so the two agent names Fraser mentions are left out. The table layout was read against the documentation and the README. The example was written and run by us on Python 3 with no extra packages. We did not run the published tooling against a warehouse.\n\n---\n\nAI wrote this piece from the sources listed, and nobody reviewed it individually before publication. It explains other people's work, so check the source before you rely on a detail.\n\nCite as: IKANGAI AI Engineering, \"Put the agent's map of your database in the database\", 2026-12-06, https://ai-engineering.ikangai.com/articles/put-the-agent-s-map-of-your-database-in-the-database/\n", "date_published": "2026-12-06T08:02:00+00:00", "tags": ["technique"], "external_url": "https://www.youtube.com/watch?v=jluFLznjXSo"}, {"id": "https://ai-engineering.ikangai.com/articles/datasette-agent-hides-a-tool-from-the-model-when-the-user-may-not-use-it/", "url": "https://ai-engineering.ikangai.com/articles/datasette-agent-hides-a-tool-from-the-model-when-the-user-may-not-use-it/", "title": "Datasette Agent hides a tool from the model when the user may not use it", "summary": "Simon Willison's chat agent for Datasette is still in alpha. Its README documents how to put an LLM inside an app that already has users, permissions and a write path, and four of its decisions carry over to any agent you build into your own software.", "content_text": "# Datasette Agent hides a tool from the model when the user may not use it\n\n> Simon Willison's chat agent for Datasette is still in alpha. Its README documents how to put an LLM inside an app that already has users, permissions and a write path, and four of its decisions carry over to any agent you build into your own software.\n\n- Kind: tool (Tool in depth)\n- Published: 2026-12-06T08:01:00+00:00\n- Web page: https://ai-engineering.ikangai.com/articles/datasette-agent-hides-a-tool-from-the-model-when-the-user-may-not-use-it/\n\n## What it is\n\nDatasette is Willison's open source tool for exploring and publishing data held in SQLite. Datasette Agent is a plugin for it. It adds a chat assistant at `/-/agent` that can run SQL, save queries, write to the database and open pages of the app in a panel next to the conversation.\n\nOn 5 December Willison published a video introduction, recorded on the public preview at agent.datasette.io. The preview asks for a GitHub sign-in, which he says is only there to discourage abuse. The demo also shows the agent drawing a chart with Datasette Charts and, when asked, annotating a gap in the plotted data.\n\n## Running it\n\nThese commands come from Willison's posts. We have not run them.\n\nWith the `llm` tool already configured, one line starts a local server with the agent, according to his post of 31 October:\n\n```bash\nuvx --with datasette-agent datasette content.db --internal internal.db\n```\n\n`content.db` is any SQLite file. If Datasette was installed with Homebrew or `uv tool install`, the `llm` command is not on the path. Since datasette-llm 0.2a0, released on 5 December, the key can be set through Datasette itself:\n\n```bash\ndatasette llm keys set openai\n```\n\nHis post of 14 November shows the same setup against a local model behind an OpenAI-compatible endpoint, such as LM Studio, Ollama or llama.cpp.\n\n## Four decisions that carry over\n\n### 1. A tool the user may not use never reaches the model\n\nPlugins add tools through a `register_agent_tools` hook. A tool can name a Datasette permission:\n\n```python\nAgentTool(\n    name=\"my_write_tool\",\n    description=\"Writes things\",\n    input_schema={\"type\": \"object\", \"properties\": {}},\n    fn=my_write_handler,\n    required_permission=\"myplugin-write\",\n)\n```\n\nBefore the tool list goes to the model, the harness asks Datasette whether the current user holds that permission. If not, the tool is taken off the list. The README states the consequence: the tool function needs no \"permission denied\" branch, because the model cannot call what it never saw.\n\nThe usual alternative is to offer every tool and refuse at call time. That costs a round trip, and it tells the model that a write tool exists.\n\n### 2. Writes run as the user, through the app's own endpoints, after approval\n\nThe agent has two built-in tools that change things: `save_query` and `execute_write_sql`. Neither writes directly. Both go through the same Datasette endpoints the web interface uses, as the user who is chatting, so the user needs the same permissions as when working by hand.\n\nBefore anything runs, the chat shows the full SQL, the parameters, the permissions it needs and a warning for destructive statements, and waits for a yes. Saved queries are private by default.\n\nOne limit is documented plainly. Several write statements run in order, and if one fails the later ones are skipped while the earlier ones stay. There is no rollback across the batch.\n\n### 3. A question to the user suspends the turn, and the tool starts over\n\nA tool can ask the person a yes/no, multiple-choice or free-text question in the middle of its work. This example is shortened from the README:\n\n```python\nasync def edit_files(datasette, actor, context, path):\n    ok = await context.ask_user(\n        \"Is it OK to edit files in {}?\".format(path)\n    )\n    if not ok:\n        return json.dumps({\"cancelled\": True})\n    # ... do the work ...\n    return json.dumps({\"edited\": path})\n```\n\nThe design choice is in what happens next. The agent's turn is suspended and the question is stored in Datasette's internal database, so it survives a page reload and a server restart. When the answer arrives, the tool function runs again from the first line. Questions already answered return their stored answer at once, and execution continues past them.\n\nThis replay model keeps the harness simple, since no half-finished function has to be kept alive. It puts one rule on tool authors, which the README spells out: ask before you do anything with side effects, or the side effect happens twice.\n\nWhere nobody is watching, such as in a background agent, `ask_user()` raises an error that reaches the model as a failed tool call, so it can carry on without the answer.\n\n### 4. What the user sees and what the model reads are separate\n\nA tool returns a JSON string. Any top-level key that starts with an underscore is removed before the result goes back to the model:\n\n```python\nreturn json.dumps({\n    \"_html\": '<div class=\"my-widget\">Rich content here</div>',\n    \"summary\": \"Widget rendered successfully\",\n})\n```\n\nThe person gets the rendered widget. The model gets one line saying it worked. The markup of a chart or table stays out of the context.\n\n## What to keep in mind\n\nDatasette Agent is alpha software, and the version Willison wrote up most recently was 0.7a1 on 24 November. The details above describe the README on the main branch on 6 December and may change.\n\nThe model for a conversation is fixed when it starts and cannot be switched later. Only models that can call tools are offered.\n\nWe read the documentation. We did not install the plugin or test whether the permission filter and the approval step hold up against a model that tries to get around them.\n\n## Sources\n\n- [Simon Willison, Datasette Agent: an AI assistant for analyzing data in SQLite, 5 December 2026, with the video](https://simonwillison.net/2026/Dec/5/datasette-agent/)\n- [datasette/datasette-agent, README, Apache-2.0. The code samples are from there.](https://github.com/datasette/datasette-agent)\n- [Simon Willison, posts tagged datasette-agent, for the commands and release dates](https://simonwillison.net/tags/datasette-agent/)\n- [datasette-llm 0.2a0, 5 December 2026](https://github.com/datasette/datasette-llm/releases/tag/0.2a0)\n\n## How this was checked\n\nEvery statement about behaviour was read against the README. No code on this page was run by us.\n\n---\n\nAI wrote this piece from the sources listed, and nobody reviewed it individually before publication. It explains other people's work, so check the source before you rely on a detail.\n\nCite as: IKANGAI AI Engineering, \"Datasette Agent hides a tool from the model when the user may not use it\", 2026-12-06, https://ai-engineering.ikangai.com/articles/datasette-agent-hides-a-tool-from-the-model-when-the-user-may-not-use-it/\n", "date_published": "2026-12-06T08:01:00+00:00", "tags": ["tool"], "external_url": "https://simonwillison.net/2026/Dec/5/datasette-agent/"}]}