[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-108180":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":29,"updatedAt":30,"readmeContent":31,"aiSummary":32,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":33,"discoverSource":34},108180,"qwenFS","vixhal-baraiya\u002FqwenFS","vixhal-baraiya","Qwen3.5-2B with a filesystem compiled and inserted directly into its weights.","",null,"Python",98,11,67,1,0,2,31,47.34,"MIT License",false,"main",true,[25,26,27,28],"artificial-intelligence","filesystem","llm","qwen3-5","2026-11-04 18:48:31","2026-11-19 05:30:45","# qwenFS: Qwen keeps its own files\n\n**qwenFS is an experimental model: Qwen3.5-2B with a filesystem compiled and inserted directly\ninto its weights.** It is not a plugin, a tool server or a database behind an API. The\nfilesystem is 8 transformer layers in front of Qwen's own 24, and none of their weights are\nlearned: every one is set by construction. Qwen saves, reads, organizes and links its own files\nthrough its normal tool calls, and the model answers every call itself.\n\n![qwenFS saving a file and reading it back: the FS layers, the file table and the copy layer, token by token](docs\u002Fqfs-demo.gif)\n\n## How it works\n\n**The calls.** Qwen writes ordinary Qwen3.5 tool calls. The circuit reads each call as Qwen\nwrites it, keying on the single tokens Qwen's tool-call format always uses (`=name`, `=text`,\n`=target`, `>`, newline, `\u003C\u002Ftool_call>`, …). A call's kind comes from its parameters; only\n`unlink_files` is told apart by its function-name token. After `\u003C\u002Ftool_call>`, the circuit\nprints the tool response itself, in a user turn as Qwen's chat template has it, then opens a new\nassistant turn, and Qwen answers.\n\n| Tool | What it does | The circuit's response |\n|---|---|---|\n| `write_file(name, text)` | save a file (replaces it) | `saved` and the path |\n| `append_file(name, text)` | add text to a file, on a new line | `saved` and the path |\n| `read_file(name)` | read a file, token for token | the stored text, or `not found` |\n| `list_files()` | every file | one path per line, or `empty` |\n| `link_files(name, target)` | link a file to another | `linked` and both paths |\n| `unlink_files(name, target)` | remove that link | `removed` and both paths |\n| `list_links(file)` | files a file links to | one path per line, or `empty` |\n| `list_backlinks(path)` | files that link to a file | one path per line, or `empty` |\n| `search_files(query)` | files whose text has a word | one path per line, or `empty` |\n\nPaths make folders (`people\u002Falice.txt`, `projects\u002Fcafe.txt`); links and backlinks make a graph.\n\n**Where the filesystem lives.** Every part of the model has a job:\n\n- **Attention** holds the files. A write's text stays in the copy layer's attention log, keyed by\n  (file index, version, offset); a read is an exact copy, token by token. Each write or append\n  is a segment, a version of its own: a file is its segments since its last write, and a read\n  copies them in order, printing the next segment's read ack at the end of each one. The ack\n  restarts the offset count, so a file can be far longer than one write. A second attention\n  layer looks paths up: a path finds its file's index, or falls back to \"not found\". A third,\n  the seek layer, holds a row per word and per link. Every word of a written text is a row,\n  keyed by (file index, base, the word's tokens); a search checks one file per response token\n  against that file's current base, so a word only an old version had is not found. A link or\n  unlink that changes a pair adds a row, +1 or -1; one that changes nothing prints a no-op\n  variant of \"linked\" \u002F \"removed\" and adds none, so a pair's rows alternate and it is linked\n  when they average above 0. A link listing checks one file per token the same way.\n- **Gated DeltaNet state** holds the tables and registers: the version, base and path tables\n  (128 rows each, one per file, which is what sets the file limit), the file count and the\n  call's state.\n- **MLPs** parse the tool calls and pick every forced token: acks, the response frame, echoed\n  paths, each file's marker or skip in a search or link listing. A file a listing passes over\n  gets a skip token, which Qwen reads as a newline.\n- **Offsets** come from a decaying DeltaNet counter, read in the head norm's eps regime and\n  decoded exactly to 600 tokens.\n\n**Exactness.** Every token carries a ballast dim, so each norm in the FS layers is a fixed scale.\nRegisters pad their state rows to 2, 8, 32 or 128 set rails, so reads come back as exactly 0\u002F1\nor ±1. A key that is off sits far below zero, since a DeltaNet key's l2-norm would rescale any\nsmall value to full strength. `qfs\u002Fcircuit.py` describes each layer.\n\n**The merge.** `qfs.merge` widens Qwen's residual from 2048 to 4096, zero-pads its matrices,\nscales its norm gains by √(2048\u002F4096), puts the FS layers in front of Qwen's and appends the FS\ntokens to the vocabulary. The FS layers clear their dims before Qwen's layers run, except a small\noutput code that the tied lm_head reads at the end, so a forced token wins and Qwen's logits are\nuntouched everywhere else.\n\n**Disk.** A filesystem saves to a compact image: the paths, each file's current segments as\n3-byte token ids (with their lengths), and the links (about 3.3–3.8 bytes per stored token). A\nfresh session mounts the image (the tables, the lookup rows and the search rows, one per\ndistinct word of each file) and pages a segment's text in only when the model emits that\nsegment's read ack. Paging rebuilds the copy rows from the token ids with the model's own\nprojections. See `qfs\u002Fdisk.py`.\n\n## What runs where\n\n- **The weights**: parsing each call, every lookup, every table update, every forced token,\n  every copied token of a read. Nothing outside the model decides what a response says.\n- **The chat loop** (`qfs\u002Fchat.py`): decodes tokens and stops at `\u003C|im_end|>`. It samples at\n  temperature 0.7: with greedy decoding, a 2B model tends to repeat tool calls. Forced tokens lead\n  by hundreds of logits, so sampling never changes them.\n- **Disk paging** (`qfs\u002Fdisk.py`): when the model emits a read ack, the runtime loads that\n  file's bytes, like a disk controller. The model picks the file and copies the text.\n- **The app's panel** (`qfs\u002Fmonitor.py`): it reads the filesystem out of the model's state (the\n  version, path and link tables) and keeps no copy of its own.\n\n## The doc\n\n`docs\u002Ffs-agent.md` is Qwen's system prompt by default: a reference for the tools, their\nresponses and conventions, with worked examples. Every example response in it was printed by the\nmerged model (`qfs\u002Fgen_doc.py`). In a scenario eval (save and recall, updating a list,\norganizing, searching, links and backlinks, unlinking one file, a missing file; 3 seeds, 57\nturns):\n\n| | Turns passed | Scenarios passed | Unneeded calls |\n|---|---|---|---|\n| No doc | 49\u002F57 | 17\u002F21 | 40 |\n| With the doc | 57\u002F57 | 21\u002F21 | 0 |\n\nWithout the doc, the misses are Qwen's calls, not the filesystem's answers: it saved Bob into\n`people\u002Falice.txt` (a search for Tokyo then rightly found that file), or repeated a call until\nthe turn ran out of tokens. The sample is small.\n\n## Results\n\nOn Qwen3.5-2B, on Apple silicon (MPS, bf16), every forced token is checked against the\ncircuit's reference, in one prefill and token by token from each response's start:\n\n- **Scripted sessions** (10 files: writes, rewrites, empty files, appends and long files of up\n  to 8 segments, links with repeats and no-ops, unlinks, listings, reads, searches): 6308\u002F6308\n  and 6372\u002F6372 forced tokens, 70\u002F70 responses each (two seeds).\n- **All 128 files**: a listing of every file, reads, links at the last index and a self-link,\n  link listings and searches across all of them, a rewrite and an append: 5355\u002F5355.\n- **From disk**, in a fresh session with an empty context, appending to a stored file and\n  reading it across its stored and new segments: 5989\u002F5989, 47\u002F47; saving over the mounted\n  image twice leaves it unchanged.\n- **Merged into Qwen3.5-2B**: exact on a 9,484-token session and a 6-file session with\n  appends, links and searches (prefill and token by token), and on the 128-file session in one\n  prefill.\n- **Qwen's text**: the top-1 prediction is unchanged at all 139 positions checked; KL about\n  2.5e-3 (from rounding the rescaled norm gains to bf16).\n\n## Limits\n\n- 128 files, paths of up to 8 tokens, about 590 tokens per write or append, 63 writes and\n  appends per file (so a file can hold about 37,000 tokens); a text cannot contain `\u003C\u002F`.\n- A search or a link listing prints a token per file (a skip for each that does not match), so\n  with many files its response is long.\n- Search finds one whole word, exactly and case-sensitively (`Paris`, not `paris`), of up to 3\n  tokens as Qwen writes the word alone; longer words are not found.\n- No partial edits: changing a file means writing it again.\n- Qwen's judgment is the weak part, not the filesystem: it sometimes answers from the\n  conversation instead of reading a file, or makes calls it wasn't asked for.\n- About 20 tokens\u002Fs on MPS (PyTorch fallback kernels for Gated DeltaNet).\n\n## Quickstart\n\nRequirements: Python 3.11+, [uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F),\n[just](https:\u002F\u002Fgithub.com\u002Fcasey\u002Fjust), and about 16 GB of free memory for the merged model\n(Apple silicon, an NVIDIA GPU or a CPU).\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fvixhal-baraiya\u002FqwenFS && cd qwenFS\njust setup\njust build\njust chat\n```\n\n`just build` downloads Qwen3.5-2B and compiles the filesystem into it. `just chat` opens the\nchat app: each tool call shows as one line with the circuit's response under it, and the panel\non the right is the filesystem as the model holds it, decoded from its DeltaNet state after\nevery response: the files and folders, the links, the FS layers lighting up as they act, and\nthe disk. The filesystem persists in `fs\u002F`: the app starts on it, and saves to it after every\nturn that changes it, so your files are there in the next chat. A stored file pages in only when\nQwen reads it. `\u002Fnew` starts a new chat on your files, `\u002Fformat` erases them, `--disk DIR` keeps\nthem elsewhere and `--no-disk` keeps them in memory only; `\u002Fhelp` lists the rest.\n\n`just ask \"Save notes\u002Ftodo.txt: call the dentist\" \"What's on my todo list?\"` sends messages\nwithout the app. `just` lists every recipe: `test` (the circuit alone, no Qwen needed),\n`test-disk`, `test-tui` (the app on a scripted session), `check` (the merged model) and `eval`\n(add `--doc docs\u002Ffs-agent.md` to use the doc).\n\n## Repository\n\n| Path | What it is |\n|---|---|\n| `qfs\u002Fcircuit.py` | The filesystem as Qwen3.5 layers: every weight, layer by layer |\n| `qfs\u002Fmerge.py` | Building the merged Qwen3.5 checkpoint |\n| `qfs\u002Fdisk.py` | The disk image: saving, mounting and paging files in |\n| `qfs\u002Ftui.py` | The chat app: the chat, and the filesystem panel |\n| `qfs\u002Fbridge.py` | The app's session: a turn as a stream of events |\n| `qfs\u002Fmonitor.py` | The filesystem decoded from the model's state; the panel's lights |\n| `qfs\u002Fchat.py` | The chat loop, and a command-line chat |\n| `qfs\u002Fevaluate.py` | The scenario eval |\n| `qfs\u002Fgen_doc.py` | Writes `docs\u002Ffs-agent.md`, running its examples on the model |\n| `docs\u002Ffs-agent.md` | The filesystem reference Qwen gets as its system prompt |\n| `tests\u002F` | The circuit on scripted sessions, the disk image, the merged model |\n\n## Related\n\n[qwenGPU](https:\u002F\u002Fgithub.com\u002Fvixhal-baraiya\u002FqwenGPU) compiles a SIMT GPU into the same model.\nqwenFS shares no code with it: its layers are built directly in Qwen3.5's own layer types.\n\n## License\n\nThe code is MIT, see [LICENSE](LICENSE). A checkpoint built with `qfs.merge` is a modified\n[Qwen3.5](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3.5-2B) model (its config is widened and filesystem\nlayers are added; Qwen's own weights are unchanged apart from rescaled norm gains), so its\nweights fall under Qwen's Apache-2.0 license.\n","qwenFS 是一个实验性大语言模型，将文件系统功能直接编译并嵌入 Qwen3.5-2B 模型权重中，无需外部插件或 API 服务。其核心由 8 层预设权重的 Transformer 层构成，实现文件读写、目录组织、符号链接、反向链接及关键词搜索等完整文件操作能力；所有文件内容以 token 级精度在注意力机制中持久化存储与检索。该模型适用于需要轻量级、离线、自包含状态管理的 LLM 应用场景，如本地知识库交互、沙箱化工具调用演示、模型内状态建模研究等。","2026-11-24 04:33:46","CREATED_QUERY"]