Facebook ML engineer interview: the only post you'll need to read

Practice 1-on-1 with ex-interviewers from Facebook. Learn more.

Machine learning engineer interviews at Facebook are really challenging. The questions are difficult, specific to Facebook, and cover a wide range of topics.

The good news is that the right preparation can make a big difference, and can help you land an ML job at Facebook. We have put together the ultimate guide below, to help you maximize your chances of success.

Here's an overview of what we'll cover:

1. Interview process and timeline

1.1 What interviews to expect

What's the Facebook machine learning engineer interview process and timeline? It normally follows the below steps and takes four to eight weeks to complete:

  1. Application and referrals
  2. Recruiter screen
  3. Coding interview
  4. Onsite interviews (five interviews)

Next, we'll dig into each of these steps in more detail.

1.1.1 Application and referrals

Step one is getting a Facebook interview in the first place. In this guide we're focusing primarily on the interviews, so we'll keep this portion brief. You can apply to Facebook directly or a recruiter may reach out to you via LinkedIn (or similar). In either case, it helps to have a quality (and up-to-date) resume that is tailored to machine learning positions, and to Facebook more specifically. 

It can also be helpful to get an employee referral to the Facebook recruiting team internally. This may not be possible, but if you do have a connection to someone who works at Facebook, then this can help you get your foot in the door for an interview.

1.1.2 Recruiter phone screen

In most cases, you'll start your interview process with Facebook by talking to an HR recruiter. They are looking to confirm that you've got a chance of getting the job at all, so be prepared to explain your background and why you’re a good fit at Facebook. You should expect typical behavioral and resume questions like, "tell me about yourself", "why Facebook?", or "tell me about your current project."

If you get past this first HR screen, the recruiter will then help schedule your next interview (a coding interview). One great thing about Facebook is that they are very transparent about their recruiting process. As a result, your HR contact will probably walk you through the remaining steps in the hiring process at this time.

1.1.3 Coding interview

Next, you'll have a coding interview where you'll be asked data structure and algorithm questions. These questions tend to be quite similar to the questions you'd encounter as a Facebook software engineer.

Your interviewer may start with a few behavioral questions, but most of the time will be spent on coding questions. You're usually given two problems to solve, and you can learn more about the types of questions to expect in section 2.1 of this guide. 

Logistically speaking, the coding interview is usually held through a video call using BlueJeans. And the coding exercises are done in CoderPad, which is a simple online code editor without syntax highlighting or auto-complete.

1.1.4 Onsite interviews

Onsite interviews are the real test. You'll typically do five different interviews on a variety of topics, and you should plan to spend the full day interviewing. Each interview will last about 45 minutes and will focus on one of the following topics:

  1. Coding interview, where you'll solve algorithm and data structure questions similar to those you'd encounter in a software engineer interview.
  2. System design interview, where you'll be asked to create a high-level design for a modern technology system like Instagram, Facebook Messenger, etc.
  3. Machine learning design interview, where you'll need to suggest an approach for how to solve a problem using a machine learning solution.
  4. Behavioral interview, where you can expect questions about your background, accomplishments, and your motivation for applying to Facebook.

During the onsite, you'll typically get two coding interviews, one system design interview, one machine learning design interview, and one behavioral interview. Just keep in mind that the exact breakdown might vary depending on the role, team, and level you're applying for.

[COVID note] It's likely that your onsite interviews will be held virtually instead of in-person, given the COVID-19 pandemic. However, your recruiter should be able to provide you with the most up-to-date information on Facebook's onsite interview procedures. Feel free to ask your Facebook recruiter for details after you've been officially invited to participate in the onsite interviews.

Finally, it's worth briefly mentioning that some candidates have reported a different interview process, where they move from coding interviews straight to team matching interviews (which are similar to behavioral interviews). However, we would only expect that process for specialized roles or unique circumstances. So, you should prepare for the interview process outlined above, unless you have been informed otherwise by Facebook. 

1.2 What happens behind the scenes

