{"id":48794133,"url":"https://github.com/gitctrlx/llama.rs","last_synced_at":"2026-04-13T21:33:27.734Z","repository":{"id":315588949,"uuid":"1031763090","full_name":"gitctrlx/llama.rs","owner":"gitctrlx","description":"Llama from scratch in Rust.","archived":false,"fork":false,"pushed_at":"2026-01-22T02:52:33.000Z","size":54793,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-22T16:20:42.815Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitctrlx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-04T09:44:17.000Z","updated_at":"2026-01-22T02:52:31.000Z","dependencies_parsed_at":"2025-09-19T13:56:45.858Z","dependency_job_id":"513f1d81-dfee-4d51-9a02-8350b507c440","html_url":"https://github.com/gitctrlx/llama.rs","commit_stats":null,"previous_names":["gocnn/llama.rs","gitctrlx/llama.rs"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/gitctrlx/llama.rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitctrlx%2Fllama.rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitctrlx%2Fllama.rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitctrlx%2Fllama.rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitctrlx%2Fllama.rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitctrlx","download_url":"https://codeload.github.com/gitctrlx/llama.rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitctrlx%2Fllama.rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31771890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T20:17:16.280Z","status":"ssl_error","status_checked_at":"2026-04-13T20:17:08.216Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-13T21:33:20.784Z","updated_at":"2026-04-13T21:33:27.726Z","avatar_url":"https://github.com/gitctrlx.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# llama.rs\n\nA pure Rust implementation of the LLaMA model for inference and educational purposes. Supports LLaMA 1, 2, and 3 architectures.\n\nThis repository demonstrates how to run LLaMA inference with minimal dependencies, making it ideal for learning and understanding transformer internals.\n\n## Features\n\n- **HF-aligned Architecture** – Matches **`HuggingFace`** reference implementation with clean, structured codebase matching official model layouts\n- **Parallel MHA** – Multi-head attention parallelized with **Rayon** for 2-4x speedup on multi-core systems\n- **Minimal Dependencies** – Only uses `byteorder`, `rayon`, `rand`, and `thiserror`\n- **Educational** – Line-by-line readable transformer implementation with inline documentation\n- **Type-safe** – Leverages Rust's type system for memory safety without garbage collection overhead\n\n## Usage\n\n```sh\ncargo run --release -- \u003ccheckpoint\u003e \u003ctokenizer\u003e [prompt] [options]\n```\n\n### Options\n\n| Flag | Description | Default |\n| ------ | ----------- | --------- |\n| `--temp \u003cfloat\u003e` | Sampling temperature (0 = greedy) | 1.0 |\n| `--topp \u003cfloat\u003e` | Top-p (nucleus) sampling | 0.9 |\n| `--steps \u003cint\u003e` | Max tokens to generate | 256 |\n| `--seed \u003cint\u003e` | Random seed | 0 |\n\n### Example\n\n```sh\ncargo run --release -- stories15M.bin tokenizer.bin \"Once upon a time\" --temp 0.8 --steps 128\n```\n\nThe examples use small models trained by [`Andrej Karpathy`](https://github.com/karpathy/llama2.c?tab=readme-ov-file#models) for demonstration.\n\n## Related Work\n\nIf you're interested in LLaMA implementations in other languages:\n\n- **[llama.go](https://github.com/gitctrlx/llama.go)** – Pure Go implementation\n- **[llama.np](https://github.com/gitctrlx/llama.np)** – NumPy-based implementation\n- **[llama.cu](https://github.com/gitctrlx/llama.cu)** – CUDA-accelerated implementation\n\n## License\n\nThis project is licensed under either of the following licenses, at your option:\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0))\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT))\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in `llama.rs` by you, as defined in the Apache-2.0 license, shall be dually licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitctrlx%2Fllama.rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitctrlx%2Fllama.rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitctrlx%2Fllama.rs/lists"}