@gpjt
By switching from a hand-rolled GELU to PyTorch's built-in one, I improved my LLM training speed -- and much more than I expected, from 21,000 tokens/second to 25,000! https://t.co/NmNQu53cmW
Viewing enriched Twitter post
By switching from a hand-rolled GELU to PyTorch's built-in one, I improved my LLM training speed -- and much more than I expected, from 21,000 tokens/second to 25,000! https://t.co/NmNQu53cmW
{
"media": [
{
"url": "https://crmoxkoizveukayfjuyo.supabase.co/storage/v1/object/public/media/posts/2090244093850812688/media_0.jpg",
"media_url": "https://crmoxkoizveukayfjuyo.supabase.co/storage/v1/object/public/media/posts/2090244093850812688/media_0.jpg",
"type": "photo",
"filename": "media_0.jpg"
}
],
"processed_at": "2026-08-20T07:02:04.834342",
"pipeline_version": "2.0"
} {
"type": "tweet",
"id": "2090244093850812688",
"url": "https://x.com/gpjt/status/2090244093850812688",
"twitterUrl": "https://twitter.com/gpjt/status/2090244093850812688",
"text": "By switching from a hand-rolled GELU to PyTorch's built-in one, I improved my LLM training speed -- and much more than I expected, from 21,000 tokens/second to 25,000!\n\nhttps://t.co/NmNQu53cmW",
"source": "Twitter for iPhone",
"retweetCount": 0,
"replyCount": 3,
"likeCount": 5,
"quoteCount": 1,
"viewCount": 9352,
"createdAt": "Thu Aug 20 01:06:41 +0000 2026",
"lang": "en",
"bookmarkCount": 2,
"isReply": false,
"inReplyToId": null,
"conversationId": "2090244093850812688",
"displayTextRange": [
0,
192
],
"inReplyToUserId": null,
"inReplyToUsername": null,
"author": {
"type": "user",
"userName": "gpjt",
"url": "https://x.com/gpjt",
"twitterUrl": "https://twitter.com/gpjt",
"id": "6968622",
"name": "Giles Thomas",
"isVerified": false,
"isBlueVerified": true,
"verifiedType": null,
"profilePicture": "https://pbs.twimg.com/profile_images/1981900016881913856/EDBdf4uf_normal.jpg",
"coverPicture": "https://pbs.twimg.com/profile_banners/6968622/1761356761",
"description": "",
"location": "Lisbon, Portugal",
"followers": 1416,
"following": 203,
"status": "",
"canDm": false,
"canMediaTag": true,
"createdAt": "Wed Jun 20 14:57:55 +0000 2007",
"entities": {
"description": {
"urls": []
},
"url": {}
},
"fastFollowersCount": 0,
"favouritesCount": 13715,
"hasCustomTimelines": true,
"isTranslator": false,
"mediaCount": 130,
"statusesCount": 6435,
"withheldInCountries": [],
"affiliatesHighlightedLabel": {},
"possiblySensitive": false,
"pinnedTweetIds": [
"2074916079952920824"
],
"profile_bio": {
"description": "Building LLMs, learning in public / Founded and led @PythonAnywhere / PSF Fellow",
"entities": {
"description": {
"user_mentions": [
{
"id_str": "",
"indices": [
52,
67
],
"name": "",
"screen_name": "PythonAnywhere"
}
]
},
"url": {
"urls": [
{
"display_url": "gilesthomas.com",
"expanded_url": "http://www.gilesthomas.com/",
"indices": [
0,
23
],
"url": "https://t.co/AfkHrtuEKi"
}
]
}
}
},
"isAutomated": false,
"automatedBy": null
},
"extendedEntities": {},
"card": {
"binding_values": [
{
"key": "thumbnail_image",
"value": {
"image_value": {
"height": 144,
"url": "https://pbs.twimg.com/card_img/2089486916567629824/Z0RVJ2DO?format=png&name=144x144_2",
"width": 144
}
}
},
{
"key": "description",
"value": {
"string_value": "Switching from the hand-rolled GELU module I'd been using to PyTorch's built-in one unsurprisingly made training models faster -- but I was surprised to see it was 20% faster."
}
},
{
"key": "domain",
"value": {
"string_value": "www.gilesthomas.com"
}
},
{
"key": "thumbnail_image_large",
"value": {
"image_value": {
"height": 420,
"url": "https://pbs.twimg.com/card_img/2089486916567629824/Z0RVJ2DO?format=png&name=420x420_2",
"width": 420
}
}
},
{
"key": "thumbnail_image_original",
"value": {
"image_value": {
"height": 512,
"url": "https://pbs.twimg.com/card_img/2089486916567629824/Z0RVJ2DO?format=png&name=orig",
"width": 512
}
}
},
{
"key": "site",
"value": {
"scribe_key": "publisher_id",
"user_value": {
"id_str": "6968622",
"path": []
}
}
},
{
"key": "thumbnail_image_small",
"value": {
"image_value": {
"height": 100,
"url": "https://pbs.twimg.com/card_img/2089486916567629824/Z0RVJ2DO?format=png&name=100x100_2",
"width": 100
}
}
},
{
"key": "thumbnail_image_x_large",
"value": {
"image_value": {
"height": 512,
"url": "https://pbs.twimg.com/card_img/2089486916567629824/Z0RVJ2DO?format=png&name=2048x2048_2_exp",
"width": 512
}
}
},
{
"key": "vanity_url",
"value": {
"scribe_key": "vanity_url",
"string_value": "gilesthomas.com"
}
},
{
"key": "thumbnail_image_color",
"value": {
"image_color_value": {
"palette": [
{
"percentage": 36.91,
"rgb": {
"blue": 51,
"green": 47,
"red": 41
}
},
{
"percentage": 26.07,
"rgb": {
"blue": 206,
"green": 222,
"red": 247
}
},
{
"percentage": 1.55,
"rgb": {
"blue": 19,
"green": 33,
"red": 102
}
},
{
"percentage": 0.38,
"rgb": {
"blue": 117,
"green": 122,
"red": 129
}
}
]
}
}
},
{
"key": "title",
"value": {
"string_value": "Use the built-in GELU, don't roll your own!"
}
},
{
"key": "card_url",
"value": {
"scribe_key": "card_url",
"string_value": "https://t.co/NmNQu53cmW"
}
}
],
"card_platform": {
"platform": {
"audience": {
"name": "production"
},
"device": {
"name": "iPhone",
"version": "13"
}
}
},
"name": "summary",
"url": "https://t.co/NmNQu53cmW",
"user_refs_results": [
{
"rest_id": "6968622",
"result": {
"__typename": "User",
"action_counts": {
"favorites_count": 13715
},
"avatar": {
"image_url": "https://pbs.twimg.com/profile_images/1981900016881913856/EDBdf4uf_normal.jpg"
},
"banner": {
"image_url": "https://pbs.twimg.com/profile_banners/6968622/1761356761"
},
"core": {
"created_at": "Wed Jun 20 14:57:55 +0000 2007",
"name": "Giles Thomas",
"screen_name": "gpjt"
},
"dm_permissions": {
"can_dm": false
},
"exclusive_tweet_following": false,
"follow_request_sent": false,
"identity_profile_labels_highlighted_label": {},
"location": {
"location": "Lisbon, Portugal"
},
"media_permissions": {
"can_media_tag": true
},
"notifications_settings": {
"notifications_enabled": false
},
"pinned_items": {
"tweet_ids_str": [
"2074916079952920824"
]
},
"privacy": {
"protected": false,
"suspended": false
},
"private_super_following": false,
"profile_bio": {
"description": "Building LLMs, learning in public / Founded and led @PythonAnywhere / PSF Fellow",
"entities": {
"description": {
"user_mentions": [
{
"id_str": "",
"indices": [
52,
67
],
"name": "",
"screen_name": "PythonAnywhere"
}
]
},
"url": {
"urls": [
{
"display_url": "gilesthomas.com",
"expanded_url": "http://www.gilesthomas.com/",
"indices": [
0,
23
],
"url": "https://t.co/AfkHrtuEKi"
}
]
}
}
},
"profile_image_shape": "Circle",
"profile_metadata": {
"profile_interstitial_type": "",
"profile_link_color": "1F98C7"
},
"profile_translation": {
"translator_type_enum": "None"
},
"properties": {
"has_extended_profile": true,
"has_no_screen_name": false
},
"relationship_counts": {
"followers": 1416,
"following": 203
},
"relationship_perspectives": {
"blocked_by": false,
"blocking": false,
"followed_by": false,
"following": false,
"live_following": false,
"muting": false
},
"rest_id": "6968622",
"smart_blocked_by": false,
"smart_blocking": false,
"super_follow_eligible": false,
"super_followed_by": false,
"super_following": false,
"tweet_counts": {
"media_tweets": 130,
"tweets": 6435
},
"verification": {
"is_blue_verified": true,
"verified": false
},
"website": {
"url": "https://t.co/AfkHrtuEKi"
}
}
}
]
},
"place": {},
"entities": {
"urls": [
{
"display_url": "gilesthomas.com/2026/08/built-…",
"expanded_url": "https://www.gilesthomas.com/2026/08/built-in-gelu",
"indices": [
169,
192
],
"url": "https://t.co/NmNQu53cmW"
}
]
},
"quoted_tweet": null,
"retweeted_tweet": null,
"isLimitedReply": false,
"communityInfo": null,
"article": null
}