{"id":13409836,"url":"https://github.com/franalgaba/neural-network-cairo","last_synced_at":"2025-04-08T04:54:42.158Z","repository":{"id":130776315,"uuid":"609580044","full_name":"franalgaba/neural-network-cairo","owner":"franalgaba","description":"Neural Network implementation from scratch for MNIST using Cairo 1.0","archived":false,"fork":false,"pushed_at":"2023-04-01T15:55:53.000Z","size":9210,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-30T20:34:35.353Z","etag":null,"topics":["cairo-lang","machine-learning","starknet"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/franalgaba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-03-04T15:56:56.000Z","updated_at":"2024-01-10T21:07:45.000Z","dependencies_parsed_at":"2024-01-21T20:13:56.342Z","dependency_job_id":null,"html_url":"https://github.com/franalgaba/neural-network-cairo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"auditless/cairo-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franalgaba%2Fneural-network-cairo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franalgaba%2Fneural-network-cairo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franalgaba%2Fneural-network-cairo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franalgaba%2Fneural-network-cairo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/franalgaba","download_url":"https://codeload.github.com/franalgaba/neural-network-cairo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247779738,"owners_count":20994572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cairo-lang","machine-learning","starknet"],"created_at":"2024-07-30T20:01:03.633Z","updated_at":"2025-04-08T04:54:42.136Z","avatar_url":"https://github.com/franalgaba.png","language":"Rust","funding_links":[],"categories":["Additional developer resources","Libraries","Machine Learning"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/auditless/cairo-template/actions/workflows/test.yaml\"\u003e\n    \u003cimg src=\"https://github.com/auditless/cairo-template/actions/workflows/test.yaml/badge.svg?event=push\" alt=\"CI Badge\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# Neural Network for MNIST in Cairo 1.0\n\nImplementation of a Neural Network from scratch using Cairo 1.0 for MNIST predictions.\n\nThe NN has a simple two-layer architecture: \n  - Input layer 𝑎[0] will have 784 units corresponding to the 784 pixels in each 28x28 input image. \n  - A hidden layer 𝑎[1] will have 10 units with ReLU activation.\n  - Output layer 𝑎[2] will have 10 units corresponding to the ten digit classes with softmax activation.\n\nFunctionalities implemented in Cairo 1.0:\n - [X] Vector implementation with operations: sum, max, min, argmax.\n - [X] Matrix implementation with operations: get, dot, add, len.\n - [X] Tensor implementation.\n - [X] 8-bit weight quantization based in [ONNX quantization](https://onnxruntime.ai/docs/performance/quantization.html#quantization-overview).\n - [X] ReLU activation.\n - [X] Forward propagation of NN.\n - [X] Predict method for NN.\n - [X] [Pseudo-softmax activation](https://www.nature.com/articles/s41598-021-94691-7) optimized for quantized values.\n - [X] Weight loading into Cairo NN from trained Tensorflow NN.\n - [X] MNIST inferences using Cairo NN.\n\n[Built with **`auditless/cairo-template`**](https://github.com/auditless/cairo-template)\n\n## Working with the project\n\nCurrently supports building and testing contracts.\n\n### Build\n\nBuild the contracts.\n\n```bash\n$ make build\n```\n\n### Test\n\nRun the tests in `src/test`:\n\n```bash\n$ make test\n```\n\n### Format\n\nFormat the Cairo source code (using Scarb):\n\n```bash\n$ make fmt\n```\n\n### Credits\n\n- [cairo-ml](https://github.com/raphaelDkhn/cairo_ml) by [Raphael Doukhan](https://twitter.com/raphael_dkhn).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranalgaba%2Fneural-network-cairo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranalgaba%2Fneural-network-cairo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranalgaba%2Fneural-network-cairo/lists"}