Git Product home page Git Product logo

mschrimpf / neural-nlp Goto Github PK

View Code? Open in Web Editor NEW
47.0 7.0 16.0 780.19 MB

[PNAS'21] The neural architecture of language: Integrative modeling converges on predictive processing

Home Page: https://doi.org/10.1073/pnas.2105646118

Python 20.32% Jupyter Notebook 77.44% Shell 0.29% M 0.05% MATLAB 1.90%
deep-learning natural-language-processing computational-neuroscience human-language neural-recording fmri ecog

neural-nlp's Introduction

The neural architecture of language: Integrative modeling converges on predictive processing

Code accompanying the paper The neural architecture of language: Integrative modeling converges on predictive processing by Schrimpf, Blank, Tuckute, Kauf, Hosseini, Kanwisher, Tenenbaum, and Fedorenko.

Overview of Results

Large-scale evaluation of neural network language models as predictive models of human language processing. This pipeline compares dozens of state-of-the-art models and 4 human datasets (3 neural, 1 behavioral). It builds on the Brain-Score framework and can easily be extended with new models and datasets.

Please see the community platform Brain-Score Language for many accessible neural and behavioral benchmarks and computational models, including those from this paper.

Installation

git clone https://github.com/mschrimpf/neural-nlp.git
cd neural-nlp
pip install -e .

You might have to install nltk by hand / with conda.

Run

To score gpt2-xl on the Blank2014fROI-encoding benchmark:

python neural_nlp run --model gpt2-xl --benchmark Blank2014fROI-encoding --log_level DEBUG

Other available benchmarks are e.g. Pereira2018-encoding (takes a while to compute), and Fedorenko2016v3-encoding.

You can also specify different models to run -- note that some of them require additional download of weights (run ressources/setup.sh for automated download).

Data

When running a model on a benchmark, the data will automatically be downloaded from S3 (e.g. https://github.com/mschrimpf/neural-nlp/blob/master/neural_nlp/benchmarks/neural.py#L361 for the Pereira2018 benchmark). Costly ceiling estimates have also been precomputed and will be downloaded since they can take days to compute.

Precomputed scores

Scores for models run on the neural, behavioral, and computational-task benchmarks are also available, see the precomputed-scores.csv file. You can re-create the figures in the paper using the analyze scripts.

Benchmark contextualization

In Schrimpf et al. (2021), each sentence was contextualized with respect to the full set of sentences in the same topic (assuming a fixed order of paragraphs within a topic). We later noticed that this was not how the materials were presented to the participants in Pereira et al. (2018) where sentences were presented in the contexts of paragraphs but paragraphs were randomly ordered for each participant. Below, we show that this error does not affect the results as reported in Schrimpf et al. (2021). In particular, the predictivity values are very closely correlated for these two ways of contextualization. pnas21-vs-23

Citation

If you use this work, please cite

@article{Schrimpf2021,
	author = {Schrimpf, Martin and Blank, Idan and Tuckute, Greta and Kauf, Carina and Hosseini, Eghbal A. and Kanwisher, Nancy and Tenenbaum, Joshua and Fedorenko, Evelina},
	title = {The neural architecture of language: Integrative modeling converges on predictive processing},
	year = {2021},
	journal = {Proceedings of the National Academy of Sciences},
	url = {https://www.pnas.org/content/118/45/e2105646118}
}

neural-nlp's People

Contributors

carina-kauf avatar gretatuckute avatar johntauber avatar mingye-christina-wang avatar mschrimpf avatar vhellendoorn avatar williamrainer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

neural-nlp's Issues

running base example give xarray issue

I tried running the base example on the main page, but I am getting the following error :

Traceback (most recent call last):
File "/Users/eghbalhosseini/anaconda3/envs/arch/lib/python3.7/site-packages/xarray/core/dataset.py", line 884, in _construct_dataarray
variable = self._variables[name]
KeyError: 'z'

I am using : xarray V:0.12.0

neural data meta CoreNLP parsing issues

Boar: Listening to the tale the Lord of the Manor tried to discern which huntsman was telling him the truth and what the two huntsmen were thinking as they waited for him to make a -- a. is only parsed together with next sentence.

MatchstickSeller: "Grandmother" cried the little one "O -- same as above.

KingOfBirds: He wanted to shout "I am king!" so that the owl could hear him as he flew but thought better of it. -- split into two sentences.

HighSchool: "Was that another one of those messages?" her mom asked who was driving the car. -- parsed into two sentences.

"Haven't you reported it yet?" asked Jill Lucy's older sister who was sitting in the passenger seat. -- as above

"No it's fine. I love it" said Lucy knowing that affording the phone had been no small thing for her mother. -- as above

"How does it feel to be tall and lanky like a giraffe?" ... -- as above

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.