The Language and Cognition of Keystrokes
When you sat down at your computer this morning, what was the first thing you did? Before you checked your email, caught up on reddit, and retweeted a few tweets, you most likely entered a password. But let’s say Henry The Hacker cracked your password, or guessed that it’s your wife’s birthday combined with your daughter’s first name. Then they could spend all day sending emails from email@example.com, tweeting from @yourname and accessing files that only you should have access to.
As a more robust security measure, what if your computer was constantly asking “Is this really you?” throughout the day? We work on ways to answer this question by analyzing keystroke dynamics — the speed and rhythm of typing patterns — to predict demographic and cognitive attributes of a typist. If your computer knows, in general, how you type, then it can detect an intruder not just through a static password, but through constant and dynamic authentication.
In a paper we recently published in the International Journal of Human-Computer Studies, we use novel features based on keystroke dynamics, linguistics and stylometry to predict the cognitive demands a typist was under when producing some text, as well as the typist’s gender, native language and handedness. These findings allow us to use typing behavior as a “soft biometric,” which can alert a system if an intruder who does not share the expected typist’s demographics takes over on his keyboard. It also means we can build a system to determine whether the typist is producing something she’s remembered or something she’s making up.
To collect our data, we had hundreds of students sit at a computer that logged their keystrokes with high precision (every 15 milliseconds) and answer questions of varying cognitive complexity. Some questions were easy, asking for rote recall, such as:
List the recent movies you have seen or books you have read. When did you see or read them? What were they about?
Other questions required more complex analysis and evaluation, more like:
Do you think it is a good idea to raise tuition for students in order to have money to make improvements to the University? Why or why not?
We used Bloom’s Taxonomy of Learning to label the cognitive demands of each question. However, even though Bloom’s Taxonomy is intended to have a hierarchical relationship, we made no such assumption and saw no evidence of a strict linear ordering. Rather, we viewed each level as generally, but not necessarily, harder.
To augment previous studies involving keystroke dynamics, we added linguistic and stylometric context to our typing features. For example, rather than simply looking at how quickly a typist produced the digraph T_H, we took into account whether T_H was produced within a noun or a verb, or within a correctly or incorrectly spelled word. We found that word types and linguistic context can significantly change how keystrokes are produced. Therefore, clumping all T_H digraphs together would obscure what should be considered two or more distinct features.
We were able to predict the cognitive demands of the typist consistently over or at a random baseline. The same sets of features gave us above-baseline predictions for the three demographic categories, as well: gender, handedness and primary language. In fact, we were able to predict all three demographic labels 55% of the time and two of the three 95% of the time.
One important element that sets our experiments apart from previous studies is that our models were trained on a completely distinct set of subjects and set of typing prompts. In all of the experiments, the typists used for training are never used for testing. Therefore we avoid ever learning patterns that are unique to a particular person, but rather test the generalization of these behaviors across the type of cognitive task, or demographic cohort. In addition, the amount of data necessary to train our models was orders of magnitude smaller than similar studies. Both of these factors are critical for real-world implementations of these predictions.
Although we take great satisfaction in our results, we still have a lot of work to do, and plenty of room for improvement. We plan on expanding our feature-set to incorporate revisions, or typos, as these may also have unique linguistic properties. In addition, we plan on using these same features for user authentication, or confirming a specific typist’s identity.
Our findings, though, lend credence to the notion that linguistic patterns can have a noticeable effect on language production. Many previous studies have demonstrated this effect on spoken language or a static piece of writing, but few studies have investigated dynamically-produced, typed text. Our experiments show that we can secure your computer from Henry The Hacker and allow computer-produced texts to be used for many other linguistic and psycholinguistic studies.
Brizan, D. G., Goodkind, A., Koch, P., Balagani, K., Phoha, V. V., & Rosenberg, A. (2015). Utilizing linguistically-enhanced keystroke dynamics to predict typist cognition and demographics. International Journal of Human-Computer Studies. Vol 82, pp. 57–68.