{"id":14958846,"url":"https://github.com/igitugraz/h-mem","last_synced_at":"2025-07-27T03:06:08.921Z","repository":{"id":113036855,"uuid":"276648520","full_name":"IGITUGraz/H-Mem","owner":"IGITUGraz","description":"Code for Limbacher, T. and Legenstein, R. (2020). H-Mem: Harnessing synaptic plasticity with Hebbian Memory Networks","archived":false,"fork":false,"pushed_at":"2022-06-02T16:39:42.000Z","size":47,"stargazers_count":13,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-28T05:56:12.920Z","etag":null,"topics":["hebbian-learning","memory-networks","neural-networks","python","recurrent-neural-networks","tensorflow-experiments"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IGITUGraz.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":"2020-07-02T13:06:20.000Z","updated_at":"2024-06-04T07:08:52.000Z","dependencies_parsed_at":"2023-06-06T19:47:32.714Z","dependency_job_id":null,"html_url":"https://github.com/IGITUGraz/H-Mem","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/IGITUGraz/H-Mem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGITUGraz%2FH-Mem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGITUGraz%2FH-Mem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGITUGraz%2FH-Mem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGITUGraz%2FH-Mem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IGITUGraz","download_url":"https://codeload.github.com/IGITUGraz/H-Mem/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IGITUGraz%2FH-Mem/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267293762,"owners_count":24065321,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["hebbian-learning","memory-networks","neural-networks","python","recurrent-neural-networks","tensorflow-experiments"],"created_at":"2024-09-24T13:18:23.556Z","updated_at":"2025-07-27T03:06:08.896Z","avatar_url":"https://github.com/IGITUGraz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/h-mem-harnessing-synaptic-plasticity-with/question-answering-on-babi)](https://paperswithcode.com/sota/question-answering-on-babi?p=h-mem-harnessing-synaptic-plasticity-with)\n\n# H-Mem: Harnessing synaptic plasticity with Hebbian Memory Networks\nThis is the code used in the paper \"[H-Mem: Harnessing synaptic plasticity with Hebbian Memory\nNetworks](https://www.biorxiv.org/content/10.1101/2020.07.01.180372v2)\" for training H-Mem on a single-shot\nimage association task and on the bAbI question-answering tasks.\n\n![H-Mem schema](https://i.imgur.com/fK3UWaP.png)\n\n## Setup\nYou need [TensorFlow](https://www.tensorflow.org/) to run this code. We tested it on TensorFlow version 2.1.\nAdditional dependencies are listed in [environment.yml](environment.yml). If you use\n[Conda](https://docs.conda.io/en/latest/), run\n\n```bash\nconda env create --file=environment.yml\n```\n\nto install the required packages and their dependencies.\n\n## Usage\n\n### Single-shot associations with H-Mem\nTo start training on the single-shot image association task, run\n\n```bash\npython image_association_task.py\n```\n\nSet the command line argument `--delay` to set the between-image delay (in the paper we used delays ranging from 0 to 40). Run the following command\n\n```bash\npython image_association_task_lstm.py\n```\n\nto start training the LSTM model on this task (the default value for the between-image delay is 0; you can change it with the command line argument `--delay`).\n\n### Question answering with H-Mem\nRun the following command\n\n```bash\npython babi_task_single.py\n```\n\nto start training on bAbI task 1 in the 10k training examples setting. Set the command line argument `--task_id` to train on other tasks. You can try different model configurations by changing various command line arguments. For example,\n\n```bash\npython babi_task_single.py --task_id=4 --memory_size=20 --epochs=50 --logging=1\n```\n\nwill train the model with an associative memory of size 20 on task 4 for 50 epochs. The results will be stored in `results/`.\n\n### Memory-dependent memorization\nIn our extended model we have added an 'read-before-write' step. This model will be used if the\ncommand line argument `--read_before_write` is set to `1`. Run the following command\n\n```bash\npython babi_task_single.py --task_id=16 --epochs=250 --read_before_write=1\n```\n\nto start training on bAbI task 16 in the 10k training examples setting (note that we trained the extended\nmodel for 250 epochs---instead of 100 epochs). You should get an accuracy of about 100% on this task. Compare\nto the original model, which does not solve task 16, by running the following command\n\n```bash\npython babi_task_single.py --task_id=16 --epochs=250\n```\n\n## References\n* Limbacher, T., \u0026 Legenstein, R. (2020). H-Mem: Harnessing synaptic plasticity with Hebbian Memory Networks. Advances in Neural Information Processing Systems, 33.\nhttps://www.biorxiv.org/content/10.1101/2020.07.01.180372v2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figitugraz%2Fh-mem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figitugraz%2Fh-mem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figitugraz%2Fh-mem/lists"}