Mobile Apps

Social Pages

Miscellaneous

Building Socratic - Medium

Five years ago, Socratic set out on a mission to make learning easier. We began with a Q&A website, and a few years later, built an app. The app has been our primary focus over the past three years, because we believe phones are the future of where students will make great strides in learning.

Now, we have decided to focus 100% on our app, which we deeply believe will help us to execute our mission in the most accessible way. By being mobile-first, we’re meeting students where they are. In order to accomplish this, the website will close to new contributions and transition to a read-only version of itself, with no logins required and a simplified experience designed for reading the website’s content. This means that as of today we are no longer accepting new accounts and as of August 15, 2018 we will no longer be accepting new contributions.

The website began with an idea and a few fiercely passionate folks, and has exceeded our expectations in so many ways. We humbly acknowledge and thank the incredible community of contributors who made the website what it is today: a free, open learning resource for the world. We are so proud of the way your contributions will continue to serve students, and want to maintain the website in this read-only version precisely because of its value to students everywhere.

For details about what will change in the transition, please see our meta post. For guidelines about the website’s content, visit the Help Center. As always, get in touch with us anytime at hello@socratic.org.

You can continue to follow Socratic’s progress here on our blog, as we continue on the journey toward making learning easier.

We’ve been floored by the positive response we’ve received since launching Socratic on iOS. We’ve received thousands of 5-star reviews from iOS users, but also tens of thousands of messages from students demanding Socratic for Android.

It’s no surprise: 88% of smartphones around the world run Android, and even in the US that number is over 50%. So, we listened and got to work.

Today, we’re happy to shout from the mountain tops that it’s finally here! With the new Socratic app on Android, students can use the best homework app on the biggest mobile platform in the world.

Learn in six languages!

With a team that speaks 12 languages* and users in every country in the world, it’s no surprise that we couldn’t wait to start translating Socratic.

Starting today, students can ask questions in 6 languages: English, Spanish, Indonesian, French, Portuguese, and German, opening up the app to over 1.5 billion people in their native language.

Countries that speak one of our six supported languages

Internationalization is a challenge (especially for a team of 10), so we started with languages that at least one of us speaks. Over time, we’ll continue adding languages until we can help every student in the language they understand best.

A beautiful iPad experience

Students at schools and homes around the world often use a device other than their phone. Sometimes it’s a classroom iPad, and other times it’s a family tablet. Until today, that experience left much to be desired.

Today we’re excited to release a version of Socratic designed and built for the iPad. The larger screen size makes reading our beautiful learning content that much easier and more pleasurable — we think it might be better than the phone version!

Learn bigger on iPad

We started Socratic because we believe that students everywhere deserve the best help when they’re learning. With an Android app and support for six of the world’s major languages, we’re a little bit closer to our goal.

It’s a very long road to making learning easy and accessible for all students, and there’s nothing we’d rather do than continue taking steps towards it.

PS. If you love Android, we’re hiring an experienced Android Lead in our New York office.

Our mission at Socratic is to “make learning easy”. Our app lets you take a picture of a homework question, and we teach you how to answer it — magic!

Millions of students use our app and website to learn, and math (especially algebra) is consistently the top subject, for good reason: everyone has to take math, they take it for years, concepts build on each other, and many find it hard to understand.

To provide an excellent math learning experience, we wanted to guide students through their math problems, step-by-step. A good step-by-step solution for an algebra problem (such as “simplify x + ½ + x + ⅓”) should be detailed and have good explanations of what happens along the way. These steps should also feel intuitive — not just any step-by-step solution, but one that a tutor would show their student.

We looked around for existing solutions that we could integrate into our app, but the ones we found were closed-source, behind paywalls, or did not focus on the teaching behind the steps, so we decided to build our own.

Today we’re thrilled to release mathsteps — the first open-source project that teaches math step-by-step. We would love for you to join us in making math easy and fun to learn.

mathsteps in the Socratic app

We use mathsteps to power the math experience in our latest update. Students can take a picture of a math question, and we teach you how to answer it.