Throughout the interview process at Facebook, the recruiter usually plays the role of "facilitator" and moves the process from one stage to the next. Here's an overview of what typically happens behind the scenes:

  • After the coding interview, the interviewer you've talked to will have 24h to submit their ratings and notes to the internal system. Your recruiter then reviews the feedback, and decides to move you to the onsite interview or not depending on how well you've done.
  • After the onsite, your interviewers will make a recommendation on hiring you or not and the recruiter compiles your "packet" (interview feedback, resume, referrals, etc.). If they think you can get the job, they will present your case at the next candidate review meeting.
  • Candidate review meetings are used to assess all candidates who have recently finished their interview loops and are close to getting an offer. Your packet will be analyzed and possible concerns will be discussed. Your interviewers are invited to join your candidate review meeting, but will usually only attend if there's a strong disagreement in the grades you received (e.g. 2 no hires, 2 hires). If after discussion the team still can't agree whether you should get an offer or not, you might be asked to do a follow up interview to settle the debate. At the end of the candidate review meeting, a hire / no hire recommendation is made for consideration by the hiring committee.
  • The hiring committee includes senior leaders from across Facebook. This step is usually a formality and the committee follows the recommendation of the candidate review meeting. The main focus is on fine-tuning the exact level and therefore the compensation you will be offered.

It's also important to note that hiring managers and people who refer you have little influence on the overall process. They can help you get an interview at the beginning, but that's about it.

2. Example questions

Okay, now that we've covered the interview process, let's dig into the four types of interviews that you'll encounter:

  • Coding
  • System design
  • Machine learning design
  • Behavioral

Below, we've put together a summarized list of example questions for each of these interview types. We've also provided a few notes about them, which should help you get a better idea of what to expect. Let's jump in!

2.1 Coding interview

Both before and during the onsite interviews, you'll have coding interviews. Facebook's engineers (across disciplines) use code to solve some of the most difficult problems the company faces. As a result, it's essential for all of the company's new engineers to have strong foundational coding skills.

Since you're applying for a machine learning position, you're probably wondering what kind of machine learning problems you'll be asked. We'll get into that more in section 2.3 (i.e. the section on machine learning design interviews), but for coding interviews, you can expect data structure and algorithm questions that are very similar to the questions a normal FB software engineer candidate would be asked. 

So, to help you structure your preparation, we've pulled in the below summary of Facebook's most common coding question categories. This information is based on our analysis of Glassdoor data for Facebook software engineer interviews.

  1. Arrays / Strings (38% of questions, most frequent)
  2. Graphs / Trees (29%)
  3. Dynamic Programming (18%)
  4. Search / Sort (9%)
  5. Linked lists (4%)
  6. Stacks / Queues (2%, least frequent)

We've also listed common examples of Facebook software engineer coding questions below. To make these questions easier to study, we've modified the phrasing to match the closest problem on Leetcode or another resource, and we've linked to a free solution. 

Example coding questions asked by Facebook

1. Arrays / Strings (38% of questions, most frequent)

  • "Given an array nums of n integers where n > 1,  return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]." (Solution)
  • "Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome." (Solution)
  • "Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers." (Solution)
  • "Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n)." (Solution)
  • "Given an array of strings strs, group the anagrams together." (Solution)
  • "Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid." (Solution)
  • "Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero." (Solution)

2. Graphs / Trees (29%)

  • "Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive)." (Solution)
  • "Given a Binary Tree, convert it to a Circular Doubly Linked List (In-Place)." (Solution)
  • "Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST." (Solution)
  • "Given a binary tree, you need to compute the length of the diameter of the tree." (Solution)
  • "Serialize and deserialize a binary tree" (Solution)
  • "Given a binary tree, find the maximum path sum." (Solution)
  • "Given a sorted dictionary (array of words) of an alien language, find order of characters in the language." (Solution)
  • "Check whether a given graph is Bipartite or not" (Solution)

3. Dynamic Programming (18%)

  • "Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multiple of k, that is, sums up to n*k where n is also an integer." (Solution)
  • "Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit." (Solution)
  • "Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'." (Solution)
  • "You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as its new symbol. Find out how many ways to assign symbols to make sum of integers equal to target S." (Solution)

