12
返回列表 发新帖
楼主: vivis31
跳转到指定楼层
上一主题 下一主题
收起左侧

[题目讨论] 求问一个ML系统设计题

 
全局:
vivis31 发表于 2021-09-25 10:59:45
event tracking 是指去捕获每个用户的request吗?那这个数据后续能做啥用呢?我理解是这些用户行为数据一般都是用于推荐系统的?对于image classification 系统也有用处
一般service上线都要加tracking 我能想到的tracking就两个 一个是model performance tracking 一个是service performance tracking 前面的可以套online model evaluation那一套 后面的主要是service的实际latency是多少现在的这些sever的setting够不够用 有没有downtime down的话有没有alert 怎么bring up 当然这是general的具体到image上面就不懂了 感觉楼下的讲的挺好的
回复

使用道具 举报

🔗
uuisafresh 2021-9-26 03:35:58 | 只看该作者
全局:
vivis31 发表于 2021-9-25 14:38
老哥用户反馈+在线拓展的想法棒!

有两个concern啊,一是输入查询是否已经分类过感觉难以实现,比如图 ...

第一个concern应该是要重点设计的,百万用户的话减少运算量增加cache hit ratio性能提升应该不少。我理解图片应该是二维序列,应该可以hash,然后直接访问cache是否有结果。再拓展的话用简单的数字图像处理(去噪,非深度模型)先判断是否有类似照片(这个需要详细想想),或者浅层模型算与已知图片相似度,如果高于阈值直接返回已知图片类型(并行跑),避免跑深度模型。

然后在用户图片request首先hit到的server,应该已经要把图片储存到云了,然后在backend内部是不需要额外协议去传图片,worker直接和云沟通去拿图片来跑模型。worker和server是不同机器分布式的,这样易于弹性扩展,如果用户request太多,增加server,如果模型跑太慢增加worker。
回复

使用道具 举报

🔗
brtt13 2021-9-26 06:37:20 来自APP | 只看该作者
全局:
可能不是online classify,楼主起码问题的context得抛出来吧😂
回复

使用道具 举报

🔗
 楼主| vivis31 2021-9-26 08:00:47 | 只看该作者
全局:
brtt13 发表于 2021-9-25 15:37
可能不是online classify,楼主起码问题的context得抛出来吧😂

题干:对用户上传的图片,能给出分类结果,要求支持large scale

进一步交流以后得到的信息:
- 图片二分类或者多分类?面试者自己考虑哪种符合用户需求
- 模型online 还是打包到终端?面试者自己分析优劣
- 硬件限制?没有,但最好最小化
- 检测结果立即返回还是延时返回?面试者自己考虑哪种符合用户需求
- 训练数据来源?无限制

简单说就是题目非常开放,要求面试者考虑多个方面,并就每个方面分析利弊。
回复

使用道具 举报

🔗
brtt13 2021-9-26 08:42:14 来自APP | 只看该作者
全局:
vivis31 发表于 2021-09-25 17:00:47
题干:对用户上传的图片,能给出分类结果,要求支持large scale

进一步交流以后得到的信息:
嗯……我觉得基本你可以选择自己擅长的说嘛,比如你自己是做ondevice的,那就federated learning + edge inference,这里large scale可以指向如何quantization减少成本;比如你是backend的,那就可以扯扯data如何进来的,offline training多机多卡能够handle多大的throughput,图像要不要进行预处理等等…反正随便扯嘛😂
回复

使用道具 举报

🔗
 楼主| vivis31 2021-9-26 12:25:39 | 只看该作者
全局:
uuisafresh 发表于 2021-9-25 12:35
第一个concern应该是要重点设计的,百万用户的话减少运算量增加cache hit ratio性能提升应该不少。我理解 ...

COOL,的确可以将输入提取embedding来对比,虽然里面肯定有不少坑,但的确是潜在方案啊!
回复

使用道具 举报

🔗
matthewyih 2021-9-27 16:23:01 | 只看该作者
全局:
cache不太现实, 同一个用户重复request场景不多(不如直接存用户result), 不同用户hit机率更低。classification还好, 若是detection图是必须100%一致, 图片有偏移或是缩放都会让detection位置失效。就算跑个浅模型快速判断, 或是bloom filter, 对於99.99%会miss的情况肯定是不划算。
实际优化後模型跑inference也就几ms, 跟网路延迟相比也没多少
回复

