Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
b954a84
docs: add benchmarks, correctness, and update README; feat: add error…
yash27-lab Apr 16, 2026
df20dd9
Overhaul into a correctness-first, verified Metal inference engine
yash27-lab Jun 28, 2026
b320808
ci: fix unused_mut on non-macOS build
yash27-lab Jun 28, 2026
d52ab77
Add from-scratch GPT-2 inference: BPE tokenizer, Metal kernels, text …
yash27-lab Jun 29, 2026
6627021
docs: remove emojis from README
yash27-lab Jun 29, 2026
cbdead1
Document runtime requirements
yash27-lab Jul 28, 2026
c0dc3ea
docs: add quick troubleshooting guide
yash27-lab Jul 31, 2026
675d110
docs: link troubleshooting guide from README
yash27-lab Aug 1, 2026
9046ffa
docs: clarify CPU backend quickstart
yash27-lab Aug 2, 2026
fb6796b
docs: add test command reference
yash27-lab Aug 3, 2026
6bdaab0
docs: add documentation index
yash27-lab Aug 4, 2026
cc48d63
docs: link documentation index from README
yash27-lab Aug 5, 2026
90d2ba5
docs: add formatting check to test reference
yash27-lab Aug 6, 2026
504b229
docs: add CPU-only preflight guidance
yash27-lab Aug 7, 2026
88fece5
docs: add contributor quickstart
yash27-lab Aug 8, 2026
2dcb53a
docs: link contributor guide from docs index
yash27-lab Aug 9, 2026
3fcb434
docs: link contributor guide from README
yash27-lab Aug 10, 2026
2bad777
docs: clarify contributor preflight requirements
yash27-lab Aug 10, 2026
5b4338d
docs: add formatting remediation guidance
yash27-lab Aug 11, 2026
6403ebb
docs: clarify test command working directory
yash27-lab Aug 12, 2026
3e087f5
docs: add validation quickstart to docs index
yash27-lab Aug 13, 2026
4042035
docs: note rustfmt requirement for format check
yash27-lab Aug 14, 2026
d4ff36d
docs: add pull request template
yash27-lab Aug 15, 2026
75e4ece
docs: add rustfmt troubleshooting note
yash27-lab Aug 16, 2026
54226f1
docs: clarify benchmark result scope
yash27-lab Aug 17, 2026
e94df9b
docs: clarify non-macOS crate support
yash27-lab Aug 18, 2026
c76ab8e
docs: describe public tokenizer module
yash27-lab Aug 19, 2026
7e62908
docs: describe public reference ops module
yash27-lab Aug 20, 2026
4d4c602
docs: describe public loader module
yash27-lab Aug 21, 2026
9e3d2fb
docs: describe public tensor module
yash27-lab Aug 22, 2026
b3824eb
docs: describe public model module
yash27-lab Aug 23, 2026
f048dda
docs: describe public GPT-2 module
yash27-lab Aug 24, 2026
91d5af1
docs: describe public inference engine module
yash27-lab Aug 25, 2026
fb623ca
docs: describe public Metal backend module
yash27-lab Aug 26, 2026
5da03a9
docs: add documentation check to PR template
yash27-lab Aug 27, 2026
04ee822
docs: clarify parity test guarantee
yash27-lab Aug 28, 2026
77cc8c0
docs: add bug report template
yash27-lab Aug 29, 2026
7f5ec4e
docs: add feature request template
yash27-lab Aug 30, 2026
18aa1a3
docs: add issue reporting guidance
yash27-lab Aug 31, 2026
7664bb0
docs: correct runnable quickstart commands
yash27-lab Sep 1, 2026
6f26474
docs: add compile check to test reference
yash27-lab Sep 2, 2026
502ebff
docs: add compile check to PR template
yash27-lab Sep 3, 2026
1e397aa
docs: correct CPU fallback command
yash27-lab Sep 4, 2026
b29ccb4
docs: add compile check to contributor preflight
yash27-lab Sep 5, 2026
ab6edd1
docs: add clippy check to test reference
yash27-lab Sep 6, 2026
eda7a63
docs: add clippy check to PR checklist
yash27-lab Sep 6, 2026
3ce7005
docs: add clippy to contributor preflight
yash27-lab Sep 6, 2026
ca3768d
docs: add clippy troubleshooting note
yash27-lab Sep 6, 2026
2cfff66
docs: request logs in bug reports
yash27-lab Sep 6, 2026
f65b0d4
docs: add feature success criteria
yash27-lab Sep 6, 2026
57b20e7
docs: clarify test reference coverage
yash27-lab Sep 6, 2026
e1fce9f
docs: link issue templates from docs index
yash27-lab Sep 6, 2026
0dda902
docs: expand CPU preflight guidance
yash27-lab Sep 7, 2026
13f494a
docs: clarify current CLI quickstart scope
yash27-lab Sep 8, 2026
18c9f74
docs: explain prompt compatibility flag
yash27-lab Sep 9, 2026
98ece51
docs: add CPU tests to quickstart
yash27-lab Sep 9, 2026
5bf439e
docs: clarify GPT-2 asset requirement
yash27-lab Sep 9, 2026
b0a491f
docs: clarify contributor preflight coverage
yash27-lab Sep 9, 2026
c486867
docs: add test coverage reminder to PR template
yash27-lab Sep 9, 2026
96f55b6
docs: add CPU reproduction question to bug template
yash27-lab Sep 9, 2026
e49cd41
docs: capture feature tradeoffs in issue template
yash27-lab Sep 9, 2026
ed3f97f
docs: clarify contributor guide coverage
yash27-lab Sep 9, 2026
6fc5e96
docs: add compile check to quickstart
yash27-lab Sep 10, 2026
214c913
docs: add clippy to quickstart
yash27-lab Sep 10, 2026
3376778
docs: note default request count in CLI help
yash27-lab Sep 10, 2026
d093f10
docs: add risk review to PR template
yash27-lab Sep 10, 2026
757b238
docs: add bug issue title prefix
yash27-lab Sep 10, 2026
854984e
docs: add feature issue title prefix
yash27-lab Sep 10, 2026
b531975
docs: clarify issue template labels
yash27-lab Sep 10, 2026
caf68e7
Reject MLP checkpoints with missing layer indices
yash27-lab Sep 30, 2026
50032e2
Reject overflowing owned tensor shapes
yash27-lab Sep 30, 2026
6fe1db0
Fail tensor comparisons on non-finite or truncated data
yash27-lab Sep 30, 2026
505455e
Reject non-finite results in Metal parity checks
yash27-lab Sep 30, 2026
c69ff1f
fix: check zero tensor allocation sizes
yash27-lab Oct 3, 2026
8d370df
Merge pull request #5: Make zero-filled tensor allocation fallible
yash27-lab Oct 3, 2026
b3f9548
Validate GPT-2 tokenizer assets before use
yash27-lab Oct 4, 2026
5e83a0d
fix: make empty tensor sizes independent of dimension order
yash27-lab Oct 5, 2026
10c1421
fix: revalidate tensor views before materializing values
yash27-lab Oct 5, 2026
3f1f8f2
fix: reject equally corrupted buffers in tensor comparisons
yash27-lab Oct 5, 2026
3f5878d
fix: distinguish tensor element counts from byte counts
yash27-lab Oct 5, 2026
d255c67
fix: validate MLP checkpoint buffers and layer connections
yash27-lab Oct 5, 2026
a1ee37d
fix: return errors for invalid MLP inputs and empty models
yash27-lab Oct 5, 2026
8a6da98
fix: surface engine channel closure without panicking
yash27-lab Oct 5, 2026
660c9a3
perf: skip inference requests canceled while queued
yash27-lab Oct 5, 2026
8a07b2e
fix: normalize zero inference queue depth
yash27-lab Oct 5, 2026
e9a748e
fix: validate GPT-2 configuration before loading weights
yash27-lab Oct 5, 2026
e4e196e
fix: validate GPT-2 checkpoint tensor shapes and buffers
yash27-lab Oct 5, 2026
156905a
fix: guard GPT-2 forward token and context bounds
yash27-lab Oct 5, 2026
f53d57e
feat: validate generation CLI options and add help and version
yash27-lab Oct 5, 2026
e0dbf00
feat: support a custom GPT-2 asset directory
yash27-lab Oct 5, 2026
f9e82c1
fix: report generation asset errors and vocabulary mismatches
yash27-lab Oct 5, 2026
e010e45
fix: honor explicit generation backend selection
yash27-lab Oct 5, 2026
72b5952
fix: seed blank generation prompts with the end-of-text token
yash27-lab Oct 5, 2026
ee60ee3
feat: let generation consumers stop the token loop
yash27-lab Oct 5, 2026
2002b45
fix: stream UTF-8 token bytes safely and handle output errors
yash27-lab Oct 5, 2026
0118f46
fix: propagate MLP CLI verification and inference failures
yash27-lab Oct 5, 2026
8a4ebc5
ci: execute CLI regressions and document runtime error behavior
yash27-lab Oct 5, 2026
86e7a9b
style: apply rustfmt to runtime fixes
yash27-lab Oct 5, 2026
92f5b3a
Merge pull request #7: Harden tensor validation and GPT-2 generation
yash27-lab Oct 5, 2026
b94ed59
fix: check matrix and dequantization size arithmetic
yash27-lab Oct 6, 2026
a503482
fix: reject invalid normalization epsilon
yash27-lab Oct 6, 2026
0b8f754
fix: validate normalization width and buffer sizes
yash27-lab Oct 6, 2026
66fb160
fix: validate rotary embedding dimensions and frequency base
yash27-lab Oct 6, 2026
dbcdc8b
fix: bound attention offsets and reject undefined attention inputs
yash27-lab Oct 6, 2026
8d76f87
fix: validate multi-head attention dimension products
yash27-lab Oct 6, 2026
993e1de
fix: preserve GPT-2 whitespace pre-tokenization boundaries
yash27-lab Oct 6, 2026
3468c5c
fix: parse hash-prefixed BPE merges and reject malformed lines
yash27-lab Oct 6, 2026
c6621e0
fix: reject duplicate BPE merge pairs
yash27-lab Oct 6, 2026
cd7609b
fix: validate BPE merge operand vocabulary entries
yash27-lab Oct 6, 2026
e3d2808
feat: add checked token decoding APIs
yash27-lab Oct 6, 2026
a9eba99
feat: expose checked token sampling and parameter validation
yash27-lab Oct 6, 2026
a3b91a9
fix: normalize sampling weights with wider arithmetic
yash27-lab Oct 6, 2026
c121f85
fix: make top-k tie handling and seeded candidate order deterministic
yash27-lab Oct 6, 2026
f2e7cf6
fix: exclude zero-probability candidates at sampling boundaries
yash27-lab Oct 6, 2026
29392f1
fix: validate generation prompts and stop-token IDs
yash27-lab Oct 6, 2026
0ed6e26
fix: reject zero-width MLP checkpoint layers
yash27-lab Oct 6, 2026
3b510a1
fix: revalidate public MLP layers before forwarding inputs
yash27-lab Oct 6, 2026
4d6a9f0
fix: install downloaded GPT-2 assets atomically
yash27-lab Oct 6, 2026
24fe130
feat: configure GPT-2 downloads and validate completed transfers
yash27-lab Oct 6, 2026
6bf9987
ci: test atomic asset downloads and document numeric contracts
yash27-lab Oct 6, 2026
65d8013
style: format numeric and tokenizer regressions
yash27-lab Oct 6, 2026
3afe197
fix: treat signed zero as a sampling tie
yash27-lab Oct 6, 2026
376cf34
perf: return empty matrix outputs without iterating rows
yash27-lab Oct 6, 2026
fda1854
Merge pull request #8: Fix numeric and tokenizer edges and atomic dow…
yash27-lab Oct 6, 2026
2591150
docs: add network-free downloader test command
yash27-lab Jul 13, 2026
1e3f892
Merge pull request #9: Document downloader regression tests
yash27-lab Oct 6, 2026
6739033
docs: add a dedicated GPT-2 generation quickstart
yash27-lab May 6, 2026
e06ab13
docs: explain matching downloader and generator asset paths
yash27-lab May 6, 2026
631e92e
docs: document asset-free CLI help and argument exit codes
yash27-lab May 6, 2026
36be934
docs: clarify explicit CPU and Metal generation selection
yash27-lab May 6, 2026
2af6899
docs: explain generation output redirection and pipe behavior
yash27-lab May 6, 2026
ac55a61
docs: describe empty prompt seeding and stop-token accounting
yash27-lab May 6, 2026
3b1979a
docs: document temperature validation and greedy precedence
yash27-lab May 6, 2026
4378d39
docs: explain top-k zero, cutoff ties, and greedy interaction
yash27-lab May 6, 2026
9fbe872
docs: list the inputs needed to reproduce seeded generation
yash27-lab May 6, 2026
119ad6d
docs: explain context truncation and generation asset diagnostics
yash27-lab May 6, 2026
c3101cf
docs: introduce row-major tensor construction and rank checks
yash27-lab May 14, 2026
8b74081
docs: distinguish scalar shapes from empty tensor dimensions
yash27-lab May 14, 2026
3942858
docs: explain fallible zero allocation and its error variants
yash27-lab May 14, 2026
00ed135
docs: clarify structural validation of public tensor fields
yash27-lab May 14, 2026
9f94d39
docs: explain fail-safe tensor parity comparisons
yash27-lab May 14, 2026
8367546
docs: correct tensor-view cast semantics and explain F32 copying
yash27-lab May 14, 2026
306c03a
docs: add an async MLP request submission guide
yash27-lab May 14, 2026
1deff67
docs: clarify engine backpressure and synchronous compute
yash27-lab May 14, 2026
d1fbbed
docs: document engine cancellation and closed-channel results
yash27-lab May 14, 2026
761d390
docs: link generation, tensor, and engine references from entry points
yash27-lab May 14, 2026
091f251
Merge pull request #10: Add generation and library usage guides
yash27-lab Oct 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Report an incorrect result, crash, or unexpected runtime behavior
title: "[Bug]: "
labels: bug
---