mathsteps in your own project

Our primary goal for this project is to build a math solver library that is focused on pedagogy(how best to teach). The math problems we’re currently focusing on are pre-algebra and algebra problems involving simplifying expressions, for example getting from (1 + 2) - abs(-3) * x² to 3 — 3x². Our solution is a node module that, given a string of math, produces a list of steps to the solution. It is important that this step-by-step solution is similar to what a tutor would show a student.

1. Parsing math input

Math expressions are trees

As humans, we read and write math as a line of text. If you were to type a math expression, it would probably look something like this:

(1 + 2) - abs(-3) * x²

You could also just look at that math expression and use your intuition to prioritize where to start simplifying. But a computer will understand the expression best when it’s stored in a tree. These trees can be surprisingly complicated — even a short expression like (1 + 2) - abs(-3) * x² becomes this tree:

the expression tree for (1 + 2) - abs(-3) * x²

There are many existing open source projects that parse strings of math and create trees like this one. Several of these projects are also full Computer Algebra Systems (CAS) which can provide answers to math problems, though not with step-by-step explanations.

When we were researching this project, we considered using an existing CAS and adding steps to it. SymPy, a well known open-source CAS, stood out as a great choice. Upon diving into the code, however, we realized that the structure of SymPy expression trees are optimized for finding answers, but not for teaching. Its trees don’t store division or subtraction because these operations can be represented by multiplication, addition, and exponents.

Sympy introduces ambiguity; given a sympy tree, there are multiple user inputs that could have yielded it, which are mathematically equivalent but not necessarily the same to a student. When building a CAS, it’s beneficial to reduce the problem to make it easier to achieve the goal. Butthe goal of a CAS, only getting the answer, is a different from our goal, a step-by-step solution. And the step-by-step solution requires a different architecture.

The math.js expression tree

Looking further, we found math.js, a powerful and extensive open-source math library. Its expression trees provide lots of details about the structure of the math expression, which is well suited to creating the steps we want. It’s been a huge pleasure working with math.js. Its community is great, and Jos has been very responsive and supportive as we’ve been building mathsteps.

It’s important to note that when math.js creates an expression tree, it represents all operations as binary (ie a node can have maximum two children). This can be explained by the textbook definition of arithmetic operations. For example, + is adding exactly two things together. So 2 + 3 + 4 is actually either (2 + 3) + 4 or 2 + (3 + 4). This means math.js has to make a choice about which two things are being added together. It implicitly adds parenthesis when constructing its tree to make the operations binary.

But because + and * are commutative and associative binary operations, they feel intuitively like they aren’t binary but could have any number of arguments. 2 + 3 + 4 + 5 + 6 feels like an addition of 5 numbers. x * y * x² * x feels like a multiplication of 4 terms, 3 of which have x in them and could be combined together. This combining step turns out to be important in teaching, and is why we need to change the math.js tree to not be binary anymore.

2. Modifying expression trees for step-by-step solutions

After using math.js to create a tree from a string of math, we transform the tree by flattening operations. This flattening step removes grouping choices made by the math.js parser. Through converting the binary tree into one that represents math in a more humanly intuitive way, it becomes much easier to perform step-by-step simplifications.

For example, consider the expression 2 + x + 2 + x. These are the steps for simplifying:

Your question: 2 + x + 2 + x

Collect like terms: (x + x) + (2 + 2)

Combine like terms: 2x + 4

But here’s the issue: the binary tree that math.js generates for 2 + x + 2 + x requires iterating up and down the tree to find like terms. These steps are way easier to do when we first transform the tree like this:

example of flattening addition

The transformed tree is a lot closer to the way we all intuitively view addition. We can then look at the children of (+), see that two of them are x and two of them are numbers, and collect those like terms to get (x + x) + (2 + 2). Flattening multiplication works in the same way.

