AI Research from Apple, System Design for Online Banking and More
🎬 S2:E04 Open Source AI, Online Banking Systems
Hey, TechFlixers!
Can you guess which programming language was named after a comedy show? Find out at the end of this newsletter.
🔦 Spotlight
📢 OpenELM
OpenELM represents a significant leap forward in the development of language models that are both open-source and highly efficient. Developed by a team at Apple, this model introduces a layer-wise scaling strategy within the transformer architecture, enhancing its parameter efficiency and accuracy.
Layer-Wise Scaling: Unlike traditional models that uniformly distribute parameters across all layers, OpenELM employs a strategic allocation of parameters. This results in varying configurations across different layers of the model, optimizing the use of parameters and significantly boosting model performance.
Efficiency in Data Usage: OpenELM achieves superior accuracy with far less pre-training data. For instance, it outperforms its predecessors like OLMo by 2.36%, using half as many pre-training tokens.
Open-Source Framework: One of the most commendable aspects of OpenELM is its commitment to transparency. The model and its training logs, pre-trained weights, and recipes are fully open-source.
If you want to train your own LLM from scratch, OpenELM could be one of your latest starting points to explore.
Other interesting reads
☕️ Tea Time
News you might have missed
American Express is opening a new office in Gurugram. It’s their largest office globally.
Llama 3 and Phi-3 are the latest open-weight LLM models in the market. You can access them for free via HuggingChat.
Who’s Hiring?
Multiple LinkedIn posts show that Capital One is hiring in their India office across all levels. At the time of writing this, their career page shows 24 open positions in Bangalore.
According to various campus hiring sources and Leetcode, Capital One offers a base salary of 24 LPA for freshers in India.
🚀 Power Up
Since Capital One is hiring, let’s concisely focus on a system design question that has previously appeared in their interview process.
Online Banking System
Requirements
Functional
User management (sign-up, login, logout)
Account creation and management
Deposit and withdrawal of funds
Transfer of funds between accounts
Balance inquiry
Account statement generation
Non-Functional
High availability and reliability
Secure transactions with end-to-end encryption
Scalability to handle a large number of concurrent users
Responsive design for both web and mobile platforms
System Design
Architecture
Frontend: A user interface built with ReactJS (NextJS) or Angular for the web and React Native or Flutter for mobile apps.
Backend: RESTful API designed in Node.js or Java Spring Boot.
Database: SQL database like PostgreSQL for transactional data. NoSQL database like MongoDB for logs and non-transactional data.
Security: Implement OAuth for authentication, HTTPS for secure communication, and AES for data encryption.
API Endpoints
/accounts
: POST for creating accounts, GET for retrieving account details./transactions
: POST for initiating transactions, GET for viewing transaction history./transfer
: POST for transferring funds between accounts./balance
: GET for current balance inquiry./statement
: GET for generating monthly account statements.
Data Model
User Table: Contains user_id, username, password_hash, email, and phone_number.
Account Table: Contains account_id, user_id, account_type, and balance.
Transaction Table: Contains transaction_id, account_id, type (deposit, withdrawal, transfer), amount, and timestamp.
Security Considerations
Use secure protocols like TLS (a secure communication protocol) for all data transmission.
Store only hashed passwords in the database.
Regularly audit and update security protocols to defend against new vulnerabilities.
Scalability and Performance Enhancements
Use load balancers to distribute client requests evenly across servers.
Implement caching using Redis for frequently accessed data like account balances.
Employ a microservices architecture to isolate and scale different functionalities independently.
Follow-Up Questions
How would you handle transaction rollbacks in case of a system failure during a fund transfer?
Use of Database Transactions: Implement atomic transactions in the database. This ensures that all operations within a transfer (debit from one account and credit to another) either complete successfully together or fail together without affecting the database state. Most relational databases support ACID (Atomicity, Consistency, Isolation, Durability) properties that make this feasible.
Implementation of a SAGA Pattern: For more complex scenarios where transactions span multiple services or databases, employ the Saga pattern. This involves breaking the transaction into a series of local transactions, each followed by a compensating transaction if a subsequent step fails. A compensating transaction is a way to undo the changes made by a previous operation. This ensures consistency without locking the database for long periods. To explore the SAGA pattern more, check this article.
Logging and Monitoring: Maintain detailed logs of all transactions and states so that these logs can be used to roll back to the last consistent state in the event of a failure. Monitoring systems can trigger alerts if a failure occurs, prompting immediate manual or automated recovery actions.
What strategies would you implement to prevent fraud and unauthorized access in this online banking system?
Multi-Factor Authentication (MFA): Require more than one form of verification for user access, especially for high-value transactions. This could include:
OTP
Auth Tokens
Biometrics
Fraud Detection Algorithms: Implement machine learning algorithms that detect unusual patterns indicative of fraudulent activities. For instance, an unusually large transaction or an access attempt from a geographically anomalous location could trigger additional security checks, or temporary account freezes.
Role-Based Access Control (RBAC): Limit access to sensitive information and capabilities based on the user's role within the system.
Note that this is one feasible approach, as is the case with any system design. You can swap out any module with different tech stacks or ideas as feasible.
📨 Post Credits
And the answer to our opening riddle: The programming language named after a comedy show is 'Python,' inspired by 'Monty Python’s Flying Circus’—a BBC comedy series from the 1970s!
Fin.