4. Search / Sort (9%)

  • "We have a list of points on the plane.  Find the K closest points to the origin (0, 0)." (Solution)
  • "Given two arrays, write a function to compute their intersection." (Solution)
  • "Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] find the minimum number of conference rooms required." (Solution)

5. Linked lists (4%)

  • "A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list." (Solution)
  • "Given a singly linked list L: L0?L1?…?Ln-1?Ln, reorder it to: L0?Ln?L1?Ln-1?L2?Ln-2?…" (Solution)
6. Stacks / Queues (2%)
  • "Implement the following operations of a queue using stacks." Note: see more details at the following link. (Solution)

2.2 System design interview

Facebook, Instagram, and Whatsapp all have 1bn+ monthly active users. Therefore, Facebook machine learning engineers need to be able to understand and work with systems that are highly scalable. The coding questions we've covered above usually have a single optimal solution. But the system design questions you'll be asked are typically more open-ended and feel more like a discussion.

This is the part of the interview where you want to show that you can both be creative and structured at the same time. Below are the most common system design questions asked in Facebook software engineer interviews, according to data from Glassdoor.

As with coding interviews, the system design questions you'd face as a machine learning engineer should be similar to those asked in normal Facebook software engineer interviews. As a result, we'd recommend using the below questions in your preparation. 

Top 10 system design questions asked at Facebook

  • How would you design Instagram / Instagram Stories
  • How would you design Facebook
  • How would you design Facebook Messenger
  • How would you design Facebook's live update of comments on posts
  • How would you design an online collaborative editor (e.g. Google Docs)
  • How would you design a typehead feature (e.g. Google search autocomplete)
  • How would you design Twitter's trending topics
  • How would you design a distributed Botnet
  • How would you design a system that can handle millions of card transactions per hour
  • How would you design security for Facebook's corporate network from scratch (Security team interview)

2.3 Machine learning design interview

All of the interviews we've covered so far have considerable overlap with the Facebook software engineer interviews. But the machine learning design interview is specific to candidates for Facebook's machine learning engineer roles.

Facebook has huge data sets and billions of users across their various apps. The magnitude and complexity of these systems present quite a few opportunities to apply machine learning to real-world problems. And, broadly speaking, that's what you'll be asked to do during the machine learning design interview.

The questions you'll be asked are somewhat similar to system design questions, in that you'll need to outline a high-level approach for a system or problem. But, the primary difference is that you'll be expected to specifically develop a machine learning solution. 

To provide a clearer idea of what to expect, we've compiled a list of examples that are similar to the questions you'd be asked in Facebook's machine learning design interview. These questions are from three sources: a machine learning guide from Facebook, Glassdoor, and from Rahul Agarwal. Note that we've modified the phrasing in some cases to make the questions more clear, and we've listed the original source after each question in parentheses for reference.

Machine learning design questions asked at Facebook

  • Given images of cats and dogs, develop a model that will identify if an image contains a cat or a dog (source: Facebook guide)
  • Predict the probability that a user will click on a given post (source: Facebook guide)
  • Predict how likely a user is to consider a given ad relevant and useful (source: Facebook guide)
  • Design a newsfeed using machine learning (source: Rahul Agarwal)
  • How would you build, train, and deploy a system that detects if multimedia and/or ads content violates terms or contains offensive materials? (source: Glassdoor)

2.4 Behavioral interview

For the behavioral interview, and sometimes at the beginning of your other interviews, you'll be asked behavioral or "resume" questions. These questions focus on your past work experience, your qualifications, and your motivation for applying to Facebook. In other words, it's a way for your interviewer to get to know you better.

Behavioral questions are a great opportunity to tell your story, to highlight your top qualifications, and to demonstrate your alignment with Facebook's values and culture. You should also be ready to drill-down into the technical details of the projects on your resume, and to discuss the types of projects you'd like to work on in the future. Having clarity in these areas will help you make a strong impression in behavioral interviews.   

Below, we've listed several example behavioral questions that were asked in either Facebook machine learning engineer or Facebook software engineer interviews, according to data from Glassdoor. This should give you a good list of practice questions to start preparing with. Note that we've edited the language in some places to improve the clarity or grammar of the questions