Notice that even though we change the tree, we still preserve the user’s input and therefore our ability to teach what the student is asking. There is exactly one situation where how we store the tree is a bit different from what the student gave as input: subtraction. When you see the expression 2 - x - 2 - x you probably still see -x and -x as like terms. We restructure the tree in the following way to represent this:

example of flattening subtraction

However, the printed expression 2 + -x + -2 + -x doesn’t really make sense, and we assume the student would never input this. So when we print the tree on the right, we replace the + - with just - to get “2 - x - 2 - x”.

Once we have an expression tree that’s modified to best support step-by-step simplifications, we iteratively apply simplifying rules to the tree. Here are some examples of the main categories of simplifying rules that we iterate over each step, which are applied in an order that a tutor would show their student:

Simplify basics (e.g. ▢⁰ => 1, where ▢ can be any expression)

Evaluate arithmetic (e.g. 2 + 2 => 4)

Collect and combine (e.g. 2x + 4x² + x => 4x² + 3x)

Distribute (e.g. (2x + 3)(x + 4) => 2x² + 11x + 12

Each of these simplifying rules are tree searches that traverse through the whole math expression tree to see if we can perform that simplification anywhere. For example, searching for the rule ▢⁰ => 1 would look like this:

Searching a tree to apply the ▢⁰ => 1 simplification

During the tree search, the algorithm checks nodes one at a time (shown in red in the gif) to see if they match a rule. For the ▢⁰ => 1 rule, the check looks like this:

Check if the node is a ^ operation node. If not, move on.

If so, check the exponent argument. If that exponent is not 0, move on.

If it is, then this node has matched the rule. Replace the node with the constant node 1, to be recorded as the next “step”.

Every tree search in mathsteps finds one place in the tree to apply a simplification, then returns from the search with that simplification. We keep looking for simplifications, starting at the very top of the tree each time, until no more simplifications can be applied. As we go, we keep a list of each simplification that is applied, which then make up the final step-by-step solution.

Intuitive doesn’t mean simple

To create the best teaching experience, we sometimes add extra steps for detail. Ideally, there’s as much detail as possible, so that we’re less likely to leave the student confused.

a full explanation isn’t short or simple

In this example, the best solution is more steps, and also requires more code. Having pedagogical opinions makes the math solver more complex, but these extra details create a more intuitive learning experience because we’re explaining things more thoroughly.

However, complexity can make things… well, more complex. Once we start incorporating the process of teaching math, steps can stop being just simplifications, but that can create technical challenges. For example, the best way to teach someone to add fractions would be to explain making a common denominator first.

ideal steps for adding fractions

Note how the first step makes the expression more complicated! But then, if the tree search only does one change at a time without any context, this could happen:

Infinite loop! Well, darn.

To fix this, we have to remember that we’re in the middle of adding fractions while choosing the next step. Our solution in mathsteps is to group related simplifications (for example, all the steps to add two fractions together) in the same tree search iteration.

Grouping steps to make teaching better

When we group steps, we can also introduce substeps — extra details behind a step that aren’t shown at the top level. This is what it looks like in our app:

substeps in the Socratic app

Collapsed substeps allow us to give detailed steps without overwhelming students at first glance. We can only expose the high level changes at first, and let the student explore the details of steps they don’t understand. Grouped steps aren’t just a technical simplification; they represent a real, intuitive, pedagogical concept.

Detail in the explanations

We tried to make the step descriptions as detailed and specific to the situation as possible; for example, “add the numerators together” is better than just “add the numbers together”. This brings us closer to the language a human tutor might naturally use in a multi-step explanation. We also want to allow users of mathsteps to reference what changed specifically in the expression, for example “add 2 and 3 to make 5”. We keep track of what part of the tree changed in the node.

Optimizing simplifications

In mathsteps, there are two kinds of tree searches: one that simplifies the children of a node first and one that simplifies the parent first.

simplifying child first vs. simplifying parent first

In this example, simplifying the children before the parent (which is called postorder search) simplifies (x⁰)⁰ to 1⁰ and then to 1, which is harder to follow than simplifying the parent before the children (preorder search) and going straight from (x⁰)⁰ to 1. So for the rule ▢⁰ => 1, we change the highest part of the tree that matches the rule.

For orders of operation in arithmetic, however, a postorder search makes more sense, since we’re taught to simplify whatever is deepest in the expression first. For example, (2 * (2 + 3)) will simplify 2 + 3 first, so it’s more efficient for the tree search to start by attempting to perform simplifications lower in the tree.

In general, some searches are better as preorder searches, and others as postorder searches. Sometimes this is for technical reasons and efficiency, but a lot of the time it’s for teaching reasons. It’s important that the codebase is organized around teaching, rather than just solving math.

There’s more to do

We’ve accomplished a lot, and currently provide high quality step-by-step solutions for a subset of high school algebra. However, there is so much to be done to increase our coverage and teach more students. We’re excited for the future of this project, and we’re also excited to see what else will be built with mathsteps.

Here are some ideas we’ve had about great teaching experiences built off of mathsteps:

Before showing students a step, have them guess what to do next and check their work as they go

Keep track of the types of problems a student asks and when they look at substeps, and use this information to customize the detail of their future step-by-step solutions

… and there are many more possibilities! If you have ideas, we’d love to hear them.

Help expand mathsteps

We’ve made mathsteps open-source! Our goal is to help as many students as possible, so we’d love for you to join us to help expand mathsteps to support all kinds of math! A lot of this project was built by a student intern (me!) so you don’t need a fancy PhD to understand it or contribute.

Here are some great places to start:

Check out our small tasks on GitHub — they’re great candidates for your first change!

Read through our tests of the steps or the examples in comments in the code, if you want to explore what the existing code does or how it works

We’re excited about mathsteps and hope it will improve the world of math educational tech for both engineers and students. If you’d like to chat, work with us to create your first PR, or get some help using mathsteps in your projects, please reach out — we’d love to hear from you!

—

Evy Kassirer is a Computer Science student at the University of Waterloo and has interned at Google, Khan Academy, and Socratic. She works to inspire curiosity, likes building stuff that helps people, and loves her communities.

Socratic — now with Math!

Since the launch of the Socratic app in the fall, students have asked us millions of questions across every high-school subject. Of these subjects, math is by far the most popular, and for good reason — nearly every student takes math, often for multiple years, and it’s hard!

Today we’re thrilled to release the next major step in making math easy to learn: take a picture of a math equation — typed or handwritten — and we’ll break it down step-by-step, and teach you how each step works, for free.

Check it out:

Starting with Algebra problems, we first show a step-by-step solution to the problem, with each step clearly color-coded and explained.

We then show Explainers, which teach underlying concepts using simple language and visuals, so students can learn to solve similar problems. Finally, we show graphs, videos, and definitions, adding layers of understanding.

Two teams worked closely over 6 months to build this experience. Our pedagogy team looked through countless math questions asked by students and categorized both the steps required to solve them and the underlying concepts. They wrote high quality Explainers to teach these concepts, and tested them with hundreds of high-school students.

Meanwhile, our engineering team taught a computer how to solve algebra equations step-by-step. They incorporated lessons learned by the pedagogy team, so the steps we show are similar to what a great teacher or tutor would show a student.

Our math experience covers high school Algebra today, and we plan to cover Calculus, Trigonometry, and every other major topic in math.

We’re excited to provide students with an incredible and free math learning experience on iOS. With our ever-growing explainer and math coverage and an Android app in the works, we hope to keep making learning easier and more accessible, the world over.

Everyday, high school kids in the US spend 7 hours at school, a couple of hours doing extracurricular activities, and then go home to do 3 hours of homework.

In all, a third of a student’s total time spent studying, and often a meaningful portion of their grade, is based on self-directed, unsupported learning.

Over the course of hundreds of interviews and user-tests with high-school students, we’ve learned that while doing homework, students face the following set of decisions:

A common decision tree for a student struggling with homework

Getting to the last step, “Copy an answer!”, doesn’t serve anyone — the student fails to learn the material and will do poorly on a future test, the teacher isn’t alerted that the student needs help, and the student is awarded an inaccurate grade that is unfair to others.

We must stop students from hitting step (4), but how do we do that?

We can catch them on the previous steps. Educators, administrators, parents, and policy-makers are thinking deeply about changes to teaching and assessment, addressing steps (1) and (3). As entrepreneurs, we have an opportunity to affect step (2) — helping students learn the material they need on their own.

Today’s situation in education has a parallel to the entertainment industry in the 2000s. Piracy boomed as demand for digital music, movies, and games surpassed the options for convenient access. This trend eventually reversed in the 2010s, as Pandora, Spotify, and other services made it cheap and easy for consumers to legally access great content.

It turned out that “pirates [were] underserved customers”. Similarly, we believe most cheaters are underserved students. Students are living in the education equivalent of a pre-Spotify world.

Today, the ways students learn on their own is inequitable: some students have tutors, some have parents who can help, some have smart friends, many have no one. Even if a student is genuinely motivated to learn, it’s difficult to do this at home without help. If you don’t believe this, ask a teacher how many of their students can learn new concepts on their own from their textbooks. The most dominant educational tool for students is Google, and when students Google homework-related questions, the content they find is often hard to understand, unreliable, and not focused on teaching.

If we want students to learn on their own, we need to do better. We’ve thought hard about how student-focused apps and services could better serve struggling students, and have boiled it down to three key ideas.

Easy to access

Doing homework is stressful enough without having to spend hours looking for the right help. Help students get to content faster by making apps fast, intuitive, and flexible.

Speed is a feature. The importance of loading speed, especially on phones, cannot be overstated. According to Google, users quickly abandon apps that load too slowly. In our tests, 40% of educational pages take more than five seconds to load on phones!

Allow photo and voice input. Improvements in AI technologies are making voice and photo input increasingly more accurate. Both allow students to get their question into an app faster, meaning less time spent searching.

Design for phones. It’s clear that mobile phones are the device of choice for students. We need to design educational products that are native to mobile, and feel and work like the services teenagers use all the time.

Easy to trust

Students judge educational content by its perceived ‘return on investment’, and ask themselves: “Will I learn what I need from this content if I invest the time?” Students should be able to quickly judge the value of the content to their learning.

Don’t bury the lede. Newspapers have known for a long time that readers have short attention spans and need to be engaged immediately. Unfortunately, education content has often treated students as captive readers.

Put your content front and center. As an example of what not to do, try finding the answer to the question on this page.

Keep it short. Content needs to look different when you can only fit 150 words on the screen. A typical textbook would take 1,000 swipes to read on a mobile phone. No one wants to do that.

Make it visual. The most compelling experiences on phones are highly visual. Use images and animated gifs — they can serve as powerful teaching tools. If possible make use of video, but don’t always assume students are in a place where they can hear the audio.

Homework and other forms of self-directed learning can be stressful and challenging for students, but we believe there are many opportunities to make this process more engaging and valuable.

Content can be made more accessible by being faster to load, designed for phones, and flexible in how students can search for it. Content can be made easier to trust by putting the main points up front, and splitting up and naming content to be more specific to the student’s question. And finally content can be made better for learning by using simple language, visual aids, and keeping it short.

Helping students achieve better educational outcomes is a massive, long-term project. We plan to spend many more years working on it, and would love to hear from and engage in conversation with educators, parents, and entrepreneurs that are working to make learning easier.

It’s not easy being a teenager. On top of huge biological and social changes, your future depends on doing well at school, and that’s hard. Every day, after 7 hours of school, you’re asked to do 3 hours of homework. Though you get support from teachers during the day, you’re largely unsupported and responsible for your own learning at night.

We’ve spent three years watching students try to learn on the Internet, and have made it our mission to make learning easier for them. Our Q&A community, Socratic.org, has helped over 16 million students, and helps millions more every month. But to truly accomplish our mission, we had to offer a first-class experience on every teen’s primary platform — their phone.

Today we’re thrilled to announce the Socratic app — point the camera at a question, and we’ll teach you how to answer it.

This app is the result of a year of development involving dozens of teachers, hundreds of high-school students, over 150,000 users of our stealth app, and millions of photos of real homework questions.

We’ve learned a lot about what makes learning on the Internet so hard, and it boils down to two broad problems: First, it’s hard to ask the right questions, and second, great mobile-native content is hard to find.

Easier to ask

When a student is stuck on a problem, they often don’t know where to look for help, or what to ask. They end up typing the entire question into Google and land on Yahoo Answers, which rarely has an explanation that helps them learn.

Compare that to showing a tutor the same problem — a tutor will figure out the concepts required to solve the problem, and will focus on teaching those concepts.

For example, given the question — “A balloon has a volume of 2.9 L at 320 Kelvin. If the temperature is raised to 343 Kelvin, what will its volume be?” — a tutor would recognize “Charles’s Law” as the concept, and would teach that.

We wanted to deliver the same kind of teaching, instantly — given a question, we wanted to show students the concepts required to solve it.

To build this, we asked expert teachers and content creators to look at hundreds of thousands of question submitted by students, and to split them up by the core concepts required to answer them. Then, we fed these questions into our machine learning algorithms and spent months training and refining the system until it could look at a new question and accurately predict which concepts were required to solve the question.

The result was this — given a question, our AI predicts which concept the student needs to understand how to solve the problem:

Our AI identifies the concepts required to solve a specific problem

Easier to understand

The second challenge in learning online is finding great content. Most educational content was created before mobile consumption was a priority. We’ve seen students on iPhones hesitantly flip through 20 page pdfs, scan paragraphs that span multiple screens, and wait 30 seconds for pages to load. In addition, a lot of content is designed in the style of textbooks — favoring density and comprehensiveness over simplicity and intuitiveness.

Content designed primarily for phones looks and feels different: short sentences paired with images, GIFs and short videos, the key points up front, and fast even on slow connections.

So, with the help of amazing educators in the Socratic.org community, we’re creating high-quality content designed with simplicity, intuitiveness, and speed in mind. We hope this content sets the standard for how mobile educational content should look and feel.

Our community is creating and curating high-quality educational content

This is the beginning of a long journey. We’ve learned a lot about the challenges and potential for education on the phone, and have much more left to learn, design, test, and build.

We know that you — students, teachers, parents, and everyone else that cares about the impact of education — are also thinking hard about these problems, and we’d love to hear from you, talk to you, and have you as a part of our growing community.

Love,Team Socratic

Thanks to Ahmed Elnaiem, Becca McArthur, Rosie Talcott, and Christopher Pedregal for their help writing this.

The default tool for writing equations is LaTeX, a decades-old, very powerful, but unintuitive tool.

This is what that equation looks like in LaTeX:

V = \frac{4\pi r^3 }{3}

It’s hard for anyone who hasn’t learned LaTeX to read, write, modify or search for this equation.

But few people take the time to learn LaTeX — one reason why the internet is full of unstructured, hard to read math, or math trapped in images and pdfs.

That’s a pity. The internet would be a better place for learning if it had better formatted math, and the only way that is going to happen is if it’s easy and intuitive to create…

## Enter ASCIIMathML

Our goal at Socratic is to make learning easier. An integral step towards making math easy to learn is empowering our community to create, edit and search for beautifully-formatted equations.

We discovered a little-known technology called ASCIIMathML which does exactly that.

ASCIIMathML is a slightly-less powerful but much more intuitive way of writing math. You basically write equations the same way you’d type them into a graphing calculator (remember that TI-83?) or the Google search bar.

For example, instead of writing:

V = \frac{4\pi r^3 }{3}

You write:

V = (4 pi r^3)/3

Once you start playing with it you’ll be surprised how easy it is to write gorgeous-looking equations.

We encourage all sites that display math content to use ASCIIMathML input. This is especially important on collaborative sites like Socratic where users might want to modify or fork existing content on the site.

Here are the resources you need to add ASCIIMathML to your site:

Learn more about ASCIIMath here (Huge kudos to Prof Jipsen for writing ASCIIMath and giving it a reusable license)

At Socratic, we spend a lot of time understanding how students use their phones. Hours of watching students study, interviews, and user-testing have underscored one main theme: teens use their phones very differently than anyone who didn’t grow up with a smartphone.

To better understand this theme, we asked a few friends with a lot of experience building apps for teenagers to discuss what they’ve learned. We were lucky to have Betaworks (from Giphy, Dots, and Bitly fame), Timehop (an app for digital-obsessed teens, allowing them to look back on digital moments from years past) and Unmute (audio app that lets you broadcast live audio calls from your phone) join us on the call. Listen to the full call here, or read some highlights:

Teens are super savvy about their online presence.

“My brother will take a picture of his pant leg, or you can put your phone all the way next to the floor or the wall, so all you have is the black background and you can write or draw something…it’s the easiest way to blast out a message to all of your friends without sending them a text message.” — Ana Rosenstein from Betaworks

Teens absolutely love screenshots.

“Teens screenshot everything. The Share button can be in front of their face and they’ll avoid it. Screenshoting and sending to a friend is such an easy mechanic that they won’t even use an innate built-in feature.” — Jonathan Wegener from Timehop

Many kids have older, hand-me-down phones.

“Their batteries don’t last that long. Most of the students we interviewed had their dimness all the way down so their battery would last through the day.” — Chris Pedregal from Socratic

Kids turn to Siri to avoid having to spell, or as a workaround for cracked phone screens.

“A kid who came in for user testing had a phone with a screen that was completely cracked. He can’t see anything and yet he’s found an ingenious way to use Siri for everything he does…he can access his voicemail, have Siri read out his voice messages. It was absolutely hysterical.” — Greg Leuch from Betaworks

We’re living in a Snapchat world.

“Wifi equals Snapchat. Snapchat equals wifi. First thing my kids ask for in a new place is the wifi password.” — John Borthwick from Betaworks

“Teens treat screenshoting a Snapchat as a “Like” because they know it will send the person a push notification.” — Matt Hartman from Betaworks

Teens use phones to minimize work for themselves.

“A lot of students won’t take their textbooks home…they open up the chapter they have to read and take a photo of every single page and leave their book behind.” — Chris Pedregal from Socratic

“I think we could ask teens, ‘Would you trade Snapchat for food?’” — John Borthwick from Betaworks

Technology in education has historically been a story of control and limited access.

The main sources of information for students were their textbooks and their teachers. Both were limited: either in content, or in time. Research happened in libraries, closed after school. Lab computers blocked sites. The class portal was a nuisance. All were controlled and chosen by administrators of the school, and were created by companies that saw schools, not students, as their customers.

In recent years, the quality of products offered by schools has superficially improved. Textbooks now come with website access, class portals look more modern, and schools have iPads with authorized apps.

Meanwhile, something has quietly arrived in the hands of students everywhere: choice.

From America to India, smartphone penetration is highest among 18–24 year olds. In developed countries, 80% of 18–24 year olds have one. Empowered by their devices, students have become independent and savvy consumers of information and apps from unlimited sources.

Today, when a student is stuck working on homework or studying for a test, they’ll use what they know and what’s been most useful. That means searching Google, watching a Youtube video, or messaging friends.

Today, it makes little sense for any institution to push poor technology choices on students. The textbook’s website is clunky? Wikipedia and Google are clean and fast. YouTube is blocked in the lab? It works on their phones.

If students don’t like what’s been pushed onto them, they’ll go around it. The only way to help students is to build for them, and the only way to do that is to watch them try to learn.

Watch them search for help on their phones even though they are sitting with a laptop open. Watch them struggle to understand a Wikipedia article on Physics, written at the PhD level. Watch them regularly turn to Yahoo Answers, only to find conflicting responses. Watch what they are trying to do and where it’s breaking, and you’ll find an opportunity.

In this world, building for students is quite like building the rest of the consumer Internet. More experiments will happen. Iteration times will go down. And best of all, products built for students will actually make learning easier.

On Friday, we lowered the mean page load times across our Flask app from 350ms to 96ms. Most of the difference came from one almost imperceptible code change.

Here are the average page load times across all routes of our Flask app, a few hours after making the tiny change:

And here are our page load times after deploying all the changes we made:

Nice!

Here’s how we did it.

We, like many companies, build and iterate quickly — releasing new or improved features almost every week.

With each change, we try to be thoughtful about adding indexes, deleting dead code, and refactoring. But performance is not the primary objective, improving and testing the product is. We’re OK with a little speed-debt creeping in, and we combat it by taking a few days every month to focus on speed.

Our goal last week was to spend two days halving average load times from 350ms to ~180ms.

We started with our most important page, the questions page. The code revealed so many opportunities! We added missing indexes, deleted unnecessary database lookups, and deferred loading of some components till after the page load.

A few hours of work sped up this one page by 20%. Great, but far from our goal.

We turned to New Relic, and the real problem became clear. Here’s a breakdown of the most time-consuming function calls for rendering the page:

A breakdown of the 10 most time-consuming functions on this page

7 out of 10 of them relate to compiling templates. In all, 65 separate templates are used by this page, 22 of which are compiled in more than 1 out of every 5 requests.

A separate template for each potentially reusable bit of UI is great for DRY and consistency, but apparently not for performance.

We discovered that Flask defaults to a 50-template limit for the Jinja2 template cache. With scores of separate templates required by each view, each page would result in dozens of cache misses and recompilations.

To confirm that the template cache was the problem, we set up a profiler. We saw that switching routes would consistently result in scores of calls to `jinja2/[nodes|lexer|compiler].py`, while loading subsequent pages within a route without changing routes would not.

We decided to change the cache limit. Unfortunately, contrary to the usual ease of use of Flask, there was no clean and easy way to do this. Instead, we found a way to remove the cache limit entirely, and added this line before `app.run()`:

app.jinja_env.cache = {}

One line to set the cache to a dictionary, and by doing so, removing the limit of the number of cached templates.

The profiler immediately showed that templates would only be compiled the first time a route was loaded.

We deployed the change, and got this:(ignore the average ms — it’s for the entire time range):

The questions pageThe landing pageThe course page

This one line brought us below our goal, without any of the other changes we made to the code.

We’ve now deployed the other changes we made to the questions page, and are pretty pleased with the results.

Site-wide, average page load times dropped from 350ms to 96ms, a 70% drop.

The questions page, our most viewed route, dropped from around 550ms to 150ms, also a 70% drop.

Socratic, or Socratic.org, is an education tech company that offers a mobile app for students. The app uses AI technology to help students with their homework by providing educational resources like videos, definitions, Q&A, and more.[2] Socratic’s stated mission is to Make Learning Easier.

Socratic was first launched as a web product in 2013 by Chris Pedregal and Shreyans Bhansali, in New York City, United States. They launched their app under the same name in 2016.[3]

Contents

Technology

The Socratic app utilizes AI (Artificial Intelligence) technology to accurately predict which concepts will help a student solve their question. Over months, millions of real student questions were analyzed and classified. Then the app uses that data to guess on future questions and provide specific education content.[4][5]

The app works by letting students take a photo of a homework question.[6] Using OCR (Optical Character Recognition), the app is able to read their photo and classify it using the technology described above. Students receive various “cards” in the app with different learning resources such as definitions, YouTube videos, Q&A, and original content and illustrations written by the Socratic.org web community.[7]

In January 2017, Socratic added additional math features to the app, including step-by-step equation help and graphs.[8]

Subjects

There are in total 4 main groups of subjects on Socratic.org which have sub-branches included:[1]