Google Lens | Design | Expertifie - sulabh84/SystemDesign GitHub Wiki

Requirements

Functional Requirements (Provided by interviewer)

  • Text Translation, search, copy to clipboard.
  • Solve mathematical equations
  • Shop an item from its image
  • Get food photos from menu

Non Functional Requirements (Not provided by interviewer)

  • Availability
  • Latency
  • Privacy

Estimations

  • 1 billion queries / day
  • 2000 requests / sec
  • 2-3 billion active users

Other Considerations

  • Do i need to save images i process per user? - No
  • Do i need to train my ML models? - extract feature from image to train ML Model
  • if the AI Fails, how do i retrain my model? - if fails save the image for improving the ML algorithm
  • So how much space do i need? - 4kb * 1billion = 4TB/day
  • Daily sync this data to cold storage, so that it can be later used to retrain ML model offline? - ues
  • Are the results personalized? - No

Deploying ML models

  • Collect data - prepare good quality datasets
  • Train Model - prepare model by training it with datasets and fine tune the algo
  • Deploy - deploy the ML model such that it can interact with live traffic and give predictions

ML Model deployment on AWS

image

Design using pen and paper

image image

Questions

  • How you will do fraud detection? - Lens Managing Service will take care of it
  • How you will run on offline mode? - you can bundle ML models along with app and deploy on Mobile (Feature will be behind toggle)
    • Drawback of offline mode:
      • It will drain lots of battery because of ML processing
      • you will not get past data to train your ML model or fine tune your ML model
      • you will not get user data
      • it will take lots of space
      • ML Code can be de-compiled by user and misuse it -
        • Sol: 1) encrypt ML models, 2) give different ML model to client than running on Server