Behavioral interview questions asked at Facebook

  • Tell me about yourself
  • Why Facebook?
  • Give me an example of a project where you used data and machine learning
  • Tell me about a time you faced an obstacle and how did you resolve it?
  • Tell me about a recent / favorite project and some of the difficulties you had
  • Tell me about the greatest accomplishment of your career
  • Tell me about a time you struggled to work with one of your colleagues
  • Tell me about a time you had to resolve a conflict in a team
  • Tell me about a time you were given feedback that was constructive
  • Tell me about a time you had to step up and take responsibility for others
  • Tell me about your worst boss and why they were bad

3. How to prepare

Now that you know what questions to expect, let's focus on how to prepare. It's no secret that the performance bar at Facebook is quite high. To help you maximize your chances of landing an offer, we've listed the four steps we recommend taking to prepare below.

3.1 Learn about Facebook's culture

Most candidates fail to do this. But before investing a ton of time preparing for an interview at Facebook, you should make sure it's actually the right company for you.

Facebook is prestigious and so it's tempting to assume that you should apply, without considering things more carefully. But, it's important to remember that the prestige of a job (by itself) won't make you happy in your day-to-day work. It's the type of work and the people you work with that will.

If you know any engineersdata scientists, or other professionals who work at Facebook (or used to) it's a good idea to talk to them to understand what the culture is like. In addition, we would recommend reviewing Facebook's 5 core valueshacker culture, and machine learning careers page

3.2 Practice by yourself

As mentioned above, you'll have four main types of interviews at Facebook: coding, system design, machine learning design, and behavioral. 

For coding interviews, we recommend reading this article written by an ex-Facebook interviewer to understand more about the step-by-step approach you should use to solve coding questions in an interview. And to practice, we recommend using Leetcode to practice as many coding problems as possible. You can get a lot done with the free tier of Leetcode, but you can also access Facebook-specific questions using the premium tier if you'd like.

For system design interviews, we recommend studying our system design interview guide. The guide covers a step-by-step method for answering system design questions, and provides several example questions with solutions. 

For machine learning design interviews, we recommend that you study Facebook's machine learning field guide to make sure you understand the end-to-end process for implementing machine learning solutions. Then, you can get some practice using the example questions we've provided in section 2.3 above. 

For behavioral interviews, we recommend learning our step-by-step method for answering behavioral questions. Then, you can practice answering the questions listed in section 2.4 above. If you have more time to prepare, then you can prepare even more "stories" summarizing your top qualifications or important lessons that you've learned.

Finally, a great way to practice all of these interviews is to interview yourself out loud. This may sound strange, but it will significantly improve the way you communicate your answers during an interview. Play the role of both the candidate and the interviewer, asking questions and answering them, just like two people would in an interview. Trust us, it really helps!

3.3 Practice with peers

Practicing by yourself will only take you so far. One of the main challenges of machine learning engineer interviews at Facebook, is communicating your different answers in a way that's easy to understand.

As a result, we strongly recommend practicing with a peer interviewing you. If possible, a great place to start is to practice with friends. This can be especially helpful if your friend has experience with machine learning interviews or at least software engineer interviews. If you don't have anyone in your network who can interview you, then you can also find peers to practice with on platforms such as Pramp.

3.4 Practice with ex-interviewers

Practicing with peers can be a great help, and it's usually free. But at some point, you'll start noticing that the feedback you are getting from peers isn't helping you that much anymore. Once you reach that stage, we recommend practicing with ex-interviewers from top tech companies.

If you know a machine learning engineer or someone who has experience running interviews at Facebook or another big tech company, then that's fantastic. But for most of us, it's tough to find the right connections to make this happen. And it might also be difficult to practice multiple hours with that person unless you know them really well.

Here's the good news. We've already made the connections for you. We’ve created a coaching service where you can practice 1-on-1 with ex-interviewers from leading tech companies like Facebook. Learn more and start scheduling sessions today.

cta_illustration arrow_left Browse Facebook ex-interviewers

Any questions about Facebook ML engineer interviews?

If you have any questions about Facebook machine learning engineer interviews, do not hesitate to ask them in the comments below. All questions are good questions, so go ahead!