Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
How we built an AI code reviewer with serverles...
Search
Yan Cui
February 12, 2025
Technology
0
68
How we built an AI code reviewer with serverless and Bedrock
Slides for my talk at the Serverless London meetup on 12-Feb-2025
Yan Cui
February 12, 2025
Tweet
Share
More Decks by Yan Cui
See All by Yan Cui
Money-saving tips for the frugal serverless developer (AWS Community Summit)
theburningmonk
1
150
Money-saving tips for the frugal serverless developer
theburningmonk
1
720
Why the fuzz about serverless (with CompassDigital)
theburningmonk
0
95
Money-saving tips for the frugal serverless developer
theburningmonk
0
85
Efficient patterns for serverless development (AWS Summit London)
theburningmonk
0
110
7 ways to solve Lambda cold starts
theburningmonk
0
52
Saving Money on Serverless: Common Mistakes and How to Avoid Them
theburningmonk
0
46
3 Ways to Improve Serverless Performance
theburningmonk
0
37
Smart and efficient ways to test serverless architectures
theburningmonk
1
280
Other Decks in Technology
See All in Technology
TAMとre:Capセキュリティ編 〜拡張脅威検出デモを添えて〜
fujiihda
2
240
人はなぜISUCONに夢中になるのか
kakehashi
PRO
6
1.6k
プロダクトエンジニア構想を立ち上げ、プロダクト志向な組織への成長を続けている話 / grow into a product-oriented organization
hiro_torii
1
170
開発スピードは上がっている…品質はどうする? スピードと品質を両立させるためのプロダクト開発の進め方とは #DevSumi #DevSumiB / Agile And Quality
nihonbuson
2
2.9k
モノレポ開発のエラー、誰が見る?Datadog で実現する適切なトリアージとエスカレーション
biwashi
6
800
ビジネスモデリング道場 目的と背景
masuda220
PRO
9
520
Goで作って学ぶWebSocket
ryuichi1208
0
160
PHPカンファレンス名古屋-テックリードの経験から学んだ設計の教訓
hayatokudou
2
260
Amazon S3 Tablesと外部分析基盤連携について / Amazon S3 Tables and External Data Analytics Platform
nttcom
0
130
2024.02.19 W&B AIエージェントLT会 / AIエージェントが業務を代行するための計画と実行 / Algomatic 宮脇
smiyawaki0820
13
3.3k
Data-centric AI入門第6章:Data-centric AIの実践例
x_ttyszk
1
400
分解して理解する Aspire
nenonaninu
1
110
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
298
20k
YesSQL, Process and Tooling at Scale
rocio
172
14k
Building Your Own Lightsaber
phodgson
104
6.2k
Building a Scalable Design System with Sketch
lauravandoore
461
33k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
550
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1k
Facilitating Awesome Meetings
lara
52
6.2k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.3k
Transcript
How we built an AI Code Reviewer with Serverless and
Bedrock
Yan Cui http://theburningmonk.com @theburningmonk AWS user since 2010
Yan Cui http://theburningmonk.com @theburningmonk running serverless in production since 2016
Developer Advocate @ Yan Cui http://theburningmonk.com @theburningmonk
Yan Cui http://theburningmonk.com @theburningmonk independent consultant
None
evolua.io Demo
Architecture
API Gateway EventBridge Webhook
API Gateway DynamoDB Bedrock EventBridge Webhook
API Gateway DynamoDB Bedrock EventBridge Webhook
API Gateway DynamoDB Bedrock EventBridge Webhook evolua.io
None
API Gateway DynamoDB Bedrock EventBridge Webhook AppSync evolua.io
API Gateway DynamoDB Bedrock EventBridge Webhook AppSync evolua.io
None
API Gateway DynamoDB Bedrock EventBridge Webhook AppSync evolua.io Authoriser
API Gateway DynamoDB Bedrock EventBridge Webhook AppSync evolua.io Authoriser
API Gateway DynamoDB Bedrock EventBridge Webhook AppSync evolua.io Authoriser
API Gateway DynamoDB Bedrock EventBridge Webhook AppSync evolua.io Authoriser
API Gateway DynamoDB Bedrock EventBridge Webhook AppSync evolua.io Authoriser
Challenges (for an AI code reviewer) Handling sensitive data for
customers
Challenges (for an AI code reviewer) Large fi les. Large
PRs with many fi les. Handling sensitive data for customers
Why Bedrock?
Security
Security Data is encrypted at rest.
www.wiz.io/blog/wiz-research-uncovers-exposed-deepseek-database-leak
aws.amazon.com/bedrock/faqs
Security Data is encrypted at rest. Inputs & Outputs are
not shared with model providers. Inputs & Outputs are not used to train other models.
API Gateway DynamoDB Bedrock EventBridge Webhook AppSync evolua.io Authoriser Fallback
Primary
privacy.anthropic.com/en/articles/7996885-how-do-you-use-personal-data-in-model-training
Serverless
Serverless Usage-based AND provisioned throughput pricing
None
None
1M Input Tokens 1M Output Tokens $0.14 v3 r1 $0.28
$0.55 $2.19 Sonnet $3.75 $15.0 Haiku $0.80 $4.00
Very cost ef fi cient!
Very cost ef fi cient! Data is stored in China.
Very cost ef fi cient! Data is stored in China.
Data might be used to train other models.
www.wiz.io/blog/wiz-research-uncovers-exposed-deepseek-database-leak
Very cost ef fi cient! Data is stored in China.
Data might be used to train other models. Operationally immature.
None
No token-based pricing yet
No token-based pricing yet “GPU-based instance type like ml.p5e.48xlarge is
recommended”
ml.p5e.48xlarge 💰💰💰💰💰💰💰💰💰💰 💰💰💰💰💰💰💰💰💰💰 💰💰💰💰💰💰💰💰💰💰 💰💰💰💰💰💰💰💰💰💰 💰💰💰💰💰💰💰💰
Other capabilities Guardrails Knowledge base (managed RAG) Agents Cross-region inference
Model evaluations
None
None
None
API Gateway DynamoDB Bedrock EventBridge Webhook AppSync evolua.io Authoriser Fallback
Primary
Lessons
Webhook
Webhook Analyse changes
Webhook Analyse changes Feedback
Condensed view…
None
Lambda timed out after 15 mins
Succeeded on automatic retry
Webhook Analyse changes Feedback LLM limits GitHub limits AWS limits
Lesson: AI is 10% of the problem
None
Reasoning ability
Context window Max response tokens API rate limit Reasoning ability
Context window Max response tokens API rate limit Reasoning ability
Cost Performance
Context window Max response tokens API rate limit Reasoning ability
Cost Performance Important selection criteria for LLMs
Doing cool AI stuff! Working around AI limits
Doing cool AI stuff! Working around AI limits Stop playing
with my bowl…
Context window Max response tokens API rate limit Reasoning ability
Cost Performance
Claude 3.5 Sonnet’s default throughput is 50 per minute
Claude 3.5 Sonnet’s default throughput is 50 per minute Can
be raised to 1,000 per minute
Claude 3.5 Sonnet’s default throughput is 50 per minute Can
be raised to 1,000 per minute Bedrock has cross- region inference
Mitigate API rate limit Raise account limits. Use Bedrock cross-region
inference.
Mitigate API rate limit Raise account limits. Use Bedrock cross-region
inference. Limit no. of parallel requests per PR.
Mitigate API rate limit Raise account limits. Use Bedrock cross-region
inference. Limit no. of parallel requests per PR. Fallback to Anthropic & less powerful models (Claude 3 Sonnet, Claude 3.5 Haiku)
Future work: incorporate other models (Nova, DeepSeek, etc.)
Future work: incorporate other models (Nova, DeepSeek, etc.) Also good
for cost control!
Lesson: LLMs are still quite expensive
None
Dif fi cult to build a sustainable and competitive business
Cost control Only analyse changed lines.
Cost control Only analyse changed lines. Good for cost control
Good for UX
Cost control Only analyse changed lines. Limit free users to
few PRs per month.
API Gateway DynamoDB Bedrock EventBridge Webhook
API Gateway DynamoDB Bedrock EventBridge Webhook Built-in retries & DLQ
Lambda timed out after 15 mins
Lambda timed out after 15 mins Reprocess fi les on
retry…
Lambda timed out after 15 mins Reprocess fi les on
retry… Duplicated side- effects (e.g. Github comments)
Cost control Only analyse changed lines. Limit free users to
few PRs per month. Use checkpoints to avoid re-processing fi les on retries
const issues = await executeIdempotently( `${event-id}-${filename}-analyze`, () => analyzeFile(file) );
... await executeIdempotently( `${event-id}-${filename}-add-gh-comment`, () => addReviewComment(filename, comment) );
Webhook Analyse changes Feedback Why not Step Functions?
Webhook Analyse changes Feedback Why not Step Functions? Checkpoints is
just easier 🤷
Lesson: Latency is a challenge
Models take 10s of seconds to analyse each fi le
Wasted CPU cycles in Lambda
Future work: try other models
Future work: make use of these CPU cycles
Lesson: Be ware of hallucinations
“Give me JSON in this format”
None
“Give me JSON in this format” “Nope!”
None
Non-existent codes, invalid URLs
Non-existent line numbers
Future works
Go to evolua.io to try it out. We’d love your
feedback!
Questions?