## What happened?

Describe the observed behavior.

## Reproduction

Provide the smallest command or code sample that reproduces the issue.

## Environment

- OS and hardware:
- Rust version (`rustc --version`):
- Backend (`cpu` or `metal`):
- Does the issue reproduce with the CPU backend?

## Expected behavior

Describe the expected result.

## Relevant logs

Include the smallest relevant error output, backtrace, or parity diff.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Feature request
about: Propose an improvement to batch_forge
title: "[Feature]: "
labels: enhancement
---

## Problem

What limitation or workflow does this improve?

## Proposed change

Describe the behavior or API you would like.

## Alternatives considered

Describe any workarounds or alternative approaches.

## Success criteria

What outcome would make this feature complete?

## Compatibility or performance impact

Note any expected platform, API, memory, or throughput tradeoffs.
24 changes: 24 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Summary

Describe the change and why it is needed.

## Risks

Note any compatibility, performance, or behavior risks.

## Documentation

- [ ] Public API docs and user-facing guides updated when applicable

## Tests

- [ ] Relevant tests added or updated when behavior changes

## Validation

- [ ] `cargo fmt --check`
- [ ] `cargo check`
- [ ] `cargo clippy --all-targets`
- [ ] `cargo test --lib`
- [ ] Metal parity check run when applicable (`cargo test --test parity -- --nocapture`)
- [ ] End-to-end GPT-2 check run when applicable (`cargo test --test gpt2_e2e -- --nocapture`)
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
push:
branches: [main]
pull_request:

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings

jobs:
# Portable path: the CPU reference, loader, model, and async engine build and
# test on Linux (the Metal backend is cfg'd out on non-macOS targets).
lint-and-test:
name: fmt + clippy + test (ubuntu)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: asset downloader tests (no network)
run: python3 -m unittest discover -s python -p 'test_*.py'
- name: rustfmt
run: cargo fmt --all -- --check
- name: clippy
run: cargo clippy --all-targets
- name: test (CPU and CLI)
run: cargo test --lib --bins
- name: CLI smoke tests without model assets
run: |
cargo run --quiet --bin generate -- --help
cargo run --quiet --bin generate -- --version
if cargo run --quiet --bin generate -- --temperature NaN; then exit 1; fi
if cargo run --quiet --bin batch_forge -- --model /missing/checkpoint.safetensors; then exit 1; fi

# Apple Silicon: full build incl. Metal kernels + CPU unit tests. The on-device
# CPU↔Metal parity suite (`cargo test --test parity`) needs a Metal device and
# is run locally; see docs/correctness.md.
macos-build:
Comment on lines +16 to +42
name: build + test (macos)
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: clippy (incl. Metal backend)
run: cargo clippy --all-targets
- name: build
run: cargo build --release --all-targets
- name: test (CPU unit tests)
run: cargo test --lib --bins
Comment on lines +43 to +56
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Rust
/target
Cargo.lock

# Python
venv/
__pycache__/
*.pyc

# ML Weights & Data
# ML Weights & Data (don't commit large binaries; generate them locally)
*.safetensors
*.bin
*.pt
*.ckpt

# MacOS
.DS_Store
models/
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Contributing

Small, focused changes are easiest to review. Before opening a pull request, run the checks that match the code you changed:

```bash
cargo fmt --check
cargo check
cargo clippy --all-targets
cargo test --lib
```

If the formatting check reports changes, run `cargo fmt`, review the diff, then run the check again.

The formatting, compile, lint, and library-test preflight is CPU-only and needs no model assets. Metal parity checks require Apple Silicon macOS, and the end-to-end GPT-2 check requires the downloaded model assets. See the [test command reference](docs/test-matrix.md) for the complete matrix and [troubleshooting guide](docs/troubleshooting.md) for setup notes.

## Reporting issues

Use the issue templates when reporting a bug or proposing an enhancement; their `bug` and `enhancement` labels help keep reports organized. For runtime bugs, include the backend, hardware, and smallest reproduction command.
Loading
Loading