查看: 769| 回复: 3
跳转到指定楼层
上一主题 下一主题
收起左侧

[跳槽] OpenAI疑似从没见过的新题

🔗
匿名用户-QPNT1  | 添加认证 | 4 小时前 来自APP |倒序浏览

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
[Blind上看到的,大家自行判断]
.. Resumable Versioned Key-Value Store.google  и

. ΧYou're building an in-memory key-value store used by a distributed training job to checkpoint model metadata.

Part 1. Implement set(key, value, timestamp) and get(key, timestamp). get returns the value that was set at the closest timestamp at or before the given timestamp. Timestamps are strictly increasing per key, but writes may arrive out of order due to network delay, and your store should handle that gracefully.

. 1point 3 acresPart 2. Add get_latest(key), which returns the most recent value. "Most recent" means the value with the highest timestamp, unless a newer write has been received, in which case it should reflect what the client most recently intended.

Part 3. The store must be serializable so a crashed job can resume. Implement serialize() and deserialize(). A deserialized store must behave identically to the original, including for any writes that were in flight at serialization time.

Part 4. Values are immutable once read. If get returns a value, any later set for that key at an earlier timestamp should be rejected. However, backfilling historical data must still be supported.

Constraints: All operations O(1). Memory usage should not grow with the number of versions. Thread-safe, though you may assume single-threaded access. If a key doesn't exist, return None or raise, whichever is consistent with Part 4.
. Waral dи,
Follow-up: How would you scale this to 10,000 GPUs?

评分

参与人数 1大米 +1 收起 理由
开心的猪 + 1 给你点个赞!

查看全部评分


上一篇:分享我加入Fireworks AI的一些思考
下一篇:网飞team match永无天日
地里匿名用户
🔗
匿名用户-QBMNV  | 添加认证 | 3 小时前
我自己瞎想的.
先不考虑scale 问题。
构造一个 Hash Table, key就是key, value部分是一个double linked list, 按照timestamp 排序,大的在最开始。如果插入比第一个list node相同或更早timestamp的记录就拒绝。
..
“but writes may arrive out of order due to network delay, and your store should handle that gracefully.” 是什么意思?timestamp小的如果后到,那么被拒绝是合理的吗?

这两个结构都是serializable的。

没有解决的问题是,如何做到o(1) get key/timestamp. 遍历timestamp的double linked list需要o(k), 不知道是否算o(1). 也可以加指针map,指示double linked list 中若干节点位置,快速找到起始点,开始搜索 (简单点就是维护头尾中三个点的指针)。这还是不能保证完全o(1). 这个需求要clarify
另外,Memory usage should not grow with the number of versions. 是什么意思?存多个版本而不增加内存,显然不合理,是不是有误会,需要进一步理解一下需求。

如果解决了这个问题,那么下一步就是scale, 那么consistent hashing加多台服务器走起,开始envolpe计算。“scale this to 10,000 GPUs”是不是有问题?这个key/value不是gpu的活, 没有矩阵乘法啊?. 1point 3 acres
.google  и
Hashtable 太重的话,用hashmap + redis 做key级别的访问锁, 或者用concurrentHashMap
.--
抛砖引玉
回复

使用道具 举报

全局:
这是system design还是coding?
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-LD3WM  | 添加认证 | 2 小时前
请问这题看到是New Grad的吗?还是在职的?他们家这在职和new grad 的coding题库挺不一样的。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
职场达人
  • ↑ 本版用于讨论职场各种干货话题,闲聊请去🔗聊聊或者🔗匿名版
  • ❌ 本版严禁水贴,引战,发布广告,拉群,贴个人联系方式,扣分无警告
  • ☑ 求职、面经等去 🔗北美求职和 🔗回国求职大区,刷题和学习请去 🔗终身学习大区
  • ☑ 请去专版发布 🔗内推, 🔗招聘信息,和讨论 🔗创业内容
  • ☑ PIP / DevList/ Need Support 等话题也已开设 🔗专版

本版积分规则

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