AI-as-a-Service on Blockchain
�Steve Liao
12小時前寫完的code大家已經在用了:�
FinTech 世界:All-time, All-place, All-provider: �高度競爭,用code 改變世界者的世界。
不再是“有想法,沒辦法”的世界
文化最重要:�做中學 玩真的: Tech�跨領域: Fin
廖世偉博士
General AI vs. Specific AI
AlphaGo
AlphaGo experience is General AI
AlphaGo of 2016 vs. Deep Blue of 1997
AlphaGo experience is General AI
母雞帶小雞
Agenda
Our 理財機器人
Our 理財機器人
理財機器人’s trends: Chatbot and 深度理財
Chatbot
12
Every business should have an APP
Every business should have a APP
Chatbot
#1 Access the 1 billion users platform
Over 1 billion users
Over 220 million MAU
67 % said they expect to message with business in next 2 years
53 % said they are more likely to buy with a business they can message directly
#2 Everyone hates the bothersome navigations
83% think it’s hard to find what they want efficiently in the bank website
Hi, I’d like to apply for a credit card
Dear Kevin, here is the application form for you.
Please fill in and return to us.
#3 Everyone needs a personalized service
Pros:
Cons:
Chat Platforms
Facebook, Line, SMS…
Natural Language Understanding
Cooperate with
Bank API
Natural Language Generation
Our AI Technology
“How much can I spend on my credit card?”
Intent: “ASK QUOTA”
Quota: $200
Hi David, you have $200 to spend before 1st Dec. Happy to organize a credit limit.
Demo
19
深度學習 for 理財機器人
20
深度理財 Outline
21
深度理財 Outline (cont.)
22
Price Prediction
23
OLMAR Introduction
24
100% Return Rate Possible?
25
Portfolio Selection & Online Learning
26
Problem Formulation (1/3)
27
Problem Formulation (2/3)
28
Problem Formulation (3/3)
29
Related Work (1/2)
30
Related Work (2/2)
[2]: Bin Li. Passive Aggressive Mean Reversion
[3]: Bin Li. Confidence Weighted Mean Reversion
31
Methodology-OLMAR (1/8)
[4]: Bin Li. On-Line Portfolio Selection with Moving Average Reversion. 2012
32
Methodology-OLMAR (2/8)
33
Methodology-OLMAR (3/8)
x˜(t+1, w) = MAt (w)/p(t) = 1/w*(p(t)/p(t) + p(t−1)/p(t) +···+ p(t−w+1)/p(t)) = 1/w(1 + 1/x(t) +···+ 1/⊗(w−2, i=0)*x(t−i))
34
Methodology-OLMAR (4/8)
[5]: Crammer, K. Online passive-aggressive Algorithms
35
Methodology-OLMAR (5/8)
36
Methodology-OLMAR (6/8)
[6]: J. Duchi. Efficient projections onto the l1-ball for learning in high dimensions. In ICML’2008
37
Methodology-OLMAR (7/8)
λ(t+1) = max{0, ϵ − (b(t)*x˜(t+1))/(∥x˜(t+1)−x¯(t+1)*1∥^2)}.
38
Methodology-OLMAR (8/8)
39
Methodology-RNN (1/3)
�from: http://colah.github.io/posts/2015-08-Understanding-LSTMs/
40
Methodology-RNN (2/3)
from: http://colah.github.io/posts/2015-08-Understanding-LSTMs/
41
Methodology-RNN (3/3)
42
Methodology-Combined (1/2)
43
Methodology-Combined (2/2)
44
Insight
45
Experiments
46
Experiment (Data Description)
47
Dataset | Region | Time frame | # days | # assets |
NYSE(O) | US | 3/7/1962 - 31/12/1984 | 5651 | 36 |
NYSE(N) | US | 1/1/1985 - 30/6/2010 | 6431 | 23 |
DJA | US | 1/1/2001 - 14/1/2003 | 507 | 30 |
TSE | CA | 4/1/1994 - 31/12/1998 | 1259 | 88 |
Experiment (Platform)
48
Experiment (Result trail #1 1/3)
Dataset: NYSE(O)
FAIL! Because the given features are not strong enough to give the exact price prediction
49
Experiment (Result Trial #2 2/3)
Dataset: NYSE(O)
50
Algo. | Final wealth | Annualized return | Sharpe ratio | Winning days |
BAH | 14.211138 | 12.56% | 0.8 | 51.8% |
CRP | 26.677763 | 15.77% | 1.09 | 53.5% |
OLMAR | 7.656836e+16 | 466.14% | 3.14 | 58.3% |
OLMAR+RNN | 1.689423E+17 | 486.48% | 3.20 | 58.5% |
Experiment (Result Trial #2 3/3)
Dataset: NYSE(N)
51
Algo. | Final wealth | Annualized return | Sharpe ratio | Winning days |
BAH | 18.230572 | 12.05% | 0.63 | 53.5% |
CRP | 31.823353 | 14.52% | 0.7 | 54.6% |
OLMAR | 4.209890e+08 | 117.74% | 1.39 | 55.0% |
OLMAR+RNN | 1.144887e+09 | 126.45% | 1.45 | 55.2% |
Experiment (appendix)
Parameters for LSTM with 14 epoches
Around 2 Hrs on training
52
More Applications
53
Future Work
54
Summary of 深度理財
55
AI-as-a-Service Edge Platform (Cognitive Edge Platform) on Blockchain Platform
57
Blockchain Platform for Cognitive Edge Computing
Edge Computing for IoT devices
Edge Computing for IoT devices
58
cloud server
devices
data consumers
Cloud Computing
IoT devices
data producers & consumers
cloud server
Cloud Computing for IoT
cloud server
IoT devices
Edge
device
IoT devices
Edge
device
IoT devices
Edge
device
data producers & consumers
Edge Computing for IoT
Edge Devices in Edge Computing
59
cloud server
IoT devices
Edge
device
IoT devices
Edge
device
IoT devices
Edge
device
Collaborative Edge
60
cloud server
IoT devices
Edge
device
IoT devices
Edge
device
IoT devices
Edge
device
Collaborative
Edge
Edge
device
Edge
device
Edge
device
by predefined API protocol between edge devices
Example:
Hospital
Pharmacy
Government
Financial
Fire dept.
Rescue system
W. Shi, J. Cao, Q. Zhang, Y. Li and L. Xu, "Edge Computing: Vision and Challenges," in IEEE Internet of Things Journal, vol. 3, no. 5, pp. 637-646, Oct. 2016.
61
Blockchain Platform for Cognitive Edge Computing
Cognitive Edge Computing
Deep Learning (Example: Google FaceNet)
62
Deep
Learning
inference
models
models
Alan
Betty
Adam
Barbara
Alan
Betty
Adam
Barbara
967A48
01A611
9B3400
96B259
967A48 = Alan
01A611 = Adam
983400 = Betty
96B259 = Barbara
Face Feature Vector List
C91369
97C467
?
?
C91369 = Carrie
97C467 = Carl
(register new records )
(New Faces)
Carrie
Carl
Carrie
Carl
Deep Learning in Cognitive Edge Computing
63
Cloud server
Cloud server
IoT
device
Edge device
Cloud server
IoT
device
inference
models
Incremental
learning
Incremental
models
Incremental
models
Data
De-identification
De-identified
data for learning
inference
models
deep
learning
models
models
deep
learning
models
raw data
for learning
Face
(family and friends)
Personal information
(calendar, contact..)
Medical data
Geography info
(house, office,..)
Example of Model Size (Google FaceNet)
64
Incremental Learning
on Edge Device
| Resource for learning | Learning Time | Model size |
Deep Learning on the Cloud | Not reduced:
Reduced in size
| ~ 700 hour | Models:
|
Incremental Learning on Edge devices | Incremental Learning: (Personal Photo test)
(NNS2 tiny Inception model) | Incremental Learning: (Personal Photo test) 30ms per image on smartphone | Incremental Models: (only face feature vector)
|
REF: Florian Schroff, Dmitry Kalenichenko, James Philbin, “FaceNet: A Unified Embedding for Face Recognition and Clustering” in Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition 2015. Cite as: arXiv:1503.03832 [cs.CV] (or arXiv:1503.03832v3 [cs.CV] for this version), Submitted on 12 Mar 2015 (v1), last revised 17 Jun 2015 (this version, v3), https://arxiv.org/pdf/1503.03832v3.pdf
Collaborative Edge in Cognitive Edge Computing
65
Collaborative
Edge
Cloud server
deep
learning
models
Edge device
Incremental
models
IoT
devices
Human
Resource
Access
Control
IoT
devices
IoT
devices
Surveillance
Incremental
learning
Edge device
Incremental
models
IoT
devices
Human
Resource
Access
Control
IoT
devices
IoT
devices
Surveillance
Incremental
learning
Edge device
Incremental
models
IoT
devices
Guest
Access
Control
IoT
devices
IoT
devices
Surveillance
Incremental
learning
HQ
Oversea Branch
Hotel
Example :
Collaborative Edge for a Company
66
Company HQ
CEO
RD
OP
HR
Manager
MKT
Visitor
Visitor
Oversea Branch
Hotel
Company Guest
Regular Guest
Valid until
2016/10/30
Valid until
2016/10/30
Delete after check-out
Requirement for cognitive edge computing
67
Require a method to management “incremental models” among edge devices
De-centralized, Secure, Traceable, Immutable, Efficient, Flexible for configuration
Edge Computing
offload cloud server in IoT era
Edge
Edge
Edge
cloud
Collaborative Edge
edge devices share information peer-to-peer
Edge
Edge
Edge
cloud
Cloud
deep
learning
models
IoT
devices
raw data
Deep Learning on Cloud
models generated on cloud
Cloud
Deep
learning
models
Incremental
learning
Incremental
models
Edge
IoT
devices
Incremental Learning
Incremental models gen. on edge
68
Blockchain Platform for Cognitive Edge Computing
Blockchain as de-centralized database
Brief introduction to Blockchain
“Bitcoin: A Peer-to-Peer Electronic Cash System”
(Economist 2015-10-31)
(Wall Street Journal 2015-1-25)
(World Economic Forum, Davos 2016)
69
Blockchain
70
Immutable
Security
Transaction
is Settlement
Traceable
Ver.
How a �Blochchain�Works
71
Source: Financial Times
are resource can
be transferred
How blockchain keeps records Immutable
72
Block Header
Hash
Previous Block Header Hash: A hash in internal byte order of the previous block’s header. This ensures no previous block can be changed without also changing this block’s header.
Merkle Root Hash: The merkle root is derived from the hashes of all transactions included in this block, ensuring that none of those transactions can be modified without modifying the header.
Target nBit: An encoded version of the target threshold. This block’s header hash must be less than or equal to.
Nonce: An arbitrary number miners change to modify the header hash in order to produce a hash below the target threshold‧
txn_count: The total number of transactions in this block
Txns: Every transaction in this block, one after another, in raw transaction format.
Block Header Hash
Hash of Block Header
Block Header Hash
Hash of Block Header
Magic No.
Block Header
Time
Target
nBits
Nonce
Txns
raw
transactions
Block n
Block Size
Previous
Block
Header
Hash
Merkle
Root
Hash
txn_count
Magic No.
Block Header
Time
Target
nBits
Nonce
Txns
raw
transactions
Block (n+1)
Block Size
Previous
Block
Header
Hash
Merkle
Root
Hash
txn_count
Ver.
Ver.
What kind of Trust Machine is it?
73
Decentralized
Trust Machine
Security
Immutable
Shared
Inspectability
Anonymous
Irreversible
Trust Machine
supports
State machine-based immutable decentralized Trust Machine
74
state
state
state
utxo
utxo
utxo
utxo
utxo
utxo
utxo
utxo
utxo
utxo
utxo
utxo
utxo
utxo
utxo
utxo: unspent transaction output
How the Internet and blockchain both work. Ledger is synchronized by “full” (red) nodes.
75
Blockchain Platform for Cognitive Edge Computing
Gcoin Blockchain
Consortium/Permissioned Blockchain
76
Source: Financial Times
Gcoin Blockchain
77
Multi-tier multi-centered | • Gcoin adopts permissioned blockchain and a multi-role structure • ‘G’ represents ‘Governance’ and ‘Global,’ �• Multi-role in Gcore network. ◇ Alliance is responsible for mining and creating blocks. Alliance member has the power to license issuers. ◇ Issuers have the power to issue currencies/coins/tokens. ◇ Users can use one or more currencies/coins/tokens. |
Multicurrency | • Multiple currency/coin/token can coexist on Gcoin network. • Minting cap for a single currency/coin/token is 10 to the power of 10 (10^10). |
Smart Contact | • Gcoin provides smart contract capability, a simple stack-based script in transactions. • Unlike Bitcoin, Gcoin allows more flexibility for its customers. |
Improve block creation time | • Gcoin's 15 second block creation time increase tps (transactions per second) substantially. • Block is only created when there is a transaction. No block is created when there is no transaction. |
Avoid “51% attack” | • Previous Bitcoin blockchain uses Proof-of-Work (POW). If a single node contributed the majority of mining power (>=51%), it can manipulate the blockchain. • Gcoin blockchain can increase mining difficulty of the nodes that successful mining frequently to avoid those nodes to dominate blockchain. |
78
Alliance
full node
full node
full node
full node
full node
Alliance
79
Alliance
issuer
issuer
full node
full node
full node
Alliance
80
alliance
member
alliance
member
alliance
member
81
alliance
member
alliance
member
alliance
member
issuer
issuer
issuer
issuer
82
alliance
member
alliance
member
alliance
member
issuer
issuer
issuer
issuer
member
member
member
member
member
member
member
member
member
member
member
member
83
Blockchain Platform for Cognitive Edge Computing
Gcoin Blockchain Platform
for Edge Computing
Gcoin Blockchain Platform for Edge Computing
84
Edge Computing
Management
Gcoin
Blockchain
Management
Token: resource records
Smart contact : resource handling
85
Hospital2
Government
Alliance Member
Medical
Alliance Member
Rescue system
Alliance Member
Approval process
Token Issuer
Financial
Token Issuer
Rescure resource
Token Issuer
Medical resource
Token Issuer
Ministry of
Finance
City1
Finanal Dept.
City3
Finanal Dept.
Ministry of
Health and
Welfare
Hospital1
Hospital3
Central
Gov.
City3 Gov
City1 Gov.
Fire
System
Military
System
Police
System
City2 Gov
City2
Finanal Dept.
Collaborative Edge Devices
Gcoin Blockchain Platform for a Government
86
Collaborative Edge Devices
Company Management
Alliance Member
Human Resource
Alliance Member
Supply Chain Alliance Member
Approval process
Token Issuer
Financial Token Issuer
Supply Chain Management
Token Issuer
Employee Management
Token Issuer
Financial
Accounting
Business Units
Human
Resource
Access Ctrl
Business
Units
Excutive
Legal
Business
Units
Production
MKT/Sales
Warehousing
Face
Token
Gcoin Blockchain Platform for a Company
“Face Token”
87
Company HQ “wallet”
CEO
RD
OP
HR
Manager
MKT
Visitor
Visitor
Oversea Branch “wallet”
Hotel “wallet”
Company Guest
Regular Guest
Valid until
2016/10/30
Valid until
2016/10/30
Delete after check-out
“Smart contact”
of Gcoin blockchain
to handle management
Use Token management for collaborative Edge devices management
Gcoin Blockchain as Platform for Cognitive Edge Computing
88
Gcoin Blockchain Platform
Edge Computing
offload cloud server in IoT era
Edge
Edge
Edge
cloud
Collaborative Edge
edge devices share information peer-to-peer
Edge
Edge
Edge
cloud
Cloud
deep
learning
models
IoT
devices
raw data
Deep Learning on Cloud
models generated on cloud
Cloud
Deep
learning
models
Incremental
learning
Incremental
models
Edge
IoT
devices
Incremental Learning
Incremental models gen. on edge
Summary of Blockchained AI
89
數位經濟美麗新世界的展示
區塊鏈點數平台
帳聯網 API
數字資產交易平台
區塊鏈:點數管理平台及交易平台
GCOIN 區塊鏈使用情境
私募平台
票據平台
去中心化交易所
crowdsourcing平台
顧客忠誠計劃
支付結算系統
95
THANK YOU!
Blockchain Platform for Cognitive Edge Computing
Blockchain: �State-Machine based Trust Machine
Remember: blockchain machine is Mathematics-�based:
You don’t need to trust it:
Trust Machine vs. Trust Company
What kind of Trust Machine is it
Blockchain’s key technology: State-Machine based immutable Trust Machine
Data structure of Blockchain
Block Header
Hash
Previous Block Header Hash: A hash in internal byte order of the previous block’s header. This ensures no previous block can be changed without also changing this block’s header.
Merkle Root Hash: The merkle root is derived from the hashes of all transactions included in this block, ensuring that none of those transactions can be modified without modifying the header.
Target nBit: An encoded version of the target threshold. This block’s header hash must be less than or equal to.
Nonce: An arbitrary number miners change to modify the header hash in order to produce a hash below the target threshold‧
txn_count: The total number of transactions in this block
Txns: Every transaction in this block, one after another, in raw transaction format.
Block Header Hash
Hash of Block Header
Block Header Hash
Hash of Block Header
Magic No.
Block Header
Time
Target
nBits
Nonce
Txns
raw
transactions
Block n
Block Size
Previous
Block
Header
Hash
Merkle
Root
Hash
txn_count
Magic No.
Block Header
Time
Target
nBits
Nonce
Txns
raw
transactions
Block (n+1)
Block Size
Previous
Block
Header
Hash
Merkle
Root
Hash
txn_count
“Mining” Blockchain (Proof-of-Work)
Previous
Block
Header
Hash
Block Header
Previous
Block
Header
Hash
Block Header
Previous
Block
Header
Hash
Block Header
Block n
Block Header Hash
Block (n-1)
Block Header Hash
Block (n-2)
Block Header Hash
Block Header Hash
Current Blockchain
New Block (n+1)
Block Header Hash
< Target nBits ?
Set
new
Nonce
value
No
Yes
Successful Mining
Magic No.
Block Header
Time
Target
nBits
Nonce
Txns
raw
transactions
Block (n+1)
Block Size
Previous
Block
Header
Hash
Merkle
Root
Hash
txn_count
Hash of Block Header
Distributed Mined Blockchain to Peer
A
B
C
D
E
F
G
H
Block (n+1)
Successful Mining
Arriving at Consensus�
101
Model Distribution (1) for Cloud Server
102
Peer-to-peer download
Centralized download
Cloud Server
Edge
Device
G
Edge
Device
H
Edge
Device
D
Edge
Device
E
Edge
Device
I
Edge
Device
A
Edge
Device
B
Edge
Device
F
Edge
Device
C
models
Cloud Server
Edge
Device
G
Edge
Device
H
Edge
Device
D
Edge
Device
E
Edge
Device
I
Edge
Device
A
Edge
Device
B
Edge
Device
F
Edge
Device
C
models
Model Distribution (2) for Edge Device
103
Cloud Server
Edge
Device
G
Edge
Device
H
Edge
Device
D
Edge
Device
E
Edge
Device
I
Edge
Device
A
Edge
Device
B
Edge
Device
F
Edge
Device
C
Incremental
models
Cloud Server
Edge
Device
G
Edge
Device
H
Edge
Device
D
Edge
Device
E
Edge
Device
I
Edge
Device
A
Edge
Device
B
Edge
Device
F
Edge
Device
C
Incremental
models
Peer-to-peer download
Centralized download
105
Backup Slides