針對以下面試系統設計問題做一個完整個回答規劃 Design a next word prediction system. Requirements of the system:…
- User
針對以下面試系統設計問題做一個完整個回答規劃 Design a next word prediction system. Requirements of the system:
latency language modality (assume keyboard typing) availability of data (assume cold start) success metric (accuracy of next word predicted?, or minimize false positives? -> accuracy to start) Data collection and processing: design ethical user experiments to collect typed out data design a simple tokenization strategy (word level encoding, character level encoding, byte-pair encodings, and discuss tradeoffs) collect data, and split into training/testing data for cross validation Modeling: start simple with a n-gram word model predicting the next token given the previous n tokens. go towards more state of the art modeling with a Transformer encoding-only model. The transformer will consist of positional and token encodings, and then multi-head attention followed by multi-layer perceptrons. The model is trained using next-token prediction given a corpus of data from users with a self-supervised learning setup. Each batch of text will essentially consist of context-size number of training examples, since each prior set of tokens will be used to predict the next token with up to "context-size" number of tokens. Evaluation and deployment Now, we will consider how the model operates on a held out test dataset, and based on our metric of success, see if additional data, or fine-tuning is needed. Now, we will need to deploy the system in a real-time setting, so we will need to deploy an API, possibly quantize the model, or convert the model to a more efficient format (e.g. Onnx) We can deploy a simple REST API with polling from the client, or establish a websocket for bidirectional communication between the client and our server. Monitoring and scaling here we will monitor the model in production, and track how accurate, or how many false positives there are, and also latency. Based on number of users and latency, we can scale the system appropriately either via vertical, or horizontal scaling. We can use automated services such as AWS autoscaling, and Grafana for logging and monitoring the system Given additional data collected from users, we can test and retrain the system periodically and upgrade the model. We can establish a version control system for the model and data used to train the model
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.