jrad123777's picture
react/seam LoRA model card
0630b96 verified
|
Raw
History Blame Contribute Delete
5.2 kB
---
license: apache-2.0
base_model: mlx-community/Qwen3.6-35B-A3B-4bit
library_name: mlx
tags:
- mlx
- lora
- react
- mantine
- tanstack
- effect-ts
- typescript
- code
- qwen3
language:
- en
pipeline_tag: text-generation
---
# Effect↔React Seam Qwen3.6-35B-A3B — React/Seam LoRA (MLX, rank-8, unfused)
A local **LoRA adapter** that teaches [Qwen3.6-35B-A3B-4bit](https://huggingface.co/mlx-community/Qwen3.6-35B-A3B-4bit)
to write the **thin React front-end + the React↔Effect seam** of a modern typed-functional stack:
**React 19 + [Mantine v9](https://mantine.dev) view, [TanStack](https://tanstack.com) Query/Start, and the
[Effect v4](https://effect.website) boundary** (`effect@4.0.0-beta.8x`, `effect/unstable/*`). Built
**$0-local** on a single Apple M5 Max (48 GB). It is the React half of a dual-LoRA library that shares ONE
base with the Effect "write" LoRA — the two are hot-swapped in-process behind one server.
> **Architecture it bakes in:** Contract = Effect `Schema` · Logic = Effect · **View = React (NO business
> logic in `.tsx`)** · typed errors carried across the server-fn boundary as a `Schema` discriminated union
> (pattern A) or reconstructed client-side via `effect/unstable/rpc` (pattern B). It writes idiomatic v4
> seam code: `Context.Service` (not `Context.Tag`), `Result` (not `Either`), `queryOptions`/`mutationOptions`,
> `useMutation().isPending` (v5), `Schema.TaggedErrorClass` for RPC contract errors — no `throw` across boundaries.
> **Honest framing.** This is a rank-8 **adapter** (apply unfused on the base), not a fused model. The
> headline numbers below are the **served PRODUCT** (best-of-N sampling + a real `tsc --strict` gate with the
> Mantine/TanStack/Effect type roots), not bare greedy weights — `tsc` is the only arbiter. The win is
> concentrated where it matters: the **seam**, which the base model gets wrong.
## What it is
- **Base:** `mlx-community/Qwen3.6-35B-A3B-4bit` (`qwen3_5_moe`, 35.9B total / ~3B active).
- **Adapter (`react_v1s42_i100`):** rank-8 LoRA (seed 42, the val-minimum checkpoint), warm-started from the
shared CPT base, SFT on 94 `tsc`+LSP-gated pairs (38 react-view + 56 seam) covering all 11 seam topics.
- **This repo:** the LoRA adapter (`adapter_config.json` + `adapters.safetensors`, the 408-tensor delta).
Apply it unfused with `mlx_lm`.
## Eval — frozen 26-task React/seam held-out, served product (best-of-N + real `tsc`)
The held-out set (`eval/tasks_heldout_react.jsonl`, 11 react-view + 15 seam) is **frozen**; each task is
routed to the gate it must pass (react-view → React+Mantine JSX gate; seam → Effect+TanStack+Mantine gate).
The same prompts are used for the base and the adapter, so any delta is the adapter's baked-in idioms.
| config | compiled @ 26 | compiled+rubric @ 26 |
| --- | --- | --- |
| base model (no adapter) | 13 / 26 | 8 / 26 |
| **this adapter (`react_v1s42_i100`)** | **24 / 26** | **15 / 26** |
**+11 compiled / 0 regressions — every gain is on the SEAM lane** (base 2/15 → 13/15; react-view 11/11 for
both, i.e. the base already handles plain Mantine views, and the adapter adds the React↔Effect boundary it
could not write). Measured at best-of-16; the live server runs best-of-8 with the same gate.
## How it's served
The production server (`serve/serve.py` in the training repo) routes by intent: **seam / react → this
adapter; Effect business-logic / edits → the Effect "write" champion** — both LoRAs on one resident base,
hot-swapped in-process (a `load_weights` weight-overwrite; the two adapters share an identical tensor
namespace). Each request is best-of-N sampled and kept only if it passes the lane's real `tsc` gate.
## Usage (mlx_lm, Apple Silicon)
```bash
pip install mlx-lm
python -c "
from mlx_lm import load, generate
# apply the adapter unfused on the base
model, tok = load('mlx-community/Qwen3.6-35B-A3B-4bit', adapter_path='./')
prompt = 'Write a TanStack queryOptions factory userQuery(id) that fetches a User via a createServerFn running an Effect, returning a Result discriminated union. Output one tsx block.'
msgs = [{'role':'user','content':prompt}]
text = tok.apply_chat_template(msgs, add_generation_prompt=True, enable_thinking=False)
print(generate(model, tok, text, max_tokens=640, verbose=True))
"
```
**Tip:** for production, sample N times and keep the first output that passes `tsc --strict` against your
React/Mantine/TanStack/Effect type roots — that is the served product, not bare greedy.
## Limitations
- Rank-8 **adapter** — needs the exact base above; greedy single-shot is weaker than the best-of-N product.
- Targets `effect@4.0.0-beta.8x` + Mantine v9 + TanStack Query v5 / Start + React 19; other versions may drift.
- View tasks must be **thin** — this is deliberately NOT trained to put business logic in `.tsx`.
- MLX format → Apple Silicon. Reasoning disabled (`enable_thinking=False`); it's a direct code generator.
Companion: the Effect "write" LoRA / fused champion (`jrad123777/effect-qwen36-35b-write-lora`).
*Built $0-local. Trained and evaluated against the installed `.d.ts` with `tsc --strict` as the only
arbiter, and documented honestly.*