使用道具 举报

🔗
latency 2023-11-29 02:11:51 来自APP | 只看该作者
全局:
更新一下ChatGPT给出的回答。

Certainly! Let's go through a mock interview for designing an image classification system at a large scale.

Interviewer: "How would you design an image classification system at large scale?"

Candidate:
1. **Clarify the Problem:**
   - Candidate: "Certainly, could you provide more details about the specific requirements for the image classification system? For example, the types of images, expected accuracy, and any constraints on latency or resources?"

Interviewer: "We are looking to classify diverse images, ranging from everyday objects to complex scenes. We aim for high accuracy, and low latency is crucial for real-time applications."

2. **Define Goals and Metrics:**
   - Candidate: "Great. To ensure we're aligned on goals, the primary objective is high accuracy. For metrics, we can use a combination of precision, recall, and possibly F1 score. Does that align with your expectations?"

Interviewer: "Yes, that sounds good."

3. **Understand the Data:**
   - Candidate: "I'd like to understand the characteristics of our image data. Could you provide insights into the volume of data, the distribution of classes, and any challenges with the data quality?"

Interviewer: "We have a large dataset with millions of images, diverse classes, and some classes have more examples than others. There might be noise in the data, and some images might be low-quality."

4. **Choose Model(s):**
   - Candidate: "Given the scale and diversity of the data, I would suggest using a deep learning architecture, such as a convolutional neural network (CNN). This can effectively capture hierarchical features in images. We can explore models like ResNet or EfficientNet for their proven performance."

Interviewer: "Sounds reasonable. Go on."

5. **Data Preprocessing:**
   - Candidate: "In terms of preprocessing, we'll need to handle data augmentation to enhance model generalization. Additionally, we should normalize pixel values and address any issues with image sizes. How do you feel about this approach?"

Interviewer: "Agreed. Proceed."

6. **Feature Engineering:**
   - Candidate: "Considering we're using deep learning, extensive manual feature engineering may not be necessary. However, we could explore transfer learning by leveraging pre-trained models on large datasets like ImageNet. This could save training time and improve performance. What do you think?"

Interviewer: "That makes sense. Continue."

7. **Model Training:**
   - Candidate: "For model training, we'll split the dataset into training, validation, and test sets. We'll use techniques like learning rate schedules and early stopping to optimize training. To handle the large scale, we might consider distributed training using tools like TensorFlow's Distribution Strategy or PyTorch's DataParallel."

Interviewer: "Good approach. Keep going."

8. **Evaluation:**
   - Candidate: "Once the model is trained, we'll evaluate its performance on the test set using our defined metrics. If needed, we can fine-tune hyperparameters for better results. We'll be vigilant about potential overfitting and take steps to address it."

Interviewer: "Sounds thorough. What's next?"

9. **Deployment:**
   - Candidate: "For deployment, we'll encapsulate the model in a scalable and efficient serving infrastructure, possibly using a containerization tool like Docker. We can deploy on cloud services like AWS or GCP, ensuring autoscaling for handling variable workloads. API endpoints can be set up for real-time predictions."

Interviewer: "Good. How about monitoring and maintenance?"

10. **Monitoring and Maintenance:**
    - Candidate: "For ongoing maintenance, we'll implement a robust monitoring system. This involves tracking model performance, detecting concept drift, and addressing issues promptly. Regular model updates, possibly with retraining schedules, will keep the system adaptive to evolving data patterns."

Interviewer: "Impressive. Summarize your approach."

11. **Conclusion:**
    - Candidate: "In summary, I propose using a deep learning architecture like ResNet or EfficientNet, leveraging transfer learning for efficiency. Data preprocessing and augmentation will be crucial, along with distributed training for scalability. Deployment on cloud services with efficient monitoring and maintenance will ensure a reliable and adaptable image classification system at large scale."

Interviewer: "Thank you for your detailed approach. Any final thoughts?"

12. **Closing:**
    - Candidate: "I appreciate the opportunity to discuss this design. If there are any specific areas you'd like me to dive deeper into or if you have additional questions, I'm here to address them."

This mock interview covers the key aspects of designing an image classification system at large scale, showcasing the candidate's understanding of the problem and their systematic approach to addressing it.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表