Skip to content

Phase 3: chat mode + kernel unit tests - #4

Merged
codewithfourtix merged 4 commits into
mainfrom
feat/phase-3-chat-and-tests
Jul 14, 2026
Merged

codewithfourtix merged 4 commits into
mainfrom
feat/phase-3-chat-and-tests

Conversation

@codewithfourtix

Copy link
Copy Markdown
Owner

Polish pass — makes ember usable as an assistant and adds a test suite.

Chat mode

--chat wraps the prompt in Qwen's ChatML template (with --system), streams only the reply, and stops at <|im_end|>. Verified against the NumPy reference:

Q: Write a haiku about Rust programming.
A: Rust's syntax shines, / Type-safe, concise, and fast, / Programming heaven.

Tests

cargo test covers every kernel against small hand-checked values: mat-vec, RMSNorm (unit RMS), RoPE (norm-preserving), SwiGLU, softmax, greedy/RNG sampling, and INT8/INT4 quantization round-trips + memory. Constants cross-checked in NumPy.

Completes the three-phase plan. Remaining: tokens/sec numbers, which need the binary built on a host without the local Smart App Control toolchain block.

Wraps a user turn (with system prompt) in the template the instruct models are
trained on, so the model answers rather than completes.
In chat mode the prompt is templated and only the assistant's reply is streamed;
completion mode is unchanged. Generation stops on the <|im_end|> turn token.
Covers mat-vec, RMSNorm (unit RMS), RoPE (norm-preserving), SwiGLU, softmax,
greedy/RNG sampling, and INT8/INT4 quantization round-trips and memory — all
against small hand-checked values.
Copilot AI review requested due to automatic review settings July 14, 2026 08:04
@codewithfourtix
codewithfourtix merged commit dbaddd9 into main Jul 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codewithfourtix
codewithfourtix deleted the feat/phase-3-chat-and-tests branch July 14, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants