Repository navigation
[New Model]: Add Valen-Preview-0923 reference serving — community help wanted #84
Description
Model and motivation
- Reference implementation: Liuziyu77/Valen
- Released checkpoint: Valen-Team/Valen-Preview-0923
- Execution contract: Valen architecture
Valen evaluates text, images and video against supplied candidates without autoregressive answer generation. Its Qwen3.5 backbone overlaps with System1-Omni's existing backend work, while its learned decision head and multimodal processing require model-specific integration.
The released 2B preview is Sokoban-trained and requires both the Valen checkpoint and its pinned Qwen3.5-2B base. The separate General results are not evaluation results for this preview.
First integration slice
Serve the reference implementation behind the existing Rust frontend. Target text and single-image choice requests first; document unsupported question types and media explicitly. Broader noul, score, video and native acceleration can follow as separate slices after the reference path is usable.
Done when
- Pin the reference code, base model and adapter/checkpoint revisions and record their respective licenses.
- Document input construction, candidate ordering, decision-head readout, probability normalization, confidence and usage semantics.
- Implement model-owned loading, preprocessing, execution and response construction under
src/models/valen/. - Preserve all trained components required by the preview: decision head, language LoRA, visual merger and trained visual blocks. Do not load only the head.
- Compare real text and image outputs with the pinned reference, using declared probability tolerances and decision-agreement criteria.
- Validate a real first inference after readiness and the Rust-frontend request path; report the tested hardware and any checks that could not run.
- Add setup, launch and example requests under
recipe/valen/, tests under roottests/, and update the support matrix, docs navigation and [Tracking]: Model support status #83.
Follow CONTRIBUTING.md. Coordinate response-field decisions with #61. Native vision work for Cua-S1 (#56, #59, #63, #64) is related infrastructure, not evidence that Valen already runs natively.
Community help wanted
Help with checkpoint/reference investigation, the worker adapter, CPU contract tests, GPU parity checks, or an independently reproduced recipe. Contributors familiar with Valen or Qwen3.5 vision are especially welcome.
Please comment with the slice you would like to take and any relevant environment. The first goal is a faithful, runnable reference service; performance claims come with separate measured evidence.
Activity
MrDongsls commentedon Oct 5, 2026
I’d like to take this issue. Will coordinate with #61 and update #83 during the integration.
hsliuustc0106 commentedon Oct 5, 2026
Thanks @MrDongsls, please go ahead—you’re already assigned.
The reference worker with text and single-image
choiceis a good first slice. Start by pinning the upstream code, base model and preview checkpoint, then bring up the worker and compare its outputs with the reference through the Rust frontend. Please keep all trained visual/LoRA components when loading the preview.Coordinate confidence/usage semantics with #61, and update #83 with the implementation and validation status as the work progresses. A small draft PR for the worker and recipe is welcome; native acceleration can follow once this path is reproducible.
hsliuustc0106 commentedon Oct 5, 2026
@MrDongsls, one additional requirement: please follow the updated architecture and integration contracts and contributing guide.
Keep the Valen integration split into clear stages:
src/backends/. The frontend owns HTTP transport and response delivery.The Python reference worker is suitable for the first slice. Preserve these processor/executor boundaries so native follow-ups can use Rust host orchestration and the shared runtime. Reuse the current worker interface while the remaining shared processing and batching layers are being developed.
Please include the prepared-input/output contract and ownership boundaries in the draft PR, and keep tests under the root
tests/tree.MrDongsls commentedon Oct 5, 2026
Thanks for the guidance. I’ll proceed in line with the project’s conventions and the direction discussed here.
MrDongsls commentedon Oct 7, 2026
@hsliuustc0106 Hi, the first integration slice is up for review: #115 — please take a look.
Once this lands, if you agree, I'd like to plan and take the follow-up slices as well:
noulandscorequestion types on the reference worker first (they mostly need protocol/postprocessing work — the pinned compiler already supports them), then video state, and a native Rust/CUDA text-only executor reusing the shared Qwen3.5 executor, with the multimodal native path building on the Cua-S1 vision work (#56 / #59 / #63 / #64).MrDongsls commentedon Oct 11, 2026
Plan for the remaining slices
PR #115 gives the reference path:
choiceover text and one image. This is a proposal for the rest — what we can reuse, what Valen actually needs, in what order, and where I think the traps are.What can be reused
The qwen3_5 CUDA backend can run the whole backbone as-is. I checked the pinned Qwen3.5-2B config (
15852e8) against the loader's structural assertions inmodel.rs:100-178: 24 layers (18 Gated DeltaNet + 6 full attention), head_dim 256/128, mrope[11,11,10]. Everything passes, so the backbone itself needs no backend work.The trained vision parts are simple. The checkpoint's vision-top blocks and the merger are full-weight replacements of base tensors — I verified the keys, shapes and values against the base checkpoint — so they load as an ordinary weight update through the existing cua_s1 vision path. The one change that path needs is unpinning its 4B constants (
out_hidden_size2560 → 2048 and the merger width).Beyond that:
forward_multimodaltakes adapted BF16 image embeddings plus three-axis mrope positions, which is exactly the media-state prefix. It expects the vision-language adapter merged into the exported checkpoint.alloc_prefix,forward_multimodal_capture/_continue, covering attention KV, the GDN FP32 state and the conv tail) is merged; only jev_vl uses it today.Several open issue/PRs matter here:
forward_shared(shared prefix only runs once), with qwen3_5: add a GEMM handle with one algorithm per weight shape #98's fixed-GEMM handle underneath.What has to be built
noulandscoreon the reference worker: The pinned compiler already builds all three task types; PR Valen: serve Valen-Preview-0923 through a Python reference worker #115 only limits the wire.noulis one fixed true/false branch answeringP(true).scorecompiles one branch per level (2–10), takes one decision-head logit from each, softmaxes across them and answers the expected level. Response fields go through [RFC]: Write down which parts of the /v1/systemone contract all workers share #61.checkpoint.ptholds 428 trainable tensors: a rank-32 FP32 language LoRA, the BF16 vision-top blocks and merger, and two FP32 (256×2048) head projections. The export turns that into safetensors the native path can load. Two details: the base ships 36 FP32 tensors (A_log,linear_attn.norm) that the BF16-only loader rejects, and downcasting them is lossless against Valen's own BF16 runtime; and the LoRA can be merged or served separately (see below). Parity runs against the pinned reference at the existing 1e-6 gate.state.videogoes through the pinned processor, which samples at fps-2 (clamped to 4–768 frames) and folds frame pairs into 1536-wide patch rows. The reference defines no media limits, so we set our own: a codec whitelist, duration and size caps, a larger request body. One known blocker, reproduced in the reference environment (transformers 5.19): video compilation fails withImportError: torchcodec is not installed. Picking that dependency is part of this slice.forward_multimodal; what's missing is bookkeeping, not math: parsingvideo_token_id, building multi-block sequences, lifting thet==1assertions (multimodal.rs:36-39and:139-150,vision/geometry.rs:11-13,vision/model.rs:236,image_preprocess.rs:144), and choosing a decode dependency. An FFmpeg sidecar is closest to what [RFC]: Native Rust/CUDA support for OmniJev-4B v1.1 and community help #114 assumed for OmniJev; its frame-mosaic approach itself does not transfer, since Valen needs real temporal frames.forward_sharedto multimodal prefixes and to Score's K branches at once.Order
noul/scoreon the reference worker — independent, the smallest slice, settles the contract fields with [RFC]: Write down which parts of the /v1/systemone contract all workers share #61, and produces the fixtures everything later compares against.choicefirst, thennoul/score, with CPU fixtures and GPU parity under a declared tolerance.Worth attention
W + 2·BAin BF16) differs from the reference's unmerged FP32 application by about one BF16 ulp per layer output. Fine for export, not bit-exact — a decision to make in slice 2 and declare. Strict parity means serving the FP32 LoRA separately; the vision path already loads unmerged LoRA, the text path does not.shared_statetraining mode is likewise not a serving shortcut — parity is against the per-branch reference. When prefix reuse lands, we should also say howinput_tokens(state counted once) andinternal_usage.compute_tokens(per-branch recompute) relate to what actually runs.ceil(frames/2)·(H'/32)·(W'/32)vision tokens plus roughly 4–8 text tokens per frame. The request limits in slice 4 are what actually protects this.