How I automate my own job at Hugging Face using agents — Niels Rogge, Hugging Face

AI Engineer · 20 min · 241 sentences · from YouTube's caption track

Each timecode opens YouTube at the start of that sentence. Line anchors (#s42) are the cue ids in the WebVTT, and every line carries its start and end seconds. All transcripts has every talk, and the whole corpus as one file.

  1. 00:01[music]
  2. 00:16Okay.
  3. 00:17All right.
  4. 00:19Hello everyone.
  5. 00:20Thanks for coming by.
  6. 00:21Today I'll talk about how I automate my own job at Hugging Face using agents.
  7. 00:28Um short introduction.
  8. 00:29I'm just uh Niels from Belgium, the land of beer, fries, and chocolate.
  9. 00:34I studied at KU Leuven, and I'm a machine learning engineer at Hugging Face for 5 years now.
  10. 00:42Uh today I'll talk about the community science team at Hugging Face, which is the team I'm part of.
  11. 00:47Uh then I'll talk about how I automate large parts of the community science team.
  12. 00:52And finally, I'll also discuss some other efforts uh that we do at Hugging Face.
  13. 00:58So, let's start with the community science team at Hugging Face.
  14. 01:02So, basically, this started when I was sent I was seeing like trending research uh passing by on GitHub.
  15. 01:09And a lot of times when I saw new interesting work, um the weights were not available on Hugging Face, sadly.
  16. 01:15Like, researchers use either Google Drive or they use GitHub releases.
  17. 01:20They use Dropbox, they use Zenodo, or other servers to put their um artifacts on.
  18. 01:26And this hurts uh discoverability of their work.
  19. 01:29It's like not easily uh visible or discoverable.
  20. 01:33And when I then open a GitHub issue to say like, "Actually, you could put your weights on Hugging Face for free."
  21. 01:39Most of the time, people replied to me like, "Yeah, migrating the weights uh from Google Drive to Hugging Face actually makes perfect sense."
  22. 01:46So, yeah, the community science team can also uh be described as the Google Drive to the hub team.
  23. 01:52Um why?
  24. 01:53Because on Hugging Face, we have these paper pages, uh and every single paper is from archive.
  25. 01:59And then on the right side, you can basically list the linked artifacts, like the the linked models or data sets.
  26. 02:05So, people can easily reproduce your paper or find the models or data sets.
  27. 02:11So, yeah, you can see them on the right side.
  28. 02:14Um this improves the discoverability of your work because we have these metadata tags or filters on the app, so you can easily find, for example, depth estimation model, an LLM if you're interested.
  29. 02:25You can find them by language.
  30. 02:26You can tag them with the library they are compatible with and so on.
  31. 02:29So, this improves the discoverability of your work.
  32. 02:32So, these are, yeah, the metadata tags that you can add to every single model on Hugging Face or every single data set.
  33. 02:39So, yeah, this is like the main problem that we saw, like, lots of people, lots of researchers are like using third-party services to publish their work.
  34. 02:48We have the Hugging Face platform, which is like a centralized place where people can find machine learning artifacts.
  35. 02:53It also improves with documentation because you can add a model card or a data set card.
  36. 02:57We have tooling, so you can easily upload or download stuff from Hugging Face.
  37. 03:02And it might also help reach researchers in promoting their work.
  38. 03:06So, it's basically a win-win both for researchers and then other people using the research.
  39. 03:12So, yeah, these are the typical GitHub issues that I was opening.
  40. 03:15I always had like the same template.
  41. 03:17I just asked, "Could you please release this checkpoint on Hugging Face?
  42. 03:20Could you please release this data set on Hugging Face?"
  43. 03:23And
  44. 03:23[snorts]
  45. 03:23then I also opened PRs, pull requests on Hugging Face to add data set cards or model cards to improve the documentation of those artifacts.
  46. 03:33But, there's a problem.
  47. 03:35It's not really scalable for me to open all these GitHub issues or pull requests because every single day there are like hundreds of research papers coming out on archive, especially now with AI boom.
  48. 03:45Um yeah, also NeurIPS, for example, a major AI conference, they are seeing a massive amount of papers.
  49. 03:51So, can we automate this?
  50. 03:52Can we scale the community science team with agents?
  51. 03:56So, that's the second part of my talk.
  52. 03:59How can we, yeah, scale this uh to a massive amount of research papers?
  53. 04:05So, the idea is pretty simple.
  54. 04:07Uh we should have an AI agent which can help me do this outreach to all these researchers which publish uh models or data sets uh as part of their research work.
  55. 04:17And then, yeah, do the outreach in an automated way.
  56. 04:21So, this is the typical workflow that I was following.
  57. 04:23So, basically, whenever I saw a research paper, I first tried to find the GitHub URL uh of that paper, if it's available.
  58. 04:31Then, I I read the readme of that GitHub file.
  59. 04:35And then, I basically check if there's anything new interesting to be shared on Hugging Face.
  60. 04:40Uh it could be that it's on Hugging Face already.
  61. 04:42In that case, I check whether the model cards or data set cards already properly uh present, whether the metadata tags, for example, are there.
  62. 04:50If uh not, then I will might open a pull request.
  63. 04:54Otherwise, if the artifacts are not yet on Hugging Face, I open a GitHub issue.
  64. 04:58And then, finally, I also follow up with the author.
  65. 05:00So, that's kind of the workflow that I had to automate uh with agents.
  66. 05:05And there are several ways to solve this.
  67. 05:07Uh you could uh go with a workflow.
  68. 05:10Uh these pictures are, by the way, taken from the blog post building effective agents by Anthropic, which is a really great read.
  69. 05:16Uh read.
  70. 05:17Um so, on the left side, you see, yeah, a workflow which is more deterministic.
  71. 05:21You basically use LLM APIs within steps of a predefined path or pipeline, uh which is more predictable.
  72. 05:28It's more deterministic.
  73. 05:29You have more control over it.
  74. 05:30Of course, it's less flex- flexible.
  75. 05:33And then, on the other hand, you could have a fully fledged auto- autonomous agent, which is an LLM in a loop that calls tools until it's done, which is more flexible, but also less uh predictable.
  76. 05:44Uh Uh, at the time, yeah, of course, it doesn't have to be a binary story.
  77. 05:48You can have a workflow on one hand, you can have a fully autonomous agent on the other hand, but you you could of course also mix and match these type of things
  78. 05:55uh, for your use case.
  79. 05:57In my case, I went for um, a pretty deterministic workflow.
  80. 06:02Uh, why?
  81. 06:02Because at the time that I was building this, this was in 2024, was at the time that Anthropic uh, wrote their blog post building effective agents.
  82. 06:10And there they actually said, "Try to avoid building agents if you really don't have to.
  83. 06:15Start simple, start with a single LLM API.
  84. 06:19Uh, avoid frameworks."
  85. 06:20Uh, and actually I think those were great tips.
  86. 06:23So, at the time I started building a workflow which basically replicated the workflow that I was doing when I was doing this outreach.
  87. 06:30So, yeah, this is the whole uh, pipeline.
  88. 06:32This is created using the Excalidraw MCP server in Cursor.
  89. 06:35It's pretty nice to create a visualization of your code.
  90. 06:38Uh, I'm not going to go into the details, but basically it just replicates um, the workflow that I was doing when doing the outreach.
  91. 06:45And I use LLM APIs in then each of the steps without any framework, without any agent framework.
  92. 06:52So, it made it quite uh, deterministic and I had a lot of control over uh, how this goes.
  93. 06:58Um, in terms of deployment of this uh, workflow, it's a simple cron job.
  94. 07:03So, cron is just something that runs regularly.
  95. 07:06In my case, I run it once every night.
  96. 07:08So, when I'm sleeping, there is this agent, but technically it's just a cron job, a Python script with an LLM API, which is going to read all these hundreds of archive papers,
  97. 07:18uh, and then it might open GitHub issues or it might open pull requests on Hugging Face.
  98. 07:23I'm using GitHub Actions for this.
  99. 07:25Uh, I saw this very nice blog post free cron jobs with GitHub Actions, and actually it's probably the best entry point if you want to set up cron jobs,
  100. 07:33um, because GitHub has a pretty generous tier if you want to get started with like putting simple cron jobs uh, up there.
  101. 07:40And yeah, it makes it really easy for me in the UI to manage all these cron jobs.
  102. 07:45So yeah, every night I have hundreds of uh GitHub issues being created.
  103. 07:52For the tracing part, um I'm using LangFuse.
  104. 07:56Uh yeah, LangFuse also has a a booth here.
  105. 07:58Um LangFuse is pretty great.
  106. 08:01Um I use it mostly for the tracing part, the observability part, just to see what is the LLM doing, what are the inputs, what are the outputs, what are the prompts,
  107. 08:10how much does it cost, latency, and so on.
  108. 08:14Um so yeah, uh I definitely recommend it.
  109. 08:18Um but yeah, as my agents are opening so many GitHub issues every night, I then end up with a massive amount of unread GitHub notifications because people reply to those GitHub issues.
  110. 08:30And that's a lot of work to then reply to all of those issues.
  111. 08:34It's kind of like going through your mailbox.
  112. 08:37So you could wonder, could we also um automate the follow-up to those GitHub uh issues?
  113. 08:44Because initially I was still the GitHub issue creation was done uh by an agent, but I was still the one involved in then doing the follow-up.
  114. 08:51Uh now a few months ago I also automated the the follow-up to those GitHub issues.
  115. 08:57Again, you could think, how should you solve this?
  116. 08:59Should you go for a more deterministic workflow or can you go for a fully autonomous agents, uh an LLM in a loop which runs with some tools and skills?
  117. 09:08Um well, here I went for kind of a fully autonomous agents, uh so it's kind of flexible.
  118. 09:13It's a bit less predictable, but it works quite well.
  119. 09:17Um I went for this because uh in November of last year at AI Engineer in New York, there was a pretty nice workshop by Anthropic on the Claude agent SDK.
  120. 09:28And there they were actually saying that agents might be better than workflows.
  121. 09:32So they So they were kind of contradicting themselves, but they he said that models have become so good that you might actually now start to work with fully autonomous agents rather than a workflow.
  122. 09:42So this is why I went with this approach and I actually am using the Claude agents SDK for this use case.
  123. 09:49Uh there was another pretty nice talk by Cursor also at AI Engineer.
  124. 09:54This was in the European version in London a few months ago.
  125. 09:58There they talked about how they replaced 12,000 lines of custom code, pretty sophisticated workflow, with a very simple 200 lines of code skill.
  126. 10:07Uh actually it's pretty similar for me like I can replace a lot of custom codes, thousands of lines of code, with nowadays just a simple agent with maybe a CLI
  127. 10:18as a tool and a skill and that's it cuz the models have become so good.
  128. 10:25So yeah, in terms of the architecture, this is a bit what it looks like.
  129. 10:30Um so it's actually just the Claude agents SDK which is, I would say, a pretty good Python SDK for building an agent.
  130. 10:37Initially I was using the Claude models, but then I since actually this week I'm using the GLM 5.2 model via Hugging Face inference providers.
  131. 10:45So Hugging Face does offer a service which basically wraps a lot of inference providers like Together AI, Fireworks, Cerebras and so on.
  132. 10:55So you can use a lot of open models in a unified way.
  133. 10:58It's OpenAI compatible or Anthropic compatible and then I deploy this on Modal.
  134. 11:05Modal is also present here today.
  135. 11:08And it's mainly using Bash as a tool so the terminal to basically do Hugging Face commands because it's using the Hugging Face CLI quite a bit.
  136. 11:18So I combine it with the Hugging Face CLI skill which is actually all it needs.
  137. 11:22And then it might comment something on GitHub as a follow-up.
  138. 11:27And it also actually does the posting on Slack because eventually I also want to see the final results on our Slack channel uh from Hugging Face.
  139. 11:35So yeah, given that there's also a lot of hype on GLM 5.2 recently, for example, Cursor uh saw great performance on their Cursor bench.
  140. 11:44Post-training bench is another one uh where it actually beats Opus 4.8 and it's cheaper.
  141. 11:49So, yeah, there's no reason not to use GLM 5.2 uh especially given that I work at Hugging Face.
  142. 11:55Um for the deployment, as I said before, I use Modal.
  143. 11:59It's pretty great if you want to deploy agents.
  144. 12:02Uh in my case, I'm using the batch processing feature.
  145. 12:05So, they allow you to spin up a massive amount of containers all in parallel.
  146. 12:09Every single container is basically one agent loop that is processing one GitHub issue.
  147. 12:15Uh it's super easy to use, I have to say.
  148. 12:17Um and the startups are also pretty fast.
  149. 12:21So, I definitely recommend it if you're building uh agents that are like, for example, running in the background, running overnight, for example.
  150. 12:29Um and then the way I invoke it, yeah, technically I could also just uh deploy this as a cron job.
  151. 12:35Modal, for example, has support for this.
  152. 12:38But typically, the follow-up on the GitHub issues, I still do that actually manually by invoking it as a skill.
  153. 12:44So, I created a skill for this in Cursor.
  154. 12:47Uh I call it process under it Modal.
  155. 12:50And then what it's going to do is it's actually going to invoke an agent, in this case, Composer 2.5, which is like the agent that I'm mostly using in Cursor, which is again going to invoke all the other agents.
  156. 13:00So, that's this is kind of the loop that people are talking about.
  157. 13:04And then finally, it's going to post uh all the results on our Slack channel.
  158. 13:09Uh so yeah, and this is actually what it just posts.
  159. 13:12So, what it does is it basically just posts a huge amount of Hugging Face papers, uh which are these research papers which people can uh make available on Hugging Face because every time someone mentions it
  160. 13:23in a model card or dataset card, we index it on the hub.
  161. 13:26And then it just posts all the artifacts that people have been uploading based on the outreach that we do via GitHub.
  162. 13:32Um so yeah, I do this still in a manual form.
  163. 13:36So I just invoke the skill and then after a few minutes, these messages appear on our Slack channel.
  164. 13:44Um yeah, I just included some fun results because to be honest, it's quite fun to see people interacting with the agents.
  165. 13:52Um to be honest, I don't disclose that it's an agent.
  166. 13:56Why?
  167. 13:56Because I think if people know it's a bot, then they might quickly like close the issue.
  168. 14:00And to be honest, they post exactly the same stuff as I was doing before manually.
  169. 14:05So I don't actually see any reason to to do that.
  170. 14:09Um so and then you see replies like this.
  171. 14:12Hi Niels, thanks a lot for your suggestion and the clear guidance.
  172. 14:16I actually also often times see people using an agent to reply to my agents.
  173. 14:21So it's kind of the that internet nowadays.
  174. 14:23Um but people yeah, make all their artifacts available on Hugging Face.
  175. 14:27And out of the thousands of issues that are being created on Hugging Face, actually so far I've only had two negative comments.
  176. 14:34One guy saying yeah, please close this slop.
  177. 14:37So he closed the issue.
  178. 14:38And then another one.
  179. 14:39But most of the people they just say, yeah, actually it makes perfect sense to make my weights or my data sets available on Hugging Face.
  180. 14:45Like why didn't I think of this?
  181. 14:47Um so it's kind of a win-win I would say.
  182. 14:51Uh I often times also post fun results on our Slack channel.
  183. 14:55Like for example, one time someone a researcher from Apple sent me a DM like, I saw you reached out to me.
  184. 15:01Yeah, technically it's my agent just posting a GitHub issue regarding publishing a new Apple uh the artifacts of an Apple paper on Hugging Face.
  185. 15:10Or for example, it reaches out to Google DeepMind to publish um mathematics data sets.
  186. 15:17Um so a lot of times like I receive emails, the one on the the side, where yeah, they want to publish a 400 GB data set on Hugging Face, but this was also my agent just opening GitHub issues.
  187. 15:29Um Yeah, this is another fun result.
  188. 15:32So, Paddle OCR, it's like a Chinese company.
  189. 15:35They migrated all their OCR models to Hugging Face based on outreach by the agents that create issues for me.
  190. 15:44So, yeah, it's pretty nice.
  191. 15:47Another fun result is like when it when it completes the default template of model cards on Hugging Face.
  192. 15:54So, Mac Mitchell, who also works at Hugging Face, she has a famous paper called model cards for model reporting, making sure that anyone documents their models in a proper way.
  193. 16:04And so, we do provide this template, which you can see on the left side in the Git diff.
  194. 16:08And then, the agent is just completing that template based on the content that it finds based on the paper, like the GitHub readme, the PDF itself, and so on.
  195. 16:21Um yeah, it's also quite funny to see, for example, in this case that it included me in the model card.
  196. 16:28It said, "Model card authors, Niels part of the Hugging Face community science team."
  197. 16:32I never prompted it this way, but it's pretty fun to see.
  198. 16:35Or people are replying, "Thank you for helping me fix my mistakes."
  199. 16:39So, those are all done by the agents.
  200. 16:44Uh I think the most popular GitHub issue that was created was this paper Tiny Recursive Models, which you might have seen, was quite trending both on Hugging Face, but also on Twitter.
  201. 16:56So, yeah, more than 60 people actually upvoted that issue so that the model was released on Hugging Face.
  202. 17:02So, this is again, I think, the win-win.
  203. 17:04So, it's both a win for the researcher, making their research more discoverable on Hugging Face, but it's also, yeah, better for the people then who want to build on top of that research and want to
  204. 17:14use them.
  205. 17:16Uh so, yeah, I I hundreds of GitHub issues where I think I can show uh nice results um where people interact with the agents.
  206. 17:25You might also wonder, yeah, how to avoid slop because you might think, okay, you have an agent uh spamming the whole internet with your GitHub issues.
  207. 17:32Like, should you even do this?
  208. 17:34Again, I already talked about the win-win.
  209. 17:36Um, but a blog post that I highly recommend, if you want to avoid that your agent is just posting slop, is um the LLM Evils FAQ uh by Hamel Husain.
  210. 17:48Uh, I would say he's like the main expert when it comes to LLM evaluation.
  211. 17:53He also has like a a paid course, but he also publishes a lot of stuff for free online including this blog post.
  212. 17:59So, I highly recommend to go through it if you want to learn more about how to evaluate your agents.
  213. 18:06So, my conclusion would be um that open models are actually getting great, especially now with GLM 5.2. You have Deep Seek V4 and so on.
  214. 18:14So, um yeah, we we are able to now replace closed-source models by open ones.
  215. 18:19Uh, for my use case, I would say agents are actually better than uh workflows.
  216. 18:24Uh, they only need a single CLI, which is the Hugging Face CLI.
  217. 18:27They need a single skill, the Hugging Face CLI skill, and a sandbox, and that's all they need to do their work.
  218. 18:32And finally, yeah, don't forget about evaluation.
  219. 18:36Um Finally, uh I can also discuss some other efforts that we do as part of the community science uh team.
  220. 18:44Um, very shortly.
  221. 18:46Um, so, I have a Twitter account that I created.
  222. 18:49It's called Daily Papers.
  223. 18:51And it actually uses the exact same workflow as my agents behind the scenes to post interesting research papers on X. It uh recently crossed 90,000 followers without any involvement of me.
  224. 19:02I just deployed this uh and it posts interesting research papers and artifacts from Hugging Face every 4 hours or every time someone uh releases something cool on the Hugging Face.
  225. 19:14Um so, yeah.
  226. 19:15And I have like Gemini determining the best visual to tweet or to include in the tweet.
  227. 19:21Like for example, this recent tweet where it tweeted out that Nvidia released an optimized version of GLM 5.2 got more than 2,000 likes.
  228. 19:29So, that's pretty cool to see.
  229. 19:32And a final effort that I'm working on right now is a revival of Papers With Code, which is a website that once existed and then was acquired by Meta
  230. 19:41and then sadly it died.
  231. 19:43So, I'm I'm trying to re- revive it and making a research and state-of-the-art easier accessible.
  232. 19:49Um for now it lives at paperswithcode.co.
  233. 19:54Uh so, yeah.
  234. 19:55You can find benchmarks over there.
  235. 19:57For example, for OCR models, all OCR benches like popular benchmark.
  236. 20:01But I'm also making it an educational resource so that people can learn about technical terms like mixed training uh on policy distillation and so on.
  237. 20:12So, yeah.
  238. 20:12That was it for my talk.
  239. 20:14I hope you learned something.
  240. 20:16Thanks all of you for your attention.
  241. 20:18[applause]