{"id":26289507,"url":"https://github.com/thevilledev/zig-nn","last_synced_at":"2025-03-14T23:14:17.102Z","repository":{"id":282298839,"uuid":"948128724","full_name":"thevilledev/zig-nn","owner":"thevilledev","description":"A lightweight neural network library implemented in Zig","archived":false,"fork":false,"pushed_at":"2025-03-13T20:15:11.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T20:37:04.556Z","etag":null,"topics":["learning","neural-networks","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/thevilledev.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-13T19:51:10.000Z","updated_at":"2025-03-13T20:15:15.000Z","dependencies_parsed_at":"2025-03-13T20:47:19.147Z","dependency_job_id":null,"html_url":"https://github.com/thevilledev/zig-nn","commit_stats":null,"previous_names":["thevilledev/zig-nn"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevilledev%2Fzig-nn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevilledev%2Fzig-nn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevilledev%2Fzig-nn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevilledev%2Fzig-nn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thevilledev","download_url":"https://codeload.github.com/thevilledev/zig-nn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243658270,"owners_count":20326467,"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":["learning","neural-networks","zig"],"created_at":"2025-03-14T23:14:16.538Z","updated_at":"2025-03-14T23:14:17.096Z","avatar_url":"https://github.com/thevilledev.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Neural Network in Zig\n\n[![Work in Progress](https://img.shields.io/badge/Status-Work%20in%20Progress-yellow)](https://github.com/thevilledev/zig-nn)\n\nA minimalistic neural network implementation in Zig for learning purposes. This project focuses on understanding the fundamentals of neural networks including hidden layers, activation functions, and basic training processes.\n\n## Features\n\n- Matrix operations from scratch\n- Common activation functions (Sigmoid, ReLU, Tanh)\n- Advanced activation functions (Swish, GLU, SwiGLU)\n- Basic feed-forward neural network architecture\n- Support for gated architectures used in modern transformer models\n\n## Testing\n\nThe project includes a comprehensive test suite to verify the functionality of all components. The build system is configured to run tests for each module separately, making it easy to identify which component has issues.\n\n### Running Tests\n\n```bash\n# Run all tests\nzig build test\n\n# Run tests for specific components\nzig build test-matrix     # Run matrix operation tests\nzig build test-activation # Run activation function tests\nzig build test-layer      # Run neural network layer tests\nzig build test-network    # Run full network tests\n```\n\n## Advanced Activation Functions\n\nThis library implements several advanced activation functions used in modern neural networks:\n\n### Swish\n\nSwish is an activation function introduced by Google Brain that often outperforms ReLU:\n\n```\nswish(x) = x * sigmoid(β * x)\n```\n\nWhere β is typically set to 1.0.\n\n### GLU (Gated Linear Unit)\n\nGLU was introduced in \"Language Modeling with Gated Convolutional Networks\" and is used in many transformer architectures:\n\n```\nGLU(x, W, V, b, c) = (x·W + b) ⊗ σ(x·V + c)\n```\n\nWhere ⊗ is element-wise multiplication and σ is the sigmoid function.\n\n### SwiGLU (Swish Gated Linear Unit)\n\nSwiGLU is a variant of GLU that uses the Swish activation function instead of sigmoid:\n\n```\nSwiGLU(x, W, V, b, c) = (x·W + b) ⊗ swish(x·V + c)\n```\n\nThese gated activation functions are particularly useful in transformer architectures and have been shown to improve performance in many natural language processing tasks.\n\n## Learning Goals\n\nThis project serves as a learning exercise for:\n\n- Understanding neural network fundamentals\n- Implementing mathematical operations in Zig\n- Working with Zig's memory management and error handling\n\n## License\n\nMIT License \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthevilledev%2Fzig-nn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthevilledev%2Fzig-nn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthevilledev%2Fzig-nn/lists"}