{"slug": "show-hn-psudo-47mb-2-bit-coding-model-polish-prefix-ir-and-rust-transpiler", "title": "Show HN: Psudo – 47MB 2-bit coding model, Polish-prefix IR, and Rust transpiler", "summary": "A developer released Psudo, an open-source coding stack built around a 47.0 MB, 100.7M-parameter 2-bit ternary (TQ2_0) model that runs local code synthesis within a 4 GB VRAM budget on an NVIDIA GTX 1660 Ti. The project pairs a token-compressed .psudo DSL with a Polish-prefix intermediate representation (pIR) that cuts token counts 45–60% versus surface syntax, and a pushdown-automaton mask (PirPdaConstraint) over the 8,192-token BPE vocabulary that the author reports yields a 0% syntax error rate at decode time. Verified .psudo code lowers through a borrow checker and sandbox into safe Rust with zero unwrap calls, and both quantized .gguf checkpoints (47.0 MB and 23.2 MB) ship in the repo, built with plain cargo and no CUDA or C++ toolchains, trained on roughly 7,800 borrow-checked trajectories.", "body_md": "A token-compressed DSL (`.psudo`), a Polish-prefix intermediate representation (` pIR`), a borrow-checked safe Rust transpiler, and a pure-Rust 2-bit ternary (`TQ2_0`) inference engine—built to run local code synthesis inside a **4 GB VRAM** budget.\n\n``` php\nflowchart LR\n    A[\".psudo DSL\"] --> B[\"pIR (Polish-prefix IR)\"]\n    B --> C[\"pseudo-engine (100M TQ2_0 + PDA Mask)\"]\n    C --> D[\"Borrow Checker & Sandbox\"]\n    D --> E[\"Safe Rust (0 unwrap)\"]\n```\n\n| Metric | Value | \n|---|---|\n| Primary Model Footprint | `47.0 MB` (`100.7M` params,`TQ2_0` 2-bit ternary weights) | \n| Context Compression | `45–60%` fewer tokens than surface syntax via`pIR` | \n| Syntax Error Rate | `0%` at decode time via Pushdown Automaton (`PirPdaConstraint` ) masking | \n| Runtime Dependencies | Zero (pure Rust, `memmap2` , no CUDA/C++ toolchains required) | \n| Training Dataset | `~7,800` borrow-checked & sandbox-verified trajectories | \n\nBoth quantized `.gguf` checkpoints (`47.0 MB` and `23.2 MB`) ship right in this repo, and everything compiles with plain `cargo` (zero C++, Python, or CUDA dependencies):\n\n```\ngit clone https://github.com/steveSujo/psudo.git\ncd psudo\ncargo build --release && ./target/release/psudo demo\n```\n\nI wanted to run and train coding models on my own machine—not rent bigger GPUs or burn cloud token quotas on every loop and helper function.\n\nMy laptop has an **NVIDIA GTX 1660 Ti with 4 GB of VRAM** and limited RAM, so running frontier models locally is out of the question. Instead of seeing those limits as the problem, I treated them as **creative constraints**: how can I make the best out of this? Finding a creative solution is way more fun than throwing raw power at the problem or trying to vertically scale my PC.\n\nRunning a small, limited model with **2-bit precision (`TQ2_0`)** shrinks the VRAM footprint enough to live comfortably alongside an IDE and compiler—and exploring how far that tiny model can push raw coding power became the whole point:\n\n1. **A tiny surface language (`.psudo`):** Python-indented, minimal punctuation, almost zero boilerplate tokens.\n2. **Lowering to safe Rust (`pseudo-transpiler`):** A toy language has no ecosystem. To build real binaries, verified and borrow-checked`.psudo` lowers into safe Rust (`0``.unwrap()` or`.expect()` calls) and compiles with`cargo` .\n3. **The Cactus & Needle spark:** Seeing[Cactus](https://github.com/cactus-compute/cactus) and[Needle](https://huggingface.co/Cactus-Compute/needle3) —2-bit on-device models (`29M–121M` params in`8–29 MB` ) beating much larger models on constrained tool calls—showed what tight constraints can do.\n4. **\"What if?\":*** What if I trained a ~100M 2-bit ternary model (`TQ2_0`) whose only job is writing atomic `.psudo` function bodies locally, while I (or a frontier LLM) stay at the orchestrator level?*\n\nAsking a `100M` model to emit verbose surface syntax wastes half its context window on keywords and whitespace. Instead, the model emits **pIR (Pseudo Intermediate Representation)**—a Polish-prefix S-expression format where `fn` is `f`, `let` is `v`, `return` is `r`, `if` is `?`, and `while` is `w`:\n\n```\n// Surface .psudo (what humans read)\nfn clamp_val(val, lo, hi)\n    if val < lo\n        return lo\n    if val > hi\n        return hi\n    return val\n\n// Wire pIR (what the 100M model emits)\nf clamp_val (val lo hi) [\n  ? (< val lo) [ r lo ]\n  ? (> val hi) [ r hi ]\n  r val\n]\n```\n\nThat trade buys two things:\n\n- **45–60% fewer tokens** per function body.\n- **0% syntax errors at decode time:**`pseudo-engine` runs a pushdown automaton (`PirPdaConstraint` ) over the`8,192` -token BPE vocab and masks out invalid tokens*before* sampling.\n\n- **`pseudo-100m-tq2_0.gguf` (`100.7M` params, `47.0 MB`) — Primary:**` d_model = 768` ,`14` layers,`12` heads (`4` KV heads),`FFN = 2048` ,`vocab = 8,192` ,`max_seq_len = 512` ,`TQ2_0` ternary weights (`{-1, 0, 1}` ). Auto-discovered by`psudo synth` for ~15-line atomic stubs (guards, math, loops, JSON/KV helpers).\n- **`pseudo-33m-tq2_0.gguf` (`33.6M` params, `23.2 MB`) — Embedded Fallback:**` d_model = 512` ,`8` layers,`8` heads (`4` KV heads). Baked into the`psudo` binary for offline smoke tests if no external`.gguf` is present.\n\nBoth were distilled from [`Qwen/Qwen2.5-Coder-7B-Instruct-AWQ`](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-AWQ) plus a synthetic generator—every sample had to pass type checking, borrow checking, and sandbox execution in headless `psudo` before being compiled to canonical `pIR` (`~7,800` verified trajectories across `<pir>`, `<error>` 1-shot auto-heal, `<zettel>`, and `<clarify>`).\n\nRequires Rust `1.75+`. Build both binaries (` psudo` and `pseudo-engine`):\n\n```\ncargo build --release\n```\n\n`examples/` ships three pre-built workspace capsules (`psudo.bin`) with mock sandbox data in `.pseudo/sandbox/`:\n\n```\n# 1. JSON Server Log Incident Filter\n./target/release/psudo check examples/log-incident-filter/psudo.bin --all-modules\n./target/release/psudo build examples/log-incident-filter/psudo.bin --run\n\n# 2. IoT Temperature Sensor Alert Monitor\n./target/release/psudo build examples/sensor-alert-monitor/psudo.bin --run\n\n# 3. API Tiered Quota & Billing Calculator\n./target/release/psudo build examples/quota-fee-calculator/psudo.bin --run\n```\n\nYour code lives inside a single signed capsule file (`psudo.bin`). You (or an outer coding agent) declare signatures, stubs, and tests; `psudo synth` fills in the bodies locally.\n\n```\n# 1. Initialize a workspace (templates: blank, log, sensor, quota)\npsudo init my-app --template blank --with-docs && cd my-app\n\n# 2. Declare an atomic @stub function (defaults to ./psudo.bin when omitted)\npsudo vfs stub compute_fee units rate free_tier \\\n  --directive \"if units <= free_tier return 0, else return (units - free_tier) * rate\"\n\n# 3. Synthesize with auto-discovered 100M GGUF (auto-starts persistent --daemon)\npsudo synth --write\n\n# 4. Inspect call-graph DAG and behavioral contract (without dumping raw code)\npsudo dag --format mermaid\npsudo contract\n\n# 5. Add an in-capsule test and wire the entrypoint\npsudo vfs test test_fee --call \"compute_fee(15, 2, 10)\" --expect \"10\"\npsudo vfs wire --entry main_task --call \"print(compute_fee(15, 2, 10))\" --return \"0\"\n\n# 6. Borrow-check, test, run directly, or compile to native Rust\npsudo check -a\npsudo test\npsudo run --call \"compute_fee(15, 2, 10)\"\npsudo build --run\n```\n\nWhen I tested outer LLM agents with this CLI, they kept peeking at the `.psudo` source and hand-writing functions instead of using `psudo synth`. So `psudo vfs show --all` and `psudo synth --print` stay locked unless you pass the key:\n\n- **Question:***\"What jumped over the lazy dog?\"*\n- **Key:**`--reveal-code \"the slow pink elephant\"`\n\nFor agent harnesses, [`psudo-orchestrator`](https://github.com/steveSujo/psudo/blob/main/.agents/skills/psudo-orchestrator/SKILL.md) and `psudo mcp` (stdio JSON-RPC) are included. Run `psudo --help`, `psudo docs`, or `psudo -s` for the full reference.\n\n**This is not a polished product.** It is an exploration of an idea with plenty of sharp corners:\n\n1. **Keep stubs atomic:** A`100M` 2-bit model cannot write an HTTP server in one shot. Give it small, single-purpose functions (guards, clamping, arithmetic, simple loops, KV/JSON helpers).\n2. **Grammar masking != semantic intelligence:** The PDA mask guarantees valid`pIR` brackets and ops, so an out-of-distribution prompt still produces valid syntax—just logically wrong fallback code.\n3. **Strict 4-space indentation & `//` comments:** 2-space indents and tabs fail with`E002` ;`#` comments fail with`E001` .\n4. **Sealed `psudo.bin` feels weird at first:** Keeping source inside a masked binary capsule is deliberately awkward for manual editing—it exists to keep outer agents in the orchestrator seat.\n5. **Bimodal CPU speeds:**`pseudo-engine --benchmark` swings between fast runs when`memmap2` pages are hot and slow runs on cold pages or OS background scheduling.\n6. **Windows-first mileage:** Most testing happened on Windows 11. Rebuilding while`psudo.exe` is running hits Windows file locks, and Linux/macOS paths have less mileage.\n\nExpect bugs! I'll keep tweaking the language and the tiny model as I experiment.\n\n| Path | Description | \n|---|---|\n| [`pseudo-lang/`](https://github.com/steveSujo/psudo/blob/main/pseudo-lang) | `.psudo` lexer, parser, borrow checker,`psudo.bin` VFS capsule, contract generator, and`psudo` CLI | \n| [`pseudo-engine/`](https://github.com/steveSujo/psudo/blob/main/pseudo-engine) | Pure-Rust zero-copy GGUF parser, `TQ2_0` ternary kernels, 2-tier INT8 KV cache, PDA sampler, and`--daemon` | \n| [`pseudo-transpiler/`](https://github.com/steveSujo/psudo/blob/main/pseudo-transpiler) | Deterministic IR lowering between `.psudo` and safe, zero-`unwrap()` Rust | \n| [`examples/`](https://github.com/steveSujo/psudo/blob/main/examples) | Pre-built capsules ( `log-incident-filter` ,`sensor-alert-monitor` ,`quota-fee-calculator` ) | \n| [`templates/`](https://github.com/steveSujo/psudo/blob/main/templates) | Source `.psudo` templates and`.pseudo/sandbox/` fixtures for`psudo init` | \n| [`.agents/skills/`](https://github.com/steveSujo/psudo/blob/main/.agents/skills) | `psudo-orchestrator` skill for LLM harnesses |", "url": "https://wpnews.pro/news/show-hn-psudo-47mb-2-bit-coding-model-polish-prefix-ir-and-rust-transpiler", "canonical_source": "https://github.com/steveSujo/psudo", "published_at": "2026-11-19 13:17:56+00:00", "updated_at": "2026-11-19 13:46:27.668566+00:00", "lang": "en", "topics": ["large-language-models", "ai-tools", "ai-research", "developer-tools", "ai-infrastructure"], "entities": ["Psudo", "pIR", "TQ2_0", "Rust", "NVIDIA GTX 1660 Ti", "Cactus", "Needle", "PirPdaConstraint"], "also_reported_by": [], "takeaway": "A 100.7M-parameter TQ2_0 ternary model at 47.0 MB can emit Polish-prefix pIR instead of surface syntax to cut tokens 45–60%, with a pushdown-automaton mask over the 8,192-token vocabulary enforcing 0% syntax errors at decode time.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/show-hn-psudo-47mb-2-bit-coding-model-polish-prefix-ir-and-rust-transpiler", "markdown": "https://wpnews.pro/news/show-hn-psudo-47mb-2-bit-coding-model-polish-prefix-ir-and-rust-transpiler.md", "text": "https://wpnews.pro/news/show-hn-psudo-47mb-2-bit-coding-model-polish-prefix-ir-and-rust-transpiler.txt", "jsonld": "https://wpnews.pro/news/show-hn-psudo-47mb-2-bit-coding-model-polish-prefix-ir-and-rust-transpiler.jsonld"}}