{"id":35061352,"url":"https://github.com/lgalke/easy2deeplearn","last_synced_at":"2026-04-27T14:02:41.760Z","repository":{"id":194551872,"uuid":"623867053","full_name":"lgalke/easy2deeplearn","owner":"lgalke","description":"Code for the paper \"Deep neural networks and humans both benefit from compositional structure\"","archived":false,"fork":false,"pushed_at":"2025-01-11T19:28:21.000Z","size":289,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-29T00:45:01.371Z","etag":null,"topics":["compositionality","language-acquisition","language-learning","large-language-models","machine-learning","natural-language-processing","small-language-models"],"latest_commit_sha":null,"homepage":"https://rdcu.be/d5f2e","language":"Python","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/lgalke.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":"2023-04-05T08:59:41.000Z","updated_at":"2025-04-21T11:11:14.000Z","dependencies_parsed_at":"2023-09-14T03:28:24.585Z","dependency_job_id":"6bf2e12c-68de-41e5-83cf-81d1c4ca3178","html_url":"https://github.com/lgalke/easy2deeplearn","commit_stats":null,"previous_names":["lgalke/easy2deeplearn"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/lgalke/easy2deeplearn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lgalke%2Feasy2deeplearn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lgalke%2Feasy2deeplearn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lgalke%2Feasy2deeplearn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lgalke%2Feasy2deeplearn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lgalke","download_url":"https://codeload.github.com/lgalke/easy2deeplearn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lgalke%2Feasy2deeplearn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32339290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"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":["compositionality","language-acquisition","language-learning","large-language-models","machine-learning","natural-language-processing","small-language-models"],"created_at":"2025-12-27T10:40:48.650Z","updated_at":"2026-04-27T14:02:41.699Z","avatar_url":"https://github.com/lgalke.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deep neural networks and humans both benefit from compositional language structure\n\nThis repository holds the code for the paper:\n\nGalke, L., Ram, Y. \u0026 Raviv, L. Deep neural networks and humans both benefit from compositional language structure. Nat Commun 15, 10816 (2024). https://doi.org/10.1038/s41467-024-55158-1\n\n```bibtex\n@article{galkeDeepNeuralNetworks2024,\n  title = {Deep Neural Networks and Humans Both Benefit from Compositional Language Structure},\n  author = {Galke, Lukas and Ram, Yoav and Raviv, Limor},\n  year = {2024},\n  journal = {Nature Communications},\n  volume = {15},\n  number = {1},\n  pages = {10816},\n  issn = {2041-1723},\n  doi = {10.1038/s41467-024-55158-1}\n}\n```\n\n\n## Set up\n\n1. Set up a virtual environment (e.g., via conda) with a recent python version (we used Python 3.9.5)\n1. Within the virtual environment, [install PyTorch](https://pytorch.org/get-started/locally/) according to your OS, GPU availability, and Python package manager.\n2. Within the virtual environment, install all other requirements via `pip install -r requirements.txt` \n\n## Fetch data from experiments with human participants\n\nThe data can be obtained via [OSF](https://osf.io/d5ty7/) and should be placed in the `./data` subfolder.\nIn particular, you need all `LearningExp_*_log.txt` files and the `input_languages.csv` file.\n\n## Main entry point\n\nThe main entry point is `train.py`.\nInformation on command line arguments can be obtained via `python3 train.py -h`.\n\nAn exemplary command to run an experiment is\n\n```bash\n    python3 train.py --as_humans /data/path/to/experiment.log --seed 1234 --outdir \"results-v1\"\n```\n\n## Scripts to reproduce experiments\n\nUse the following command to reproduce the main experiments from the paper, sweeping over all experiment log files ten times with different random seeds.\n\n```bash\n    bash sweep_as_humans.bash\n```\n\nResults will be stored in a subfolder `results-v1`.\n\n## Experiments with GPT-3\n\nThe main file for running our experiments with GPT-3 is `lang2prompt.py`. It expects `data` directory to be present and filled and will write its outputs to `gpt3-completions`.\nYou need to specify a language id (S1,B1,S2,...,S5,B5) as a command line argument.\n\nAn example call to run the memorization test and the generalization test on language B4 would be:\n\n```bash\n    python3 lang2prompt.py B4 --gpt3-mem-test --gpt3-reg-test\n```\n\n**Important**: You need to make sure that the shell environment variable `OPENAI_API_KEY` holds your API key and edit the line starting with `openai.organization` with your corresponding organization id.\n\n\n```bash\n    python3 lang2prompt.py B4 --gpt3-mem-test --gpt3-reg-test\n```\n\n\n# Run statistics\n\nUse the following command to reproduce the statistical analysis.\n\n```\n    python3 stats.py -o stats-output results-v1\n```\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flgalke%2Feasy2deeplearn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flgalke%2Feasy2deeplearn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flgalke%2Feasy2deeplearn/lists"}