Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
65 changes: 65 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: "🐛 Bug Report"
description: "Report a bug, numerical error, or bit-packing discrepancy in quantbench-engine"
title: "[Bug]: "
labels: ["bug", "triage"]
body:
- type: markdown
attributes:
value: |
Thank you for reporting an issue in `quantbench-engine`! Please ensure you are running the latest version.

- type: textarea
id: description
attributes:
label: Description of the Bug
description: What went wrong during quantization, packing, or model conversion?
placeholder: "When quantizing a linear layer with INT4 and group_size=32..."
validations:
required: true

- type: textarea
id: reproduction
attributes:
label: Minimal Steps to Reproduce
description: Exact CLI command or minimal Python code snippet reproducing the numerical or execution issue.
placeholder: |
import torch
from quantbench.quant.packing import pack_int4, unpack_int4
# ...
validations:
required: true

- type: textarea
id: traceback
attributes:
label: Error Traceback / Logs
description: Paste the console traceback inside a code block.
render: shell
validations:
required: false

- type: textarea
id: environment
attributes:
label: Environment Diagnostics
description: Details about your environment.
placeholder: |
- OS: Windows 11 / Ubuntu 22.04 / macOS
- Python Version: (e.g. 3.12.10)
- PyTorch Version: (e.g. 2.5.1)
- Device: (CUDA / CPU / MPS)
- quantbench-engine Version: (e.g. 0.1.2)
validations:
required: true

- type: checkboxes
id: confirmation
attributes:
label: Validation Checklist
options:
- label: I have verified this bug occurs on the latest `main` branch or PyPI release.
required: true
- label: I have checked open/closed issues to avoid duplicates.
required: true
- label: I am willing to submit a Pull Request to fix this.
required: false
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: 📖 Quantbench Documentation & Educational Guides
url: https://github.com/Prajwal7-2002/quantbench#readme
about: Read our comprehensive guides on sub-byte quantization and hardware sparsity.
- name: 🔒 Report a Security Vulnerability
url: https://github.com/Prajwal7-2002/quantbench/security/advisories/new
about: Privately disclose sensitive security vulnerabilities to maintainers.
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "✨ Feature Request / Quantization Scheme Proposal"
description: "Suggest a new sub-byte quantization scheme, calibration algorithm, or hardware backend"
title: "[Feature]: "
labels: ["enhancement", "proposal"]
body:
- type: markdown
attributes:
value: |
Thank you for proposing a feature for `quantbench-engine`! We welcome proposals for sub-byte quantization algorithms, calibration methods, and packing runtimes.

- type: textarea
id: problem
attributes:
label: Motivation / Use Case
description: What quantization scheme, calibration method, or compression format does this address?
placeholder: "We want to support FP4 (NV-FP4 microscaling) with E2M1 representation..."
validations:
required: true

- type: textarea
id: proposal
attributes:
label: Proposed Implementation & Bit-Packing Layout
description: Describe the mathematical formulation, bit-layout, and vectorized PyTorch implementation.
placeholder: |
Implement `pack_fp4` using 2 weights per byte with a per-block 8-bit scale factor...
validations:
required: true

- type: textarea
id: vectorization
attributes:
label: Vectorization & Performance Verification
description: Confirm this can be implemented with pure PyTorch tensor operations without Python loops.
validations:
required: true

- type: checkboxes
id: willingness
attributes:
label: Contribution Readiness
options:
- label: I am willing to implement this feature and submit a PR.
required: false
28 changes: 28 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Description
<!-- Briefly describe what this PR does, why it is needed, and link any related issues. -->

Fixes #(issue)

## Type of Change
<!-- Please check all options that apply -->
- [ ] 🐛 Bug fix (non-breaking change fixing an issue)
- [ ] ✨ New feature (new quantization scheme, calibration algorithm, or packing format)
- [ ] ⚡ Performance optimization (vectorization speedup or memory compression)
- [ ] 📚 Documentation update (guides, docstrings, README)
- [ ] 🧪 Tests (coverage expansion or mathematical invariant verification)
- [ ] 💥 Breaking change (fix or feature that breaks existing `QuantLinear` or packing contracts)

## Quantization & Bit-Packing Invariants
<!-- If this PR introduces or modifies a bit-packing format, packing/unpacking roundtrip tests are mandatory. -->
* **Precision Scheme**: (e.g. INT4 / INT8 / BitNet Ternary / FP8 / Ampere 2:4)
* **Packing Ratio**: `____ bits/weight` | `____ x compression vs FP16`
* **SQNR / Perplexity Impact**: `____ dB SQNR` | `____ perplexity on WikiText-2`

## Architectural Invariants Checklist
<!-- You MUST verify and check every item below before submitting -->
- [ ] **Exact Scalar & Tensor Roundtripping**: Packing and unpacking functions tested for bit-exact reconstruction within precision limits.
- [ ] **Pure PyTorch Vectorization**: Implemented with vectorized bitwise shifts/masks (`torch.bitwise_left_shift`, `torch.bitwise_right_shift`). Zero scalar loops over tensor elements.
- [ ] **Unit Tests & Coverage**: Ran `uv run python -m pytest` (100% pass rate, maintained >= 90% coverage).
- [ ] **Formatting & Linting**: Ran `uv run ruff check .` and `uv run ruff format --check .` with zero errors.
- [ ] **Documentation**: Updated `README.md` or docstrings if modifying CLI subcommands or quantization arguments.
- [ ] **Clean Commits**: Follows conventional commit format (`feat:`, `fix:`, `perf:`, `docs:`, `test:`).
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ jobs:
- name: Run linter
run: uv run ruff check .

- name: Run format check
run: uv run ruff format --check .

- name: Run test suite with coverage
run: uv run pytest
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-added-large-files
args: ["--maxkb=2000"]
- id: check-merge-conflict

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.3
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
43 changes: 43 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community maintainer at `prajwalpujari16@gmail.com`. All complaints will be reviewed and investigated promptly and fairly.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
31 changes: 31 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Security Policy 🔒

## Supported Versions

| Version | Supported |
| :--- | :--- |
| `0.1.x` | :white_check_mark: |

---

## Safe Tensor Guidelines

1. **Pure Tensor Math**: `quantbench-engine` performs purely arithmetic bit-packing and matrix operations. It requires zero network connectivity.
2. **Safe Serialization**: Saved quantized checkpoints strictly serialize standard integer and float tensor dictionaries (`state_dict`). Untrusted pickle formats should never be loaded.

---

## Reporting a Vulnerability

If you discover a security vulnerability or numerical flaw that impacts host security:

* **Please DO NOT file a public issue.**
* Report the issue privately through [GitHub's Private Vulnerability Reporting](https://github.com/Prajwal7-2002/quantbench/security/advisories/new) or email maintainer Prajwal Pujari at `prajwalpujari16@gmail.com`.

### Submission Checklist
Please include:
1. Clear description of the vulnerability.
2. Minimal reproduction script.
3. Potential security impact.

You will receive an acknowledgment within 48 hours, followed by updates on the fix and coordinated disclosure